clipboard: no stub message when copy is disabled

When copy is disabled don't put stub message about
download button in the clipboard.
Allow internal copy & paste when copy is disabled
- so disable only external interaction.

Change-Id: Ie7864abc8a239aa068880545cf09a48155ebbaea
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98237
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
Szymon Kłos 2020-07-07 09:31:36 +02:00
parent ac7125b1ea
commit 39d5d55d71

View file

@ -139,6 +139,16 @@ L.Clipboard = L.Class.extend({
)); ));
}, },
// put in the clipboard if copy is disabled
_getCopyDisabledHtml: function() {
var lang = 'en_US'; // FIXME: l10n
return this._substProductName(this._originWrapBody(
' <body lang="' + lang + '" dir="ltr">\n' +
' <p></p>\n' +
' </body>\n', true
));
},
_getMetaOrigin: function (html) { _getMetaOrigin: function (html) {
var match = '<meta name="origin" content="'; var match = '<meta name="origin" content="';
var start = html.indexOf(match); var start = html.indexOf(match);
@ -340,6 +350,9 @@ L.Clipboard = L.Class.extend({
return; return;
} }
if (this._map['wopi'].DisableCopy)
return;
// Do we have a remote Online we can suck rich data from ? // Do we have a remote Online we can suck rich data from ?
if (meta !== '') if (meta !== '')
{ {
@ -427,6 +440,9 @@ L.Clipboard = L.Class.extend({
_getHtmlForClipboard: function() { _getHtmlForClipboard: function() {
var text; var text;
if (this._map['wopi'].DisableCopy)
return this._getCopyDisabledHtml();
if (this._selectionType === 'complex' || if (this._selectionType === 'complex' ||
this._map._docLayer.hasGraphicSelection()) { this._map._docLayer.hasGraphicSelection()) {
console.log('Copy/Cut with complex/graphical selection'); console.log('Copy/Cut with complex/graphical selection');