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
fix tree keyboard shortcuts propagating outside of tree
zadam96e2b9bc1832
diff --git a/src/public/javascripts/services/keyboard_actions.js b/src/public/javascripts/services/keyboard_actions.jsindex 16f802523b..e021b8b109 100644--- a/src/public/javascripts/services/keyboard_actions.js+++ b/src/public/javascripts/services/keyboard_actions.js@@ -12,8 +12,10 @@ const keyboardActionsLoaded = server.get('keyboard-actions').then(actions => {if (shortcut && !shortcut.startsWith("global:")) { // global shortcuts should be handled in the electron codeconst eventName = action.actionName.charAt(0).toLowerCase() + action.actionName.slice(1);- // empty object param so that destructuring with optional params work- utils.bindGlobalShortcut(shortcut, () => appContext.trigger(eventName, {}));+ if (action.scope !== 'note-tree') {+ // empty object param so that destructuring with optional params work+ utils.bindGlobalShortcut(shortcut, () => appContext.trigger(eventName, {}));+ }}}}diff --git a/src/public/javascripts/services/spaced_update.js b/src/public/javascripts/services/spaced_update.jsindex 54029ce4f1..ed67f8a2b9 100644--- a/src/public/javascripts/services/spaced_update.js+++ b/src/public/javascripts/services/spaced_update.js@@ -7,7 +7,7 @@ export default class SpacedUpdate {}scheduleUpdate() {- if (!this.changeForbidden) {console.trace();+ if (!this.changeForbidden) {this.changed = true;setTimeout(() => this.triggerUpdate());}diff --git a/src/public/javascripts/widgets/search_results.js b/src/public/javascripts/widgets/search_results.jsindex fac675fedc..c19ec0cbe8 100644--- a/src/public/javascripts/widgets/search_results.js+++ b/src/public/javascripts/widgets/search_results.js@@ -3,7 +3,7 @@ import toastService from "../services/toast.js";import server from "../services/server.js";const TPL = `-<div>+<div class="search-results"><style>.search-results {padding: 0 5px 5px 15px;@@ -16,14 +16,14 @@ const TPL = `border-bottom: 2px solid var(--main-border-color);}- .search-results ul {+ .search-results-list {padding: 5px 5px 5px 15px;}</style><strong>Search results:</strong>- <ul class="search-results-inner"></ul>+ <ul class="search-results-list"></ul></div>`;@@ -32,7 +32,7 @@ export default class SearchResultsWidget extends BasicWidget {this.$widget = $(TPL);this.$searchResults = this.$widget;- this.$searchResultsInner = this.$widget.find(".search-results-inner");+ this.$searchResultsInner = this.$widget.find(".search-results-list");this.toggle(false);diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.jsindex c8b1b7dd59..a07b16e0f9 100644--- a/src/services/keyboard_actions.js+++ b/src/services/keyboard_actions.js@@ -37,26 +37,30 @@ const DEFAULT_KEYBOARD_ACTIONS = [{actionName: "SearchInSubtree",defaultShortcuts: ["CommandOrControl+Shift+S"],- description: "Search for notes in the active note's subtree"+ description: "Search for notes in the active note's subtree",+ scope: "note-tree"},{actionName: "CollapseTree",- defaultShortcuts: ["Alt+C"]+ defaultShortcuts: ["Alt+C"],},{actionName: "CollapseSubtree",defaultShortcuts: ["Alt+-"],- description: "Collapses subtree of current note"+ description: "Collapses subtree of current note",+ scope: "note-tree"},{actionName: "ActivateParentNote",defaultShortcuts: ["Backspace"],- description: "Activates the parent note of currently active note"+ description: "Activates the parent note of currently active note",+ scope: "note-tree"},{actionName: "SortChildNotes",defaultShortcuts: ["Alt+S"],- description: "Sort child notes"+ description: "Sort child notes",+ scope: "note-tree"},@@ -79,32 +83,38 @@ const DEFAULT_KEYBOARD_ACTIONS = [{actionName: "DeleteNotes",defaultShortcuts: ["Delete"],- description: "Delete note"+ description: "Delete note",+ scope: "note-tree"},{actionName: "MoveNoteUp",defaultShortcuts: ["CommandOrControl+Up"],- description: "Move note up"+ description: "Move note up",+ scope: "note-tree"},{actionName: "MoveNoteDown",defaultShortcuts: ["CommandOrControl+Down"],- description: "Move note down"+ description: "Move note down",+ scope: "note-tree"},{actionName: "MoveNoteUpInHierarchy",defaultShortcuts: ["CommandOrControl+Left"],- description: "Move note up in hierarchy"+ description: "Move note up in hierarchy",+ scope: "note-tree"},{actionName: "MoveNoteDownInHierarchy",defaultShortcuts: ["CommandOrControl+Right"],- description: "Move note down in hierarchy"+ description: "Move note down in hierarchy",+ scope: "note-tree"},{actionName: "EditNoteTitle",defaultShortcuts: ["Enter"],- description: "Jump from tree to the note detail and edit title"+ description: "Jump from tree to the note detail and edit title",+ scope: "note-tree"},{actionName: "EditBranchPrefix",@@ -128,32 +138,38 @@ const DEFAULT_KEYBOARD_ACTIONS = [{actionName: "CopyNotesToClipboard",defaultShortcuts: ["CommandOrControl+C"],- description: "Copy selected notes to the clipboard"+ description: "Copy selected notes to the clipboard",+ scope: "note-tree"},{actionName: "PasteNotesFromClipboard",defaultShortcuts: ["CommandOrControl+V"],- description: "Paste notes from the clipboard into active note"+ description: "Paste notes from the clipboard into active note",+ scope: "note-tree"},{actionName: "CutNotesToClipboard",defaultShortcuts: ["CommandOrControl+X"],- description: "Cut selected notes to the clipboard"+ description: "Cut selected notes to the clipboard",+ scope: "note-tree"},{actionName: "SelectAllNotesInParent",defaultShortcuts: ["CommandOrControl+A"],- description: "Select all notes from the current note level"+ description: "Select all notes from the current note level",+ scope: "note-tree"},{actionName: "AddNoteAboveToSelection",defaultShortcuts: ["Shift+Up"],- description: "Add note above to the selection"+ description: "Add note above to the selection",+ scope: "note-tree"},{actionName: "AddNoteBelowToSelection",defaultShortcuts: ["Shift+Down"],- description: "Add note above to the selection"+ description: "Add note above to the selection",+ scope: "note-tree"},