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
provide also explicit unhoist keyboard shortcut, #1305
zadam893b6053d22c
diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.jsindex 5d09d5dbc2..e62559f3f5 100644--- a/src/public/app/services/entrypoints.js+++ b/src/public/app/services/entrypoints.js@@ -91,6 +91,10 @@ export default class Entrypoints extends Component {}}+ async unhoistCommand() {+ hoistedNoteService.unhoist();+ }+copyWithoutFormattingCommand() {utils.copySelectionToClipboard();}diff --git a/src/public/app/services/hoisted_note.js b/src/public/app/services/hoisted_note.jsindex 334df930d4..c6ad0d6265 100644--- a/src/public/app/services/hoisted_note.js+++ b/src/public/app/services/hoisted_note.js@@ -8,6 +8,10 @@ function getHoistedNoteId() {}async function setHoistedNoteId(noteId) {+ if (getHoistedNoteId() === noteId) {+ return;+ }+await options.save('hoistedNoteId', noteId);await treeCache.loadInitialTree();diff --git a/src/public/app/services/keyboard_actions.js b/src/public/app/services/keyboard_actions.jsindex ab7fffbfce..53ea4dcaf9 100644--- a/src/public/app/services/keyboard_actions.js+++ b/src/public/app/services/keyboard_actions.js@@ -111,5 +111,6 @@ export default {setElementActionHandler,updateDisplayedShortcuts,setupActionsForElement,- getActionsForScope+ getActionsForScope,+ getAction};diff --git a/src/public/app/services/tree_context_menu.js b/src/public/app/services/tree_context_menu.jsindex b37ef28ba1..0cc68e0ff1 100644--- a/src/public/app/services/tree_context_menu.js+++ b/src/public/app/services/tree_context_menu.js@@ -69,7 +69,7 @@ class TreeContextMenu {{ title: 'Search in subtree <kbd data-command="searchInSubtree"></kbd>', command: "searchInSubtree", uiIcon: "search",enabled: notSearch && noSelectedNotes },isHoisted ? null : { title: 'Hoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "empty", enabled: noSelectedNotes && notSearch },- !isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="ToggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "arrow-up" },+ !isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="ToggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "arrow-from-bottom" },{ title: 'Edit branch prefix <kbd data-command="editBranchPrefix"></kbd>', command: "editBranchPrefix", uiIcon: "empty",enabled: isNotRoot && parentNotSearch && noSelectedNotes},{ title: "Advanced", uiIcon: "empty", enabled: true, items: [diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.jsindex 39e4b52be5..666e74bb19 100644--- a/src/public/app/widgets/note_tree.js+++ b/src/public/app/widgets/note_tree.js@@ -460,7 +460,11 @@ export default class NoteTreeWidget extends TabAwareWidget {&& node.data.noteId === hoistedNoteService.getHoistedNoteId()&& $span.find('.unhoist-button').length === 0) {- const unhoistButton = $('<span class="unhoist-button-wrapper" title="Unhoist current note to show the whole note tree">[<a class="unhoist-button">unhoist</a>]</span>');+ const action = await keyboardActionsService.getAction('unhoist');+ let shortcuts = action.effectiveShortcuts.join(',');+ shortcuts = shortcuts ? `(${shortcuts})` : '';++ const unhoistButton = $(`<span class="unhoist-button-wrapper" title="Unhoist current note to show the whole note tree ${shortcuts}">[<a class="unhoist-button">unhoist</a>]</span>`);// prepending since appending could push out (when note title is too long)// the button too much to the right so that it's not visiblediff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.jsindex 8285ce255d..1db1ce37da 100644--- a/src/services/keyboard_actions.js+++ b/src/services/keyboard_actions.js@@ -352,6 +352,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [description: "Toggles note hoisting of active note",scope: "window"},+ {+ actionName: "unhoist",+ defaultShortcuts: ["Alt+U"],+ description: "Unhoist from anywhere",+ scope: "window"+ },{actionName: "reloadFrontendApp",defaultShortcuts: ["F5", "CommandOrControl+R"],