[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - 2 commits - loleaflet/src

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 14:03:56 UTC 2020


 loleaflet/src/map/Clipboard.js |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit a33d8de3a2a6a4a3298e31282a7076f7c3c64afc
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 7 09:52:04 2020 +0200
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Tue Jul 14 16:03:42 2020 +0200

    clipboard: avoid error when localStorage is not available
    
    In some browsers with strange settings localStorage is
    not available.
    
    Change-Id: If9e5ebeb9701cc0a2b19c5946bcbc23f76a8c577
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98238
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    (cherry picked from commit ac7125b1ea4f451a4dfef0a7eed999e18ff0f51b)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98087
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 208d8a944906f35e7e1a0b3fdbaa077a8d44475d)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98631

diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index 29bb77e67..160b664f4 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -786,10 +786,13 @@ L.Clipboard = L.Class.extend({
 
 	_userAlreadyWarned: function (warning) {
 		var itemKey = warning;
-		if (!localStorage.getItem(itemKey)) {
-			localStorage.setItem(itemKey, '1');
+		var storage = localStorage;
+		if (storage && !storage.getItem(itemKey)) {
+			storage.setItem(itemKey, '1');
 			return false;
-		}
+		} else if (!storage)
+			return false;
+
 		return true;
 	},
 
commit d0ac57d2cef915e1463ee31f37abac17609852f0
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 7 09:31:36 2020 +0200
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Tue Jul 14 16:03:26 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>
    (cherry picked from commit 39d5d55d719730f42073df86d1103888598a9042)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98088
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 76030544269d6b8d03919098cb4187baf383081e)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98630

diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index c7b604083..29bb77e67 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