summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-03-19 14:35:20 +0100
committerAndras Timar <andras.timar@collabora.com>2020-03-19 16:37:35 +0100
commit3b1d7123149058e577c99e2a3c8b68563ac96e5c (patch)
tree8bb5f56f41dfa3f7f8bfe0900dd01db03ee6108d
parent0d531cc0b5fb14509c4e3d0684fd082f93808b44 (diff)
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@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--loleaflet/src/control/Control.JSDialogBuilder.js10
1 files changed, 7 insertions, 3 deletions
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;