keyboard shortcut for hoisting, hoisted note is always expanded and has arrow icon

This commit is contained in:
azivner
2018-12-12 20:54:58 +01:00
parent 17d030e800
commit 86fcbb0354
4 changed files with 25 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import treeChangesService from "./branches.js";
import contextMenuService from "./tree_context_menu.js";
import treeService from "./tree.js";
import editBranchPrefixDialog from "../dialogs/branch_prefix.js";
import hoistedNoteService from "./hoisted_note.js";
const keyBindings = {
"del": node => {
@@ -113,6 +114,18 @@ const keyBindings = {
node.getParent().setActive().then(treeService.clearSelectedNodes);
}
},
"ctrl+h": node => {
hoistedNoteService.getHoistedNoteId().then(hoistedNoteId => {
if (node.data.noteId === hoistedNoteId) {
hoistedNoteService.setHoistedNoteId('root');
}
else {
hoistedNoteService.setHoistedNoteId(node.data.noteId);
}
});
return false;
},
// code below shouldn't be necessary normally, however there's some problem with interaction with context menu plugin
// after opening context menu, standard shortcuts don't work, but they are detected here
// so we essentially takeover the standard handling with our implementation.