[Libreoffice-commits] online.git: loleaflet/src

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 7 08:37:48 UTC 2020


 loleaflet/src/map/Clipboard.js |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 39d5d55d719730f42073df86d1103888598a9042
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 7 09:31:36 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jul 7 10:37:29 2020 +0200

    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 at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index 31a459aa2..694019246 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -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) {
 		var match = '<meta name="origin" content="';
 		var start = html.indexOf(match);
@@ -340,6 +350,9 @@ L.Clipboard = L.Class.extend({
 			return;
 		}
 
+		if (this._map['wopi'].DisableCopy)
+			return;
+
 		// Do we have a remote Online we can suck rich data from ?
 		if (meta !== '')
 		{
@@ -427,6 +440,9 @@ L.Clipboard = L.Class.extend({
 
 	_getHtmlForClipboard: function() {
 		var text;
+		if (this._map['wopi'].DisableCopy)
+			return this._getCopyDisabledHtml();
+
 		if (this._selectionType === 'complex' ||
 		    this._map._docLayer.hasGraphicSelection()) {
 			console.log('Copy/Cut with complex/graphical selection');


More information about the Libreoffice-commits mailing list