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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 19 14:34:38 UTC 2020


 loleaflet/src/control/Control.JSDialogBuilder.js |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit a394b56423f89b8db1f1fa9878fff23f5b906509
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Mar 19 14:35:20 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Mar 19 15:34:20 2020 +0100

    mobile: better way to generate ID for submenus.
    
    We don't have any other information for the submenu
    only it's text and it's children, so let's use
    the children's command to find out what submenu we have
    here.
    
    Change-Id: I188186142fc1dbe483fcce5b5456e0cb1524382e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90750
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index e6c8f5eeb..f9f536a8e 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1659,8 +1659,12 @@ L.Control.JSDialogBuilder = L.Control.extend({
 });
 
 L.Control.JSDialogBuilder.generateIDForSubMenu = function(menuStructure) {
-	if (menuStructure['text'] === 'Anchor')
-		menuStructure['id'] = 'submenu_anchor';
+	for (var child = 0; child < menuStructure['children'].length; ++child) {
+		if (menuStructure['children'][child]['command'] === '.uno:SetAnchorAtChar') {
+			menuStructure['id'] = 'submenu_anchor';
+			break;
+		}
+	}
 };
 
 L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainMenu, itemCommand) {
@@ -1711,8 +1715,8 @@ L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainM
 			element = this.getMenuStructureForMobileWizard(menu.items[menuItem], false, menuItem);
 			if (element)
 				menuStructure['children'].push(element);
-			this.generateIDForSubMenu(menuStructure);
 		}
+		this.generateIDForSubMenu(menuStructure);
 	}
 
 	return menuStructure;


More information about the Libreoffice-commits mailing list