From 795407a7591ef924b351711826e0a0e5fff9d16d Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Thu, 19 Mar 2020 15:23:19 +0100 Subject: mobile: better way for identifying submenus. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We actually have commands for submenus too, so we can use them to generate IDs. Adjust the icon names, which are now generated from commands. Change-Id: I76bb69fb8f83cddfb3d36c3ee74739091bc08f2d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90763 Tested-by: Tamás Zolnai Reviewed-by: Tamás Zolnai (cherry picked from commit 7285fad0f9b076b9667b9c254dd2f54a88ea67f9) Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90645 Tested-by: Andras Timar Reviewed-by: Andras Timar --- loleaflet/images/lc_anchormenu.svg | 55 ++++++++++++++++++++++-- loleaflet/images/lc_arrangeframemenu.svg | 1 + loleaflet/images/lc_arrangemenu.svg | 1 + loleaflet/images/lc_rotateflipmenu.svg | 1 + loleaflet/images/lc_submenu_bringtofront.svg | 1 - loleaflet/images/lc_submenu_rotateright.svg | 1 - loleaflet/images/lc_submenu_setanchoratchar.svg | 53 ----------------------- loleaflet/images/lc_submenu_wrapoff.svg | 12 ------ loleaflet/images/lc_wrapmenu.svg | 12 ++++++ loleaflet/src/control/Control.ContextMenu.js | 1 + loleaflet/src/control/Control.JSDialogBuilder.js | 18 +++----- 11 files changed, 73 insertions(+), 83 deletions(-) create mode 100644 loleaflet/images/lc_arrangeframemenu.svg create mode 100644 loleaflet/images/lc_arrangemenu.svg create mode 100644 loleaflet/images/lc_rotateflipmenu.svg delete mode 100644 loleaflet/images/lc_submenu_bringtofront.svg delete mode 100644 loleaflet/images/lc_submenu_rotateright.svg delete mode 100644 loleaflet/images/lc_submenu_setanchoratchar.svg delete mode 100644 loleaflet/images/lc_submenu_wrapoff.svg create mode 100644 loleaflet/images/lc_wrapmenu.svg diff --git a/loleaflet/images/lc_anchormenu.svg b/loleaflet/images/lc_anchormenu.svg index 66bcde439..94262ca3d 100644 --- a/loleaflet/images/lc_anchormenu.svg +++ b/loleaflet/images/lc_anchormenu.svg @@ -1,4 +1,53 @@ - - - + + + + + + image/svg+xml + + + + + + + + diff --git a/loleaflet/images/lc_arrangeframemenu.svg b/loleaflet/images/lc_arrangeframemenu.svg new file mode 100644 index 000000000..7caa5b828 --- /dev/null +++ b/loleaflet/images/lc_arrangeframemenu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/loleaflet/images/lc_arrangemenu.svg b/loleaflet/images/lc_arrangemenu.svg new file mode 100644 index 000000000..7caa5b828 --- /dev/null +++ b/loleaflet/images/lc_arrangemenu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/loleaflet/images/lc_rotateflipmenu.svg b/loleaflet/images/lc_rotateflipmenu.svg new file mode 100644 index 000000000..40e86d9b3 --- /dev/null +++ b/loleaflet/images/lc_rotateflipmenu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/loleaflet/images/lc_submenu_bringtofront.svg b/loleaflet/images/lc_submenu_bringtofront.svg deleted file mode 100644 index 7caa5b828..000000000 --- a/loleaflet/images/lc_submenu_bringtofront.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/loleaflet/images/lc_submenu_rotateright.svg b/loleaflet/images/lc_submenu_rotateright.svg deleted file mode 100644 index 40e86d9b3..000000000 --- a/loleaflet/images/lc_submenu_rotateright.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/loleaflet/images/lc_submenu_setanchoratchar.svg b/loleaflet/images/lc_submenu_setanchoratchar.svg deleted file mode 100644 index 94262ca3d..000000000 --- a/loleaflet/images/lc_submenu_setanchoratchar.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/loleaflet/images/lc_submenu_wrapoff.svg b/loleaflet/images/lc_submenu_wrapoff.svg deleted file mode 100644 index b34b507e0..000000000 --- a/loleaflet/images/lc_submenu_wrapoff.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/loleaflet/images/lc_wrapmenu.svg b/loleaflet/images/lc_wrapmenu.svg new file mode 100644 index 000000000..b34b507e0 --- /dev/null +++ b/loleaflet/images/lc_wrapmenu.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js index 3a81d430c..1c8dee80a 100644 --- a/loleaflet/src/control/Control.ContextMenu.js +++ b/loleaflet/src/control/Control.ContextMenu.js @@ -280,6 +280,7 @@ L.Control.ContextMenu = L.Control.extend({ contextMenu['submenu' + subMenuIdx++] = { name: _(itemName).replace(/\(~[A-Za-z]\)/, '').replace('~', ''), + command: item.command, items: submenu }; isLastItemText = true; diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 125dbae90..cb0b607ee 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -1658,17 +1658,6 @@ L.Control.JSDialogBuilder = L.Control.extend({ } }); -L.Control.JSDialogBuilder.generateIDForSubMenu = function(menuStructure) { - for (var child = 0; child < menuStructure['children'].length; ++child) { - if (menuStructure['children'][child]['command'] === '.uno:SetAnchorAtChar' || menuStructure['children'][child]['command'] === '.uno:WrapOff' || menuStructure['children'][child]['command'] === '.uno:BringToFront' || menuStructure['children'][child]['command'] === '.uno:RotateRight') { - var tempstring = menuStructure['children'][child]['command']; - tempstring = tempstring.substring(5); - menuStructure['id'] = 'submenu_' + tempstring.toLowerCase(); - break; - } - } -}; - L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainMenu, itemCommand) { if (itemCommand.includes('sep')) return null; @@ -1708,7 +1697,8 @@ L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainM if (mainMenu) { for (var menuItem in menu) { - var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, menuItem); + var subItemCommand = menu[menuItem].command ? menu[menuItem].command : menuItem; + var element = this.getMenuStructureForMobileWizard(menu[menuItem], false, subItemCommand); if (element) menuStructure['children'].push(element); } @@ -1718,7 +1708,9 @@ L.Control.JSDialogBuilder.getMenuStructureForMobileWizard = function(menu, mainM if (element) menuStructure['children'].push(element); } - this.generateIDForSubMenu(menuStructure); + if (menu.command) { + menuStructure.id = menu.command.substring(5).toLowerCase(); + } } return menuStructure; -- cgit v1.2.3