From 0c1640a75a777714b9d9c549ba160a47d3f2e23a Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 12 Feb 2022 09:16:12 +0100 Subject: [PATCH] client main menu --- app/src/electron.js | 2 +- packages/web/src/modals/DropDownMenu.svelte | 49 +------------- packages/web/src/modals/HorizontalMenu.svelte | 65 +++++++++++++++++++ packages/web/src/utility/common.ts | 4 +- packages/web/src/utility/contextMenu.ts | 52 ++++++++++++++- packages/web/src/widgets/TitleBar.svelte | 9 ++- .../web/src/widgets/WidgetIconPanel.svelte | 1 - 7 files changed, 128 insertions(+), 54 deletions(-) create mode 100644 packages/web/src/modals/HorizontalMenu.svelte diff --git a/app/src/electron.js b/app/src/electron.js index 8ab81405..24f370f1 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -235,7 +235,7 @@ function createWindow() { isNativeMenu = os.platform() == 'darwin' ? true : false; if (initialConfig['menuStyle'] == 'native') isNativeMenu = true; if (initialConfig['menuStyle'] == 'client') isNativeMenu = false; - isNativeMenu = true; + // isNativeMenu = true; mainWindow = new BrowserWindow({ width: 1200, diff --git a/packages/web/src/modals/DropDownMenu.svelte b/packages/web/src/modals/DropDownMenu.svelte index 6c26e867..6dcbd2aa 100644 --- a/packages/web/src/modals/DropDownMenu.svelte +++ b/packages/web/src/modals/DropDownMenu.svelte @@ -33,47 +33,6 @@ if (newLeft != null) element.style.left = `${newLeft}px`; if (newTop != null) element.style.top = `${newTop}px`; } - - function mapItem(item, commands) { - if (item.command) { - const command = commands[item.command]; - if (command) { - return { - text: command.menuName || command.toolbarName || command.name, - keyText: command.keyText || command.keyTextFromGroup, - onClick: () => { - if (command.getSubCommands) visibleCommandPalette.set(command); - else if (command.onClick) command.onClick(); - }, - disabled: !command.enabled, - hideDisabled: item.hideDisabled, - }; - } - return null; - } - return item; - } - - function filterMenuItems(items) { - const res = []; - let wasDivider = false; - let wasItem = false; - for (const item of items.filter(x => !x.disabled || !x.hideDisabled)) { - if (item.divider) { - if (wasItem) { - wasDivider = true; - } - } else { - if (wasDivider) { - res.push({ divider: true }); - } - wasDivider = false; - wasItem = true; - res.push(item); - } - } - return res; - }