moving edit branch prefix, search in subtree and toggle note hoisting to global entrypoints instead of being tree specific

This commit is contained in:
zadam
2019-11-23 23:06:25 +01:00
parent 0cde7ede24
commit 01ff34b5d4
3 changed files with 45 additions and 30 deletions

View File

@@ -7,6 +7,8 @@ import treeService from "./tree.js";
import dateNoteService from "./date_notes.js";
import noteDetailService from "./note_detail.js";
import keyboardActionService from "./keyboard_actions.js";
import hoistedNoteService from "./hoisted_note.js";
import treeCache from "./tree_cache.js";
const NOTE_REVISIONS = "../dialogs/note_revisions.js";
const OPTIONS = "../dialogs/options.js";
@@ -113,7 +115,7 @@ function registerEntrypoints() {
$("#toggle-zen-mode-button").on('click', toggleZenMode);
keyboardActionService.setActionHandler("ToggleZenMode", toggleZenMode);
keyboardActionService.setActionHandler("InsertDateTime", () => {
keyboardActionService.setActionHandler("InsertDateTimeToText", () => {
const date = new Date();
const dateString = utils.formatDateTime(date);
@@ -230,6 +232,36 @@ function registerEntrypoints() {
isProtected: node.data.isProtected
});
});
keyboardActionService.setActionHandler("EditBranchPrefix", async () => {
const node = treeService.getActiveNode();
const editBranchPrefixDialog = await import("../dialogs/branch_prefix.js");
editBranchPrefixDialog.showDialog(node);
});
keyboardActionService.setActionHandler("ToggleNoteHoisting", async () => {
const node = treeService.getActiveNode();
hoistedNoteService.getHoistedNoteId().then(async hoistedNoteId => {
if (node.data.noteId === hoistedNoteId) {
hoistedNoteService.unhoist();
}
else {
const note = await treeCache.getNote(node.data.noteId);
if (note.type !== 'search') {
hoistedNoteService.setHoistedNoteId(node.data.noteId);
}
}
});
});
keyboardActionService.setActionHandler("SearchInSubtree", () => {
const node = treeService.getActiveNode();
searchNotesService.searchInSubtree(node.data.noteId);
});
}
export default {