From 3517715aab5d3e075ee6a806be7b1eae8efff604 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 27 Jul 2025 17:41:00 +0300 Subject: [PATCH] feat(command_palette): add icons to all actions --- apps/client/src/services/command_registry.ts | 10 +- apps/server/src/services/keyboard_actions.ts | 95 +++++++++++++++++++ .../src/lib/keyboard_actions_interface.ts | 5 + 3 files changed, 105 insertions(+), 5 deletions(-) diff --git a/apps/client/src/services/command_registry.ts b/apps/client/src/services/command_registry.ts index 8d746ab90..7e32b79d4 100644 --- a/apps/client/src/services/command_registry.ts +++ b/apps/client/src/services/command_registry.ts @@ -51,11 +51,11 @@ class CommandRegistry { // Special commands with custom handlers this.register({ - id: "create-sql-console", - name: "Create SQL Console", - description: "Create a new SQL console note", + id: "show-sql-console", + name: "Show SQL Console", + description: "Open SQL console page", icon: "bx bx-data", - handler: () => appContext.triggerCommand("showSQLConsole") + commandName: "showSQLConsole" }); this.register({ @@ -174,7 +174,7 @@ class CommandRegistry { id: action.actionName, name: action.friendlyName, description: action.description, - icon: this.getIconForAction(action.actionName), + icon: action.iconClass || this.getIconForAction(action.actionName), shortcut: primaryShortcut ? this.formatShortcut(primaryShortcut) : undefined, commandName: action.actionName as CommandNames, source: "keyboard-action" diff --git a/apps/server/src/services/keyboard_actions.ts b/apps/server/src/services/keyboard_actions.ts index 4bec12516..85cce0f65 100644 --- a/apps/server/src/services/keyboard_actions.ts +++ b/apps/server/src/services/keyboard_actions.ts @@ -18,6 +18,7 @@ function getDefaultKeyboardActions() { { actionName: "backInNoteHistory", friendlyName: t("keyboard_action_names.back-in-note-history"), + iconClass: "bx bxs-chevron-left", // Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376 defaultShortcuts: isMac ? ["CommandOrControl+Left"] : ["Alt+Left"], description: t("keyboard_actions.back-in-note-history"), @@ -26,6 +27,7 @@ function getDefaultKeyboardActions() { { actionName: "forwardInNoteHistory", friendlyName: t("keyboard_action_names.forward-in-note-history"), + iconClass: "bx bxs-chevron-right", // Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376 defaultShortcuts: isMac ? ["CommandOrControl+Right"] : ["Alt+Right"], description: t("keyboard_actions.forward-in-note-history"), @@ -34,6 +36,7 @@ function getDefaultKeyboardActions() { { actionName: "jumpToNote", friendlyName: t("keyboard_action_names.jump-to-note"), + iconClass: "bx bx-send", defaultShortcuts: ["CommandOrControl+J"], description: t("keyboard_actions.open-jump-to-note-dialog"), scope: "window" @@ -41,6 +44,7 @@ function getDefaultKeyboardActions() { { actionName: "commandPalette", friendlyName: t("keyboard_action_names.command-palette"), + iconClass: "bx bx-terminal", defaultShortcuts: ["CommandOrControl+Shift+J"], description: t("keyboard_actions.open-command-palette"), scope: "window" @@ -49,12 +53,14 @@ function getDefaultKeyboardActions() { actionName: "scrollToActiveNote", friendlyName: t("keyboard_action_names.scroll-to-active-note"), defaultShortcuts: ["CommandOrControl+."], + iconClass: "bx bx-current-location", description: t("keyboard_actions.scroll-to-active-note"), scope: "window" }, { actionName: "quickSearch", friendlyName: t("keyboard_action_names.quick-search"), + iconClass: "bx bx-search", defaultShortcuts: ["CommandOrControl+S"], description: t("keyboard_actions.quick-search"), scope: "window" @@ -63,6 +69,7 @@ function getDefaultKeyboardActions() { actionName: "searchInSubtree", friendlyName: t("keyboard_action_names.search-in-subtree"), defaultShortcuts: ["CommandOrControl+Shift+S"], + iconClass: "bx bx-search-alt", description: t("keyboard_actions.search-in-subtree"), scope: "note-tree" }, @@ -70,6 +77,7 @@ function getDefaultKeyboardActions() { actionName: "expandSubtree", friendlyName: t("keyboard_action_names.expand-subtree"), defaultShortcuts: [], + iconClass: "bx bx-layer-plus", description: t("keyboard_actions.expand-subtree"), scope: "note-tree" }, @@ -77,12 +85,14 @@ function getDefaultKeyboardActions() { actionName: "collapseTree", friendlyName: t("keyboard_action_names.collapse-tree"), defaultShortcuts: ["Alt+C"], + iconClass: "bx bx-layer-minus", description: t("keyboard_actions.collapse-tree"), scope: "window" }, { actionName: "collapseSubtree", friendlyName: t("keyboard_action_names.collapse-subtree"), + iconClass: "bx bxs-layer-minus", defaultShortcuts: ["Alt+-"], description: t("keyboard_actions.collapse-subtree"), scope: "note-tree" @@ -90,6 +100,7 @@ function getDefaultKeyboardActions() { { actionName: "sortChildNotes", friendlyName: t("keyboard_action_names.sort-child-notes"), + iconClass: "bx bx-sort-down", defaultShortcuts: ["Alt+S"], description: t("keyboard_actions.sort-child-notes"), scope: "note-tree" @@ -101,6 +112,7 @@ function getDefaultKeyboardActions() { { actionName: "createNoteAfter", friendlyName: t("keyboard_action_names.create-note-after"), + iconClass: "bx bx-plus", defaultShortcuts: ["CommandOrControl+O"], description: t("keyboard_actions.create-note-after"), scope: "window" @@ -108,6 +120,7 @@ function getDefaultKeyboardActions() { { actionName: "createNoteInto", friendlyName: t("keyboard_action_names.create-note-into"), + iconClass: "bx bx-plus", defaultShortcuts: ["CommandOrControl+P"], description: t("keyboard_actions.create-note-into"), scope: "window" @@ -115,6 +128,7 @@ function getDefaultKeyboardActions() { { actionName: "createNoteIntoInbox", friendlyName: t("keyboard_action_names.create-note-into-inbox"), + iconClass: "bx bx-inbox", defaultShortcuts: ["global:CommandOrControl+Alt+P"], description: t("keyboard_actions.create-note-into-inbox"), scope: "window" @@ -122,6 +136,7 @@ function getDefaultKeyboardActions() { { actionName: "deleteNotes", friendlyName: t("keyboard_action_names.delete-notes"), + iconClass: "bx bx-trash", defaultShortcuts: ["Delete"], description: t("keyboard_actions.delete-note"), scope: "note-tree" @@ -129,6 +144,7 @@ function getDefaultKeyboardActions() { { actionName: "moveNoteUp", friendlyName: t("keyboard_action_names.move-note-up"), + iconClass: "bx bx-up-arrow-alt", defaultShortcuts: isMac ? ["Alt+Up"] : ["CommandOrControl+Up"], description: t("keyboard_actions.move-note-up"), scope: "note-tree" @@ -136,6 +152,7 @@ function getDefaultKeyboardActions() { { actionName: "moveNoteDown", friendlyName: t("keyboard_action_names.move-note-down"), + iconClass: "bx bx-down-arrow-alt", defaultShortcuts: isMac ? ["Alt+Down"] : ["CommandOrControl+Down"], description: t("keyboard_actions.move-note-down"), scope: "note-tree" @@ -143,6 +160,7 @@ function getDefaultKeyboardActions() { { actionName: "moveNoteUpInHierarchy", friendlyName: t("keyboard_action_names.move-note-up-in-hierarchy"), + iconClass: "bx bx-arrow-from-bottom", defaultShortcuts: isMac ? ["Alt+Left"] : ["CommandOrControl+Left"], description: t("keyboard_actions.move-note-up-in-hierarchy"), scope: "note-tree" @@ -150,6 +168,7 @@ function getDefaultKeyboardActions() { { actionName: "moveNoteDownInHierarchy", friendlyName: t("keyboard_action_names.move-note-down-in-hierarchy"), + iconClass: "bx bx-arrow-from-top", defaultShortcuts: isMac ? ["Alt+Right"] : ["CommandOrControl+Right"], description: t("keyboard_actions.move-note-down-in-hierarchy"), scope: "note-tree" @@ -157,6 +176,7 @@ function getDefaultKeyboardActions() { { actionName: "editNoteTitle", friendlyName: t("keyboard_action_names.edit-note-title"), + iconClass: "bx bx-rename", defaultShortcuts: ["Enter"], description: t("keyboard_actions.edit-note-title"), scope: "note-tree" @@ -164,6 +184,7 @@ function getDefaultKeyboardActions() { { actionName: "editBranchPrefix", friendlyName: t("keyboard_action_names.edit-branch-prefix"), + iconClass: "bx bx-rename", defaultShortcuts: ["F2"], description: t("keyboard_actions.edit-branch-prefix"), scope: "note-tree" @@ -171,6 +192,7 @@ function getDefaultKeyboardActions() { { actionName: "cloneNotesTo", friendlyName: t("keyboard_action_names.clone-notes-to"), + iconClass: "bx bx-duplicate", defaultShortcuts: ["CommandOrControl+Shift+C"], description: t("keyboard_actions.clone-notes-to"), scope: "window" @@ -178,6 +200,7 @@ function getDefaultKeyboardActions() { { actionName: "moveNotesTo", friendlyName: t("keyboard_action_names.move-notes-to"), + iconClass: "bx bx-transfer", defaultShortcuts: ["CommandOrControl+Shift+X"], description: t("keyboard_actions.move-notes-to"), scope: "window" @@ -190,6 +213,7 @@ function getDefaultKeyboardActions() { { actionName: "copyNotesToClipboard", friendlyName: t("keyboard_action_names.copy-notes-to-clipboard"), + iconClass: "bx bx-copy", defaultShortcuts: ["CommandOrControl+C"], description: t("keyboard_actions.copy-notes-to-clipboard"), scope: "note-tree" @@ -197,6 +221,7 @@ function getDefaultKeyboardActions() { { actionName: "pasteNotesFromClipboard", friendlyName: t("keyboard_action_names.paste-notes-from-clipboard"), + iconClass: "bx bx-paste", defaultShortcuts: ["CommandOrControl+V"], description: t("keyboard_actions.paste-notes-from-clipboard"), scope: "note-tree" @@ -204,6 +229,7 @@ function getDefaultKeyboardActions() { { actionName: "cutNotesToClipboard", friendlyName: t("keyboard_action_names.cut-notes-to-clipboard"), + iconClass: "bx bx-cut", defaultShortcuts: ["CommandOrControl+X"], description: t("keyboard_actions.cut-notes-to-clipboard"), scope: "note-tree" @@ -211,6 +237,7 @@ function getDefaultKeyboardActions() { { actionName: "selectAllNotesInParent", friendlyName: t("keyboard_action_names.select-all-notes-in-parent"), + iconClass: "bx bx-select-multiple", defaultShortcuts: ["CommandOrControl+A"], description: t("keyboard_actions.select-all-notes-in-parent"), scope: "note-tree" @@ -218,6 +245,7 @@ function getDefaultKeyboardActions() { { actionName: "addNoteAboveToSelection", friendlyName: t("keyboard_action_names.add-note-above-to-selection"), + iconClass: "bx bx-chevron-up-square", defaultShortcuts: ["Shift+Up"], description: t("keyboard_actions.add-note-above-to-the-selection"), scope: "note-tree" @@ -225,6 +253,7 @@ function getDefaultKeyboardActions() { { actionName: "addNoteBelowToSelection", friendlyName: t("keyboard_action_names.add-note-below-to-selection"), + iconClass: "bx bx-chevron-down-square", defaultShortcuts: ["Shift+Down"], description: t("keyboard_actions.add-note-below-to-selection"), scope: "note-tree" @@ -232,6 +261,7 @@ function getDefaultKeyboardActions() { { actionName: "duplicateSubtree", friendlyName: t("keyboard_action_names.duplicate-subtree"), + iconClass: "bx bx-outline", defaultShortcuts: [], description: t("keyboard_actions.duplicate-subtree"), scope: "note-tree" @@ -243,6 +273,7 @@ function getDefaultKeyboardActions() { { actionName: "openNewTab", friendlyName: t("keyboard_action_names.open-new-tab"), + iconClass: "bx bx-plus", defaultShortcuts: isElectron ? ["CommandOrControl+T"] : [], description: t("keyboard_actions.open-new-tab"), scope: "window" @@ -250,6 +281,7 @@ function getDefaultKeyboardActions() { { actionName: "closeActiveTab", friendlyName: t("keyboard_action_names.close-active-tab"), + iconClass: "bx bx-minus", defaultShortcuts: isElectron ? ["CommandOrControl+W"] : [], description: t("keyboard_actions.close-active-tab"), scope: "window" @@ -257,6 +289,7 @@ function getDefaultKeyboardActions() { { actionName: "reopenLastTab", friendlyName: t("keyboard_action_names.reopen-last-tab"), + iconClass: "bx bx-undo", defaultShortcuts: isElectron ? ["CommandOrControl+Shift+T"] : [], description: t("keyboard_actions.reopen-last-tab"), scope: "window" @@ -264,6 +297,7 @@ function getDefaultKeyboardActions() { { actionName: "activateNextTab", friendlyName: t("keyboard_action_names.activate-next-tab"), + iconClass: "bx bx-skip-next", defaultShortcuts: isElectron ? ["CommandOrControl+Tab", "CommandOrControl+PageDown"] : [], description: t("keyboard_actions.activate-next-tab"), scope: "window" @@ -271,6 +305,7 @@ function getDefaultKeyboardActions() { { actionName: "activatePreviousTab", friendlyName: t("keyboard_action_names.activate-previous-tab"), + iconClass: "bx bx-skip-previous", defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab", "CommandOrControl+PageUp"] : [], description: t("keyboard_actions.activate-previous-tab"), scope: "window" @@ -278,6 +313,7 @@ function getDefaultKeyboardActions() { { actionName: "openNewWindow", friendlyName: t("keyboard_action_names.open-new-window"), + iconClass: "bx bx-window-open", defaultShortcuts: [], description: t("keyboard_actions.open-new-window"), scope: "window" @@ -285,6 +321,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleTray", friendlyName: t("keyboard_action_names.toggle-system-tray-icon"), + iconClass: "bx bx-show", defaultShortcuts: [], description: t("keyboard_actions.toggle-tray"), scope: "window" @@ -292,6 +329,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleZenMode", friendlyName: t("keyboard_action_names.toggle-zen-mode"), + iconClass: "bx bxs-yin-yang", defaultShortcuts: ["F9"], description: t("keyboard_actions.toggle-zen-mode"), scope: "window" @@ -299,6 +337,7 @@ function getDefaultKeyboardActions() { { actionName: "firstTab", friendlyName: t("keyboard_action_names.switch-to-first-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+1"], description: t("keyboard_actions.first-tab"), scope: "window" @@ -306,6 +345,7 @@ function getDefaultKeyboardActions() { { actionName: "secondTab", friendlyName: t("keyboard_action_names.switch-to-second-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+2"], description: t("keyboard_actions.second-tab"), scope: "window" @@ -313,6 +353,7 @@ function getDefaultKeyboardActions() { { actionName: "thirdTab", friendlyName: t("keyboard_action_names.switch-to-third-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+3"], description: t("keyboard_actions.third-tab"), scope: "window" @@ -320,6 +361,7 @@ function getDefaultKeyboardActions() { { actionName: "fourthTab", friendlyName: t("keyboard_action_names.switch-to-fourth-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+4"], description: t("keyboard_actions.fourth-tab"), scope: "window" @@ -327,6 +369,7 @@ function getDefaultKeyboardActions() { { actionName: "fifthTab", friendlyName: t("keyboard_action_names.switch-to-fifth-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+5"], description: t("keyboard_actions.fifth-tab"), scope: "window" @@ -334,6 +377,7 @@ function getDefaultKeyboardActions() { { actionName: "sixthTab", friendlyName: t("keyboard_action_names.switch-to-sixth-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+6"], description: t("keyboard_actions.sixth-tab"), scope: "window" @@ -341,6 +385,7 @@ function getDefaultKeyboardActions() { { actionName: "seventhTab", friendlyName: t("keyboard_action_names.switch-to-seventh-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+7"], description: t("keyboard_actions.seventh-tab"), scope: "window" @@ -348,6 +393,7 @@ function getDefaultKeyboardActions() { { actionName: "eigthTab", friendlyName: t("keyboard_action_names.switch-to-eighth-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+8"], description: t("keyboard_actions.eight-tab"), scope: "window" @@ -355,6 +401,7 @@ function getDefaultKeyboardActions() { { actionName: "ninthTab", friendlyName: t("keyboard_action_names.switch-to-ninth-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+9"], description: t("keyboard_actions.ninth-tab"), scope: "window" @@ -362,6 +409,7 @@ function getDefaultKeyboardActions() { { actionName: "lastTab", friendlyName: t("keyboard_action_names.switch-to-last-tab"), + iconClass: "bx bx-rectangle", defaultShortcuts: ["CommandOrControl+0"], description: t("keyboard_actions.last-tab"), scope: "window" @@ -373,6 +421,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-note-source"), actionName: "showNoteSource", + iconClass: "bx bx-code", defaultShortcuts: [], description: t("keyboard_actions.show-note-source"), scope: "window" @@ -380,6 +429,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-options"), actionName: "showOptions", + iconClass: "bx bx-cog", defaultShortcuts: [], description: t("keyboard_actions.show-options"), scope: "window" @@ -387,6 +437,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-revisions"), actionName: "showRevisions", + iconClass: "bx bx-history", defaultShortcuts: [], description: t("keyboard_actions.show-revisions"), scope: "window" @@ -394,6 +445,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-recent-changes"), actionName: "showRecentChanges", + iconClass: "bx bx-history", defaultShortcuts: [], description: t("keyboard_actions.show-recent-changes"), scope: "window" @@ -401,6 +453,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-sql-console"), actionName: "showSQLConsole", + iconClass: "bx bx-data", defaultShortcuts: ["Alt+O"], description: t("keyboard_actions.show-sql-console"), scope: "window" @@ -408,6 +461,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-backend-log"), actionName: "showBackendLog", + iconClass: "bx bx-detail", defaultShortcuts: [], description: t("keyboard_actions.show-backend-log"), scope: "window" @@ -415,6 +469,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-help"), actionName: "showHelp", + iconClass: "bx bx-help-circle", defaultShortcuts: ["F1"], description: t("keyboard_actions.show-help"), scope: "window" @@ -422,6 +477,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.show-cheatsheet"), actionName: "showCheatsheet", + iconClass: "bx bxs-keyboard", defaultShortcuts: ["Shift+F1"], description: t("keyboard_actions.show-cheatsheet"), scope: "window" @@ -434,6 +490,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.add-link-to-text"), actionName: "addLinkToText", + iconClass: "bx bx-link", defaultShortcuts: ["CommandOrControl+L"], description: t("keyboard_actions.add-link-to-text"), scope: "text-detail" @@ -441,6 +498,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.follow-link-under-cursor"), actionName: "followLinkUnderCursor", + iconClass: "bx bx-link-external", defaultShortcuts: ["CommandOrControl+Enter"], description: t("keyboard_actions.follow-link-under-cursor"), scope: "text-detail" @@ -448,6 +506,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.insert-date-and-time-to-text"), actionName: "insertDateTimeToText", + iconClass: "bx bx-calendar-event", defaultShortcuts: ["Alt+T"], description: t("keyboard_actions.insert-date-and-time-to-text"), scope: "text-detail" @@ -455,6 +514,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.paste-markdown-into-text"), actionName: "pasteMarkdownIntoText", + iconClass: "bx bxl-markdown", defaultShortcuts: [], description: t("keyboard_actions.paste-markdown-into-text"), scope: "text-detail" @@ -462,6 +522,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.cut-into-note"), actionName: "cutIntoNote", + iconClass: "bx bx-cut", defaultShortcuts: [], description: t("keyboard_actions.cut-into-note"), scope: "text-detail" @@ -469,6 +530,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.add-include-note-to-text"), actionName: "addIncludeNoteToText", + iconClass: "bx bx-note", defaultShortcuts: [], description: t("keyboard_actions.add-include-note-to-text"), scope: "text-detail" @@ -476,6 +538,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.edit-read-only-note"), actionName: "editReadOnlyNote", + iconClass: "bx bx-edit-alt", defaultShortcuts: [], description: t("keyboard_actions.edit-readonly-note"), scope: "window" @@ -488,6 +551,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.add-new-label"), actionName: "addNewLabel", + iconClass: "bx bx-hash", defaultShortcuts: ["Alt+L"], description: t("keyboard_actions.add-new-label"), scope: "window" @@ -495,6 +559,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.add-new-relation"), actionName: "addNewRelation", + iconClass: "bx bx-transfer", defaultShortcuts: ["Alt+R"], description: t("keyboard_actions.create-new-relation"), scope: "window" @@ -507,6 +572,7 @@ function getDefaultKeyboardActions() { { friendlyName: t("keyboard_action_names.toggle-ribbon-tab-classic-editor"), actionName: "toggleRibbonTabClassicEditor", + iconClass: "bx bx-text", defaultShortcuts: [], description: t("keyboard_actions.toggle-classic-editor-toolbar"), scope: "window" @@ -514,6 +580,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabBasicProperties", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-basic-properties"), + iconClass: "bx bx-slider", defaultShortcuts: [], description: t("keyboard_actions.toggle-basic-properties"), scope: "window" @@ -521,6 +588,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabBookProperties", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-book-properties"), + iconClass: "bx bx-book", defaultShortcuts: [], description: t("keyboard_actions.toggle-book-properties"), scope: "window" @@ -528,6 +596,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabFileProperties", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-file-properties"), + iconClass: "bx bx-file", defaultShortcuts: [], description: t("keyboard_actions.toggle-file-properties"), scope: "window" @@ -535,6 +604,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabImageProperties", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-image-properties"), + iconClass: "bx bx-image", defaultShortcuts: [], description: t("keyboard_actions.toggle-image-properties"), scope: "window" @@ -542,6 +612,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabOwnedAttributes", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-owned-attributes"), + iconClass: "bx bx-list-check", defaultShortcuts: ["Alt+A"], description: t("keyboard_actions.toggle-owned-attributes"), scope: "window" @@ -549,6 +620,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabInheritedAttributes", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-inherited-attributes"), + iconClass: "bx bx-list-plus", defaultShortcuts: [], description: t("keyboard_actions.toggle-inherited-attributes"), scope: "window" @@ -557,6 +629,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabPromotedAttributes", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-promoted-attributes"), + iconClass: "bx bx-star", defaultShortcuts: [], description: t("keyboard_actions.toggle-promoted-attributes"), scope: "window" @@ -564,6 +637,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabNoteMap", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-map"), + iconClass: "bx bxs-network-chart", defaultShortcuts: [], description: t("keyboard_actions.toggle-link-map"), scope: "window" @@ -571,6 +645,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabNoteInfo", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-info"), + iconClass: "bx bx-info-circle", defaultShortcuts: [], description: t("keyboard_actions.toggle-note-info"), scope: "window" @@ -578,6 +653,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabNotePaths", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-paths"), + iconClass: "bx bx-collection", defaultShortcuts: [], description: t("keyboard_actions.toggle-note-paths"), scope: "window" @@ -585,6 +661,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRibbonTabSimilarNotes", friendlyName: t("keyboard_action_names.toggle-ribbon-tab-similar-notes"), + iconClass: "bx bx-bar-chart", defaultShortcuts: [], description: t("keyboard_actions.toggle-similar-notes"), scope: "window" @@ -597,6 +674,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleRightPane", friendlyName: t("keyboard_action_names.toggle-right-pane"), + iconClass: "bx bx-dock-right", defaultShortcuts: [], description: t("keyboard_actions.toggle-right-pane"), scope: "window" @@ -604,6 +682,7 @@ function getDefaultKeyboardActions() { { actionName: "printActiveNote", friendlyName: t("keyboard_action_names.print-active-note"), + iconClass: "bx bx-printer", defaultShortcuts: [], description: t("keyboard_actions.print-active-note"), scope: "window" @@ -611,6 +690,7 @@ function getDefaultKeyboardActions() { { actionName: "exportAsPdf", friendlyName: t("keyboard_action_names.export-active-note-as-pdf"), + iconClass: "bx bxs-file-pdf", defaultShortcuts: [], description: t("keyboard_actions.export-as-pdf"), scope: "window" @@ -618,6 +698,7 @@ function getDefaultKeyboardActions() { { actionName: "openNoteExternally", friendlyName: t("keyboard_action_names.open-note-externally"), + iconClass: "bx bx-file-find", defaultShortcuts: [], description: t("keyboard_actions.open-note-externally"), scope: "window" @@ -625,6 +706,7 @@ function getDefaultKeyboardActions() { { actionName: "renderActiveNote", friendlyName: t("keyboard_action_names.render-active-note"), + iconClass: "bx bx-refresh", defaultShortcuts: [], description: t("keyboard_actions.render-active-note"), scope: "window" @@ -632,6 +714,7 @@ function getDefaultKeyboardActions() { { actionName: "runActiveNote", friendlyName: t("keyboard_action_names.run-active-note"), + iconClass: "bx bx-play", defaultShortcuts: ["CommandOrControl+Enter"], description: t("keyboard_actions.run-active-note"), scope: "code-detail" @@ -639,6 +722,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleNoteHoisting", friendlyName: t("keyboard_action_names.toggle-note-hoisting"), + iconClass: "bx bx-chevrons-up", defaultShortcuts: ["Alt+H"], description: t("keyboard_actions.toggle-note-hoisting"), scope: "window" @@ -646,6 +730,7 @@ function getDefaultKeyboardActions() { { actionName: "unhoist", friendlyName: t("keyboard_action_names.unhoist-note"), + iconClass: "bx bx-door-open", defaultShortcuts: ["Alt+U"], description: t("keyboard_actions.unhoist"), scope: "window" @@ -653,6 +738,7 @@ function getDefaultKeyboardActions() { { actionName: "reloadFrontendApp", friendlyName: t("keyboard_action_names.reload-frontend-app"), + iconClass: "bx bx-refresh", defaultShortcuts: ["F5", "CommandOrControl+R"], description: t("keyboard_actions.reload-frontend-app"), scope: "window" @@ -660,6 +746,7 @@ function getDefaultKeyboardActions() { { actionName: "openDevTools", friendlyName: t("keyboard_action_names.open-developer-tools"), + iconClass: "bx bx-bug-alt", defaultShortcuts: isElectron ? ["CommandOrControl+Shift+I"] : [], description: t("keyboard_actions.open-dev-tools"), scope: "window" @@ -667,6 +754,7 @@ function getDefaultKeyboardActions() { { actionName: "findInText", friendlyName: t("keyboard_action_names.find-in-text"), + iconClass: "bx bx-search", defaultShortcuts: isElectron ? ["CommandOrControl+F"] : [], description: t("keyboard_actions.find-in-text"), scope: "window" @@ -674,6 +762,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleLeftPane", friendlyName: t("keyboard_action_names.toggle-left-pane"), + iconClass: "bx bx-dock-left", defaultShortcuts: [], description: t("keyboard_actions.toggle-left-note-tree-panel"), scope: "window" @@ -681,6 +770,7 @@ function getDefaultKeyboardActions() { { actionName: "toggleFullscreen", friendlyName: t("keyboard_action_names.toggle-full-screen"), + iconClass: "bx bx-fullscreen", defaultShortcuts: ["F11"], description: t("keyboard_actions.toggle-full-screen"), scope: "window" @@ -688,6 +778,7 @@ function getDefaultKeyboardActions() { { actionName: "zoomOut", friendlyName: t("keyboard_action_names.zoom-out"), + iconClass: "bx bx-zoom-out", defaultShortcuts: isElectron ? ["CommandOrControl+-"] : [], description: t("keyboard_actions.zoom-out"), scope: "window" @@ -695,6 +786,7 @@ function getDefaultKeyboardActions() { { actionName: "zoomIn", friendlyName: t("keyboard_action_names.zoom-in"), + iconClass: "bx bx-zoom-in", description: t("keyboard_actions.zoom-in"), defaultShortcuts: isElectron ? ["CommandOrControl+="] : [], scope: "window" @@ -702,6 +794,7 @@ function getDefaultKeyboardActions() { { actionName: "zoomReset", friendlyName: t("keyboard_action_names.reset-zoom-level"), + iconClass: "bx bx-search-alt", description: t("keyboard_actions.reset-zoom-level"), defaultShortcuts: isElectron ? ["CommandOrControl+0"] : [], scope: "window" @@ -709,6 +802,7 @@ function getDefaultKeyboardActions() { { actionName: "copyWithoutFormatting", friendlyName: t("keyboard_action_names.copy-without-formatting"), + iconClass: "bx bx-copy-alt", defaultShortcuts: ["CommandOrControl+Alt+C"], description: t("keyboard_actions.copy-without-formatting"), scope: "text-detail" @@ -716,6 +810,7 @@ function getDefaultKeyboardActions() { { actionName: "forceSaveRevision", friendlyName: t("keyboard_action_names.force-save-revision"), + iconClass: "bx bx-save", defaultShortcuts: [], description: t("keyboard_actions.force-save-revision"), scope: "window" diff --git a/packages/commons/src/lib/keyboard_actions_interface.ts b/packages/commons/src/lib/keyboard_actions_interface.ts index 599abab3d..9d57d4067 100644 --- a/packages/commons/src/lib/keyboard_actions_interface.ts +++ b/packages/commons/src/lib/keyboard_actions_interface.ts @@ -108,6 +108,11 @@ export interface ActionKeyboardShortcut { description?: string; defaultShortcuts?: string[]; effectiveShortcuts?: string[]; + /** + * An icon describing the action. + * This is currently only used in the command palette. + */ + iconClass: string; /** * Scope here means on which element the keyboard shortcuts are attached - this means that for the shortcut to work, * the focus has to be inside the element.