mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 03:58:53 +08:00
provide also explicit unhoist keyboard shortcut, #1305
This commit is contained in:
parent
a1ec6fe0aa
commit
893b6053d2
6 changed files with 22 additions and 3 deletions
|
@ -91,6 +91,10 @@ export default class Entrypoints extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
async unhoistCommand() {
|
||||
hoistedNoteService.unhoist();
|
||||
}
|
||||
|
||||
copyWithoutFormattingCommand() {
|
||||
utils.copySelectionToClipboard();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ function getHoistedNoteId() {
|
|||
}
|
||||
|
||||
async function setHoistedNoteId(noteId) {
|
||||
if (getHoistedNoteId() === noteId) {
|
||||
return;
|
||||
}
|
||||
|
||||
await options.save('hoistedNoteId', noteId);
|
||||
|
||||
await treeCache.loadInitialTree();
|
||||
|
|
|
@ -111,5 +111,6 @@ export default {
|
|||
setElementActionHandler,
|
||||
updateDisplayedShortcuts,
|
||||
setupActionsForElement,
|
||||
getActionsForScope
|
||||
getActionsForScope,
|
||||
getAction
|
||||
};
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -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 visible
|
||||
|
|
|
@ -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"],
|
||||
|
|
Loading…
Reference in a new issue