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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 11 17:06:50 UTC 2020


 loleaflet/src/control/Control.JSDialogBuilder.js |    2 -
 loleaflet/src/control/Control.Menubar.js         |   24 ++++++++++++++++-------
 2 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit e8832ac787f00a3a158d9b025385ee5f4e1308e8
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Mar 11 16:24:09 2020 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Mar 11 18:06:32 2020 +0100

    hamburger menu wizard - pass the full item data in.
    
    _executeAction has to cope with being called from the JSDialogBuilder
    as well as our grim jquery menu library, so pass in enough information
    for it to be able to do a good job still from the original menu
    structure.
    
    Change-Id: I61445e9181d6f7f62a78581e6ecee8275aa1e3b1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90340
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index ebb006607..c9c1965d1 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1507,7 +1507,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 				// before close the wizard then execute the action
 				if (data.executionType === 'action') {
-					builder.map.menubar._executeAction(undefined, data.id);
+					builder.map.menubar._executeAction(undefined, data);
 				} else if (data.executionType === 'callback') {
 					data.callback();
 				} else if (!builder.map._clip || !builder.map._clip.filterExecCopyPaste(data.command)) {
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 475d23f94..c9c7e39a2 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -1082,9 +1082,18 @@ L.Control.Menubar = L.Control.extend({
 		this._map._docLayer._openMobileWizard(data);
 	},
 
-	_executeAction: function(item, id) {
-		if (!id)
-			id = $(item).data('id');
+	_executeAction: function(itNode, itWizard) {
+		var id, data;
+		if (itNode === undefined)
+		{ // called from JSDialogBuilder
+			id = itWizard.id;
+			data = function(key) { return itWizard.data[key]; };
+		}
+		else
+		{ // called from
+			id = $(itNode).data('id');
+			data = $(itNode).data;
+		}
 
 		if (id === 'save') {
 			// Save only when not read-only.
@@ -1119,7 +1128,7 @@ L.Control.Menubar = L.Control.extend({
 		} else if (id === 'zoomin' && this._map.getZoom() < this._map.getMaxZoom()) {
 			this._map.zoomIn(1);
 		} else if (id === 'showresolved') {
-			this._map.showResolvedComments(!$(item).hasClass('lo-menu-item-checked'));
+			this._map.showResolvedComments(!$(itNode).hasClass('lo-menu-item-checked'));
 		} else if (id === 'zoomout' && this._map.getZoom() > this._map.getMinZoom()) {
 			this._map.zoomOut(1);
 		} else if (id === 'zoomreset') {
@@ -1197,11 +1206,11 @@ L.Control.Menubar = L.Control.extend({
 					self._map.focus();
 				}
 			});
-		} else if (window.ThisIsAMobileApp && $(item).data('mobileappuno')) {
-			this._map.sendUnoCommand($(item).data('mobileappuno'));
+		} else if (window.ThisIsAMobileApp && data('mobileappuno')) {
+			this._map.sendUnoCommand(data('mobileappuno'));
 		}
 		// Inform the host if asked
-		if ($(item).data('postmessage') === 'true') {
+		if (data('postmessage') === 'true') {
 			this._map.fire('postMessage', {msgId: 'Clicked_Button', args: {Id: id} });
 		}
 	},
@@ -1535,6 +1544,7 @@ L.Control.Menubar = L.Control.extend({
 			text : itemName,
 			command : item.uno,
 			executionType : item.type,
+			data : item,
 			children : []
 		};
 


More information about the Libreoffice-commits mailing list