[Libreoffice-commits] online.git: Branch 'libreoffice-5-3' - 2 commits - loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Mon Mar 20 06:27:15 UTC 2017


 loleaflet/src/control/Control.ColumnHeader.js |   10 +++++++---
 loleaflet/src/control/Control.RowHeader.js    |   11 ++++++++---
 loleaflet/src/map/Map.js                      |    2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 1b25f50efdd749d099a224f13dc5424a51410398
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Dec 6 13:28:30 2016 +0530

    tdf#106601 loleaflet: Disable row/col header context menu in readonly/view
    
    Also fix a js error trying to disable context menu before
    row/column headers are created.
    
    Change-Id: I6b04ce5c0fefa00567ce5fe58fdad9102d1f1651
    Reviewed-on: https://gerrit.libreoffice.org/35363
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index df19c650..cd231ccb 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -192,6 +192,10 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 			}
 			L.DomEvent.addListener(text, 'click', this._onColumnHeaderClick, this);
 		}
+
+		if ($('.spreadsheet-header-column-text').length > 0) {
+			$('.spreadsheet-header-column-text').contextMenu(this._map._permission === 'edit');
+		}
 	},
 
 	_colAlphaToNumber: function(alpha) {
@@ -332,9 +336,9 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 		if (!this._initialized) {
 			this._initialize();
 		}
-		setTimeout(function() {
-			$('.spreadsheet-header-column').contextMenu(e.perm === 'edit');
-		}, 1000);
+		if ($('.spreadsheet-header-column-text').length > 0) {
+			$('.spreadsheet-header-column-text').contextMenu(e.perm === 'edit');
+		}
 	}
 });
 
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index a625efa8..f2d5bfd8 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -190,6 +190,10 @@ L.Control.RowHeader = L.Control.Header.extend({
 			}
 			L.DomEvent.addListener(text, 'click', this._onRowHeaderClick, this);
 		}
+
+		if ($('.spreadsheet-header-row-text').length > 0) {
+			$('.spreadsheet-header-row-text').contextMenu(this._map._permission === 'edit');
+		}
 	},
 
 	_selectRow: function(row, modifier) {
@@ -319,9 +323,10 @@ L.Control.RowHeader = L.Control.Header.extend({
 		if (!this._initialized) {
 			this._initialize();
 		}
-		setTimeout(function() {
-			$('.spreadsheet-header-row').contextMenu(e.perm === 'edit');
-		}, 1000);
+		// Enable context menu on row headers only if permission is 'edit'
+		if ($('.spreadsheet-header-row-text').length > 0) {
+			$('.spreadsheet-header-row-text').contextMenu(e.perm === 'edit');
+		}
 	}
 });
 
commit 34df3408388e57bc0b6ca5742ae42b6d014c5aca
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Dec 7 18:03:50 2016 +0530

    tdf#106601 loleaflet: Popup virtual keyboard only in editmode
    
    Change-Id: I5e1e134e07f65bc52ff3c5f38879ad3b7097254c
    Reviewed-on: https://gerrit.libreoffice.org/35365
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index aaa04ac1..f692ea37 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -897,7 +897,7 @@ L.Map = L.Evented.extend({
 		// For touch devices, to pop-up the keyboard, it is required to call
 		// .focus() method on hidden input within actual 'click' event here
 		// Calling from some other place with no real 'click' event doesn't work
-		if (type === 'click') {
+		if (type === 'click' && this._permission === 'edit') {
 			this._textArea.blur();
 			this._textArea.focus();
 		}


More information about the Libreoffice-commits mailing list