From d0cb8e6c0e048415be3dabc113abc40468d0808f Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 23 Apr 2026 13:32:00 +0200 Subject: [PATCH] Menus: refactoring and renaming --- client/editor_commands.ts | 7 ++-- .../configuration-manager.plug.yaml | 7 ++-- plugs/editor/editor.plug.yaml | 33 +++++++++---------- plugs/index/index.plug.yaml | 4 +-- plugs/sync/sync.plug.yaml | 2 ++ 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/client/editor_commands.ts b/client/editor_commands.ts index 016ed201..35825756 100644 --- a/client/editor_commands.ts +++ b/client/editor_commands.ts @@ -427,6 +427,7 @@ export function registerEditorCommands( mac: "Cmd-z", requireMode: "rw", requireEditor: "page", + menu: { location: "edit", group: "1_undo", order: 1, label: "Undo" }, run: async () => undo(view()), }); hook.registerCommand({ @@ -435,6 +436,7 @@ export function registerEditorCommands( mac: "Cmd-Shift-z", requireMode: "rw", requireEditor: "page", + menu: { location: "edit", group: "1_undo", order: 2, label: "Redo" }, run: async () => redo(view()), }); @@ -501,7 +503,6 @@ export function registerEditorCommands( }); hook.registerCommand({ name: "Navigate: Anything Picker", - menu: { location: "navigate", group: "2_picker", order: 5, label: "Everything..." }, run: async () => client.startPageNavigate("all"), }); hook.registerCommand({ @@ -509,7 +510,7 @@ export function registerEditorCommands( key: "Ctrl-f", mac: "Cmd-f", requireEditor: "page", - menu: { location: "edit", group: "3_find" }, + menu: { location: "edit", group: "3_find", label: "Find in Page..." }, run: async () => { openSearchPanel(view()); return false; // keep focus on search panel, not the editor @@ -519,7 +520,6 @@ export function registerEditorCommands( name: "Editor: New Window", key: "Ctrl-n", mac: "Cmd-n", - menu: { location: "file", group: "1_new", order: 1 }, run: async () => { globalThis.open( location.href, @@ -531,7 +531,6 @@ export function registerEditorCommands( hook.registerCommand({ name: "Widgets: Refresh All", requireEditor: "page", - menu: { location: "space", group: "2_index", order: 3 }, run: async () => { broadcastReload(); return reloadAllWidgets(); diff --git a/plugs/configuration-manager/configuration-manager.plug.yaml b/plugs/configuration-manager/configuration-manager.plug.yaml index 284d9e8e..ea871e79 100644 --- a/plugs/configuration-manager/configuration-manager.plug.yaml +++ b/plugs/configuration-manager/configuration-manager.plug.yaml @@ -19,20 +19,21 @@ functions: mac: "Cmd-," requireMode: rw menuMac: { location: app, group: "4_prefs", order: 1, label: "Configuration..." } - menu: { location: file, group: "7_settings", order: 1, label: "Configuration..." } + menu: { location: file, group: "2_prefs", order: 1, label: "Configuration..." } openShortcuts: path: ./configuration.ts:openShortcuts command: name: "Configuration: Keyboard Shortcuts" requireMode: rw menuMac: { location: app, group: "4_prefs", order: 2, label: "Keyboard Shortcuts..." } - menu: { location: file, group: "7_settings", order: 2, label: "Keyboard Shortcuts..." } + menu: { location: file, group: "2_prefs", order: 2, label: "Keyboard Shortcuts..." } openLibraries: path: ./configuration.ts:openLibraries command: name: "Libraries: Manager" requireMode: rw - menu: { location: space, group: "3_libs", label: "Libraries..." } + menuMac: { location: app, group: "4_prefs", order: 3, label: "Libraries..." } + menu: { location: file, group: "2_prefs", order: 3, label: "Libraries..." } openLibrariesLegacyManager: path: ./configuration.ts:openLibrariesLegacyManager command: diff --git a/plugs/editor/editor.plug.yaml b/plugs/editor/editor.plug.yaml index 26de2961..947ee4f7 100644 --- a/plugs/editor/editor.plug.yaml +++ b/plugs/editor/editor.plug.yaml @@ -10,12 +10,11 @@ functions: path: "./editor.ts:toggleDarkMode" command: name: "Editor: Toggle Dark Mode" - menu: { location: view, group: "1_toggle", order: 1 } + menu: { location: view, group: "1_toggle", order: 1, label: "Toggle Dark Mode" } toggleMarkdownSyntaxRendering: path: "./editor.ts:toggleMarkdownSyntaxRendering" command: name: "Editor: Toggle Markdown Syntax Rendering" - menu: { location: view, group: "1_toggle", order: 2 } openTagNavigator: path: editor.ts:openTagNavigator command: @@ -30,7 +29,7 @@ functions: name: "Page: Delete" requireMode: rw requireEditor: page - menu: { location: file, group: "4_page", order: 2 } + menu: { location: file, group: "4_page", order: 2, label: "Delete Page" } copyPage: path: "./page.ts:copyPage" command: @@ -49,7 +48,7 @@ functions: command: name: "System: Reload" key: Ctrl-Alt-r - menu: { location: space, group: "4_system", order: 1 } + menu: { location: space, group: "4_system", order: 1, label: "System Reload" } footnoteComplete: path: complete.ts:footnoteComplete @@ -94,7 +93,7 @@ functions: key: "Ctrl-Shift-h" mac: "Cmd-Shift-h" page: "" - menu: { location: navigate, group: "1_home" } + menu: { location: navigate, group: "1_home", order: 1, label: "Home" } moveToPos: path: "./editor.ts:moveToPosCommand" @@ -137,13 +136,13 @@ functions: path: "./navigate.ts:navigateBack" command: name: "Navigate: Back in History" - menu: { location: navigate, group: "4_history", order: 1, label: "Back" } + menu: { location: navigate, group: "1_home", order: 2, label: "Back" } navigateForward: path: "./navigate.ts:navigateForward" command: name: "Navigate: Forward in History" - menu: { location: navigate, group: "4_history", order: 2, label: "Forward" } + menu: { location: navigate, group: "1_home", order: 3, label: "Forward" } # Text editing commands quoteSelectionCommand: @@ -186,7 +185,7 @@ functions: wrapper: "**" requireMode: rw requireEditor: page - menu: { location: edit.format, group: "1_inline", order: 1 } + menu: { location: edit.format, group: "1_inline", order: 1, label: "Bold" } italic: path: ./text.ts:wrapSelection command: @@ -196,7 +195,7 @@ functions: wrapper: "_" requireMode: rw requireEditor: page - menu: { location: edit.format, group: "1_inline", order: 2 } + menu: { location: edit.format, group: "1_inline", order: 2, label: "Italic" } strikethrough: path: ./text.ts:wrapSelection command: @@ -205,7 +204,7 @@ functions: wrapper: "~~" requireMode: rw requireEditor: page - menu: { location: edit.format, group: "1_inline", order: 3 } + menu: { location: edit.format, group: "1_inline", order: 3, label: "Strikethrough" } marker: path: ./text.ts:wrapSelection command: @@ -235,7 +234,7 @@ functions: command: name: "Editor: Toggle Vim Mode" requireEditor: page - menu: { location: view, group: "1_toggle", order: 3 } + menu: { location: view, group: "1_toggle", order: 3, label: "Toggle Vim Mode" } loadVimConfig: path: "./vim.ts:loadVimConfig" command: @@ -250,20 +249,18 @@ functions: command: name: "Stats: Show" requireEditor: page - menu: { location: space, group: "5_info", label: "Statistics" } + menu: { location: view, group: "5_info", label: "Statistics" } # Client commands reloadUICommand: path: ./system.ts:reloadUICommand command: name: "Client: Reload UI" - menu: { location: view, group: "3_reload", order: 2 } reloadPlugsCommand: path: ./system.ts:reloadPlugsCommand command: name: "Plugs: Reload" - menu: { location: space, group: "2_index", order: 2 } wipeClientCommand: path: ./system.ts:wipeClientCommand @@ -297,7 +294,7 @@ functions: - "Mod-. k" requireMode: rw requireEditor: page - menu: { location: edit.outline, group: "1_move", order: 1 } + menu: { location: edit.outline, group: "1_move", order: 1, label: "Move Up" } outlineMoveDown: path: ./outline.ts:moveItemDown @@ -308,7 +305,7 @@ functions: - "Mod-. j" requireMode: rw requireEditor: page - menu: { location: edit.outline, group: "1_move", order: 2 } + menu: { location: edit.outline, group: "1_move", order: 2, label: "Move Down" } outlineIndent: path: ./outline.ts:indentItem @@ -350,13 +347,13 @@ functions: command: name: "Outline: Fold All" requireEditor: page - menu: { location: view, group: "2_outline", order: 1 } + menu: { location: edit.outline, group: "2_fold", order: 1, label: "Fold All" } unfoldAllCommand: path: ./outline.ts:unfoldAllCommand command: name: "Outline: Unfold All" requireEditor: page - menu: { location: view, group: "2_outline", order: 2 } + menu: { location: edit.outline, group: "2_fold", order: 2, label: "Unfold All" } # Demo customFlashMessage: path: editor.ts:customFlashMessage diff --git a/plugs/index/index.plug.yaml b/plugs/index/index.plug.yaml index b11ea812..0061c8aa 100644 --- a/plugs/index/index.plug.yaml +++ b/plugs/index/index.plug.yaml @@ -30,7 +30,7 @@ functions: path: "./command.ts:reindexCommand" command: name: "Space: Reindex" - menu: { location: space, group: "2_index", order: 1 } + menu: { location: space, group: "2_index", order: 1, label: "Reindex Space" } processIndexQueue: path: ./queue.ts:processIndexQueue @@ -75,7 +75,7 @@ functions: path: "./refactor.ts:renamePageCommand" command: name: "Page: Rename" - menu: { location: file, group: "4_page", order: 1 } + menu: { location: file, group: "4_page", order: 1, label: "Rename Page..." } page: "" requireMode: rw requireEditor: page diff --git a/plugs/sync/sync.plug.yaml b/plugs/sync/sync.plug.yaml index ee16b37b..b693404f 100644 --- a/plugs/sync/sync.plug.yaml +++ b/plugs/sync/sync.plug.yaml @@ -9,6 +9,7 @@ functions: location: space group: "1_sync" order: 1 + label: "Sync Space" syncFileCommand: path: "./sync.ts:syncFileCommand" @@ -18,6 +19,7 @@ functions: location: space group: "1_sync" order: 2 + label: "Sync File" spaceSyncComplete: path: "./sync.ts:spaceSyncComplete"