[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Tue Dec 6 08:14:58 UTC 2016
loleaflet/src/control/Control.ColumnHeader.js | 10 +++++++---
loleaflet/src/control/Control.Header.js | 2 +-
loleaflet/src/control/Control.RowHeader.js | 11 ++++++++---
3 files changed, 16 insertions(+), 7 deletions(-)
New commits:
commit 4c788c3014d1f3935fdfd6e33e84ccb6baadb949
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Dec 6 13:28:30 2016 +0530
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
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index df19c65..cd231cc 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 a625efa..f2d5bfd 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 5e4743a54c637045a0a8c2afebe9962cb275bb8a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Dec 6 13:19:44 2016 +0530
loleaflet: Missing semi-colon
Change-Id: I216dd1caa9bfba33b5538e149aeddfb7159ccbbd
diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index d5443cc..8d19ec6 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -123,7 +123,7 @@ L.Control.Header = L.Control.extend({
L.DomUtil.disableTextSelection();
L.DomEvent.stopPropagation(e);
- L.DomEvent.on(document, 'mousemove', this._onMouseMove, this)
+ L.DomEvent.on(document, 'mousemove', this._onMouseMove, this);
L.DomEvent.on(document, 'mouseup', this._onMouseUp, this);
var rect = target.parentNode.getBoundingClientRect();
More information about the Libreoffice-commits
mailing list