[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loleaflet/src
Pranav Kant
pranavk at collabora.com
Mon May 30 12:29:40 UTC 2016
loleaflet/src/control/Control.ColumnHeader.js | 13 +++++++++++++
loleaflet/src/control/Control.RowHeader.js | 13 +++++++++++++
2 files changed, 26 insertions(+)
New commits:
commit 98a4aa8635add9895e85affdd482223bd7a20e50
Author: Pranav Kant <pranavk at collabora.com>
Date: Mon May 30 16:52:43 2016 +0530
bccu#1768: loleaflet: Disable row/col headers menu while viewing
Change-Id: I89e0853b2a5e59ecf3e33c785991c5589d9c0864
(cherry picked from commit 08636e6c678955dc1b3a7876bf61cf26d87eb844)
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 12dcdb6..21edd57 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -15,6 +15,7 @@ L.Control.ColumnHeader = L.Control.extend({
this._map.on('updatescrolloffset', this.setScrollPosition, this);
this._map.on('updateviewport', this.setViewPort, this);
this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
+ this._map.on('editlock', this._onEditLock, this);
var docContainer = this._map.options.documentContainer;
var cornerHeader = L.DomUtil.create('div', 'spreadsheet-header-corner', docContainer.parentElement);
L.DomEvent.addListener(cornerHeader, 'click', this._onCornerHeaderClick, this);
@@ -49,6 +50,18 @@ L.Control.ColumnHeader = L.Control.extend({
});
},
+ _onEditLock: function(e) {
+ // editlock message is received very early (before DOM setup)
+ // in that case, wait for a second before disabling/enabling the context menu
+ if ($('.spreadsheet-header-column').length === 0) {
+ setTimeout(function() {
+ $('.spreadsheet-header-column').contextMenu(e.value === 1);
+ }, 1000);
+ } else {
+ $('.spreadsheet-header-column').contextMenu(e.value === 1);
+ }
+ },
+
insertColumn: function(colAlpha) {
// First select the corresponding column because
// .uno:InsertColumn doesn't accept any column number
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index a98e15c..67cea77 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -15,6 +15,7 @@ L.Control.RowHeader = L.Control.extend({
this._map.on('updatescrolloffset', this.setScrollPosition, this);
this._map.on('updateviewport', this.setViewPort, this);
this._map.on('viewrowcolumnheaders', this.viewRowColumnHeaders, this);
+ this._map.on('editlock', this._onEditLock, this);
var docContainer = this._map.options.documentContainer;
var headersContainer = L.DomUtil.create('div', 'spreadsheet-header-rows-container', docContainer.parentElement);
this._rows = L.DomUtil.create('div', 'spreadsheet-header-rows', headersContainer);
@@ -47,6 +48,18 @@ L.Control.RowHeader = L.Control.extend({
});
},
+ _onEditLock: function(e) {
+ // editlock message is received very early (before DOM setup)
+ // in that case, wait for a second before disabling/enabling the context menu
+ if ($('.spreadsheet-header-row').length === 0) {
+ setTimeout(function() {
+ $('.spreadsheet-header-row').contextMenu(e.value === 1);
+ }, 1000);
+ } else {
+ $('.spreadsheet-header-row').contextMenu(e.value === 1);
+ }
+ },
+
insertRow: function(row) {
// First select the corresponding row because
// .uno:InsertRows doesn't accept any row number
More information about the Libreoffice-commits
mailing list