Menus: refactoring and renaming

This commit is contained in:
Zef Hemel
2026-04-23 13:32:00 +02:00
parent 1e5d35ab8d
commit d0cb8e6c0e
5 changed files with 26 additions and 27 deletions
+3 -4
View File
@@ -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();
@@ -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:
+15 -18
View File
@@ -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
+2 -2
View File
@@ -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
+2
View File
@@ -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"