mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
moving edit branch prefix, search in subtree and toggle note hoisting to global entrypoints instead of being tree specific
This commit is contained in:
parent
0cde7ede24
commit
01ff34b5d4
@ -17,11 +17,21 @@ export async function showDialog(node) {
|
|||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
|
||||||
|
|
||||||
branchId = node.data.branchId;
|
branchId = node.data.branchId;
|
||||||
const branch = treeCache.getBranch(branchId);
|
const branch = treeCache.getBranch(branchId);
|
||||||
|
|
||||||
|
if (branch.noteId === 'root') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parentNote = await treeCache.getNote(branch.parentNoteId);
|
||||||
|
|
||||||
|
if (parentNote.type === 'search') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dialog.modal();
|
||||||
|
|
||||||
$treePrefixInput.val(branch.prefix);
|
$treePrefixInput.val(branch.prefix);
|
||||||
|
|
||||||
const noteTitle = await treeUtils.getNoteTitle(node.data.noteId);
|
const noteTitle = await treeUtils.getNoteTitle(node.data.noteId);
|
||||||
|
@ -7,6 +7,8 @@ import treeService from "./tree.js";
|
|||||||
import dateNoteService from "./date_notes.js";
|
import dateNoteService from "./date_notes.js";
|
||||||
import noteDetailService from "./note_detail.js";
|
import noteDetailService from "./note_detail.js";
|
||||||
import keyboardActionService from "./keyboard_actions.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 NOTE_REVISIONS = "../dialogs/note_revisions.js";
|
||||||
const OPTIONS = "../dialogs/options.js";
|
const OPTIONS = "../dialogs/options.js";
|
||||||
@ -113,7 +115,7 @@ function registerEntrypoints() {
|
|||||||
$("#toggle-zen-mode-button").on('click', toggleZenMode);
|
$("#toggle-zen-mode-button").on('click', toggleZenMode);
|
||||||
keyboardActionService.setActionHandler("ToggleZenMode", toggleZenMode);
|
keyboardActionService.setActionHandler("ToggleZenMode", toggleZenMode);
|
||||||
|
|
||||||
keyboardActionService.setActionHandler("InsertDateTime", () => {
|
keyboardActionService.setActionHandler("InsertDateTimeToText", () => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const dateString = utils.formatDateTime(date);
|
const dateString = utils.formatDateTime(date);
|
||||||
|
|
||||||
@ -230,6 +232,36 @@ function registerEntrypoints() {
|
|||||||
isProtected: node.data.isProtected
|
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 {
|
export default {
|
||||||
|
@ -114,11 +114,6 @@ const templates = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
// TODO: this shouldn't be tree specific shortcut
|
|
||||||
"EditBranchPrefix": async node => {
|
|
||||||
const editBranchPrefixDialog = await import("../dialogs/branch_prefix.js");
|
|
||||||
editBranchPrefixDialog.showDialog(node);
|
|
||||||
},
|
|
||||||
"CollapseSubtree": node => {
|
"CollapseSubtree": node => {
|
||||||
treeService.collapseTree(node);
|
treeService.collapseTree(node);
|
||||||
},
|
},
|
||||||
@ -158,28 +153,6 @@ const templates = {
|
|||||||
if (!await hoistedNoteService.isRootNode(node)) {
|
if (!await hoistedNoteService.isRootNode(node)) {
|
||||||
node.getParent().setActive().then(treeService.clearSelectedNodes);
|
node.getParent().setActive().then(treeService.clearSelectedNodes);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// TODO: this should probably be app-global shortcut
|
|
||||||
"ToggleNoteHoisting": node => {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"SearchInSubtree": node => {
|
|
||||||
searchNoteService.searchInSubtree(node.data.noteId);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user