Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server: Improve type for keyboard shortcut scope
Elian Doran2c5a5acffa32
diff --git a/src/services/keyboard_actions.ts b/src/services/keyboard_actions.tsindex faaf517c88..1a19790e16 100644--- a/src/services/keyboard_actions.ts+++ b/src/services/keyboard_actions.ts@@ -9,15 +9,6 @@ import { t } from "i18next";const isMac = process.platform === "darwin";const isElectron = utils.isElectron();-/**- * 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.- *- * So e.g. shortcuts with "note-tree" scope work only when the focus is in note tree.- * This allows to have the same shortcut have different actions attached based on the context- * e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.- */-function getDefaultKeyboardActions() {if (!t("keyboard_actions.note-navigation")) {throw new Error("Keyboard actions loaded before translations.");diff --git a/src/services/keyboard_actions_interface.ts b/src/services/keyboard_actions_interface.tsindex 3e3621ecd6..31493a8e91 100644--- a/src/services/keyboard_actions_interface.ts+++ b/src/services/keyboard_actions_interface.ts@@ -4,7 +4,15 @@ export interface KeyboardShortcut {description?: string;defaultShortcuts?: string[];effectiveShortcuts?: string[];- scope?: 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.+ *+ * So e.g. shortcuts with "note-tree" scope work only when the focus is in note tree.+ * This allows to have the same shortcut have different actions attached based on the context+ * e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.+ */+ scope?: "window" | "note-tree" | "text-detail" | "code-detail";}export interface KeyboardShortcutWithRequiredActionName extends KeyboardShortcut {