all access to notes and branches is now async so we can lazy load it in the future

This commit is contained in:
azivner
2018-03-25 14:49:20 -04:00
parent 297a2cd9da
commit 54e4f54678
11 changed files with 98 additions and 76 deletions

View File

@@ -99,11 +99,11 @@ const contextMenuSettings = {
{title: "Sort alphabetically <kbd>Alt+S</kbd>", cmd: "sortAlphabetically", uiIcon: " ui-icon-arrowthick-2-n-s"}
],
beforeOpen: (event, ui) => {
beforeOpen: async (event, ui) => {
const node = $.ui.fancytree.getNode(ui.target);
const branch = treeService.getBranch(node.data.branchId);
const note = treeService.getNote(node.data.noteId);
const parentNote = treeService.getNote(branch.parentNoteId);
const branch = await treeService.getBranch(node.data.branchId);
const note = await treeService.getNote(node.data.noteId);
const parentNote = await treeService.getNote(branch.parentNoteId);
// Modify menu entries depending on node status
$tree.contextmenu("enableEntry", "pasteAfter", clipboardIds.length > 0 && (!parentNote || parentNote.type !== 'search'));