Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
it should not be possible to add note after hoisted note
azivnerc85979b66b76
diff --git a/package-lock.json b/package-lock.jsonindex 8d7766c32f..340584139b 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,6 +1,6 @@{"name": "trilium",- "version": "0.27.0-beta",+ "version": "0.27.1-beta","lockfileVersion": 1,"requires": true,"dependencies": {diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex e52dd822ab..381ad1a553 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -649,11 +649,15 @@ messagingService.subscribeToSyncMessages(syncData => {}});-utils.bindShortcut('ctrl+o', () => {+utils.bindShortcut('ctrl+o', async () => {const node = getCurrentNode();const parentNoteId = node.data.parentNoteId;const isProtected = treeUtils.getParentProtectedStatus(node);+ if (node.data.noteId === 'root' || node.data.noteId === await hoistedNoteService.getHoistedNoteId()) {+ return;+ }+createNote(node, parentNoteId, 'after', isProtected, true);});diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.jsindex 54d60997c8..01b6fee648 100644--- a/src/public/javascripts/services/tree_context_menu.js+++ b/src/public/javascripts/services/tree_context_menu.js@@ -13,8 +13,6 @@ import syncService from "./sync.js";import hoistedNoteService from './hoisted_note.js';import ContextMenuItemsContainer from './context_menu_items_container.js';-const $tree = $("#tree");-let clipboardIds = [];let clipboardMode = null;@@ -110,11 +108,12 @@ async function getContextMenuItems(event) {const note = await treeCache.getNote(node.data.noteId);const parentNote = await treeCache.getNote(branch.parentNoteId);const isNotRoot = note.noteId !== 'root';+ const isHoisted = note.noteId === await hoistedNoteService.getHoistedNoteId();const itemsContainer = new ContextMenuItemsContainer(contextMenuItems);// Modify menu entries depending on node status- itemsContainer.enableItem("insertNoteAfter", isNotRoot && parentNote.type !== 'search');+ itemsContainer.enableItem("insertNoteAfter", isNotRoot && !isHoisted && parentNote.type !== 'search');itemsContainer.enableItem("insertChildNote", note.type !== 'search');itemsContainer.enableItem("delete", isNotRoot && parentNote.type !== 'search');itemsContainer.enableItem("copy", isNotRoot);@@ -125,10 +124,8 @@ async function getContextMenuItems(event) {itemsContainer.enableItem("export", note.type !== 'search');itemsContainer.enableItem("editBranchPrefix", isNotRoot && parentNote.type !== 'search');- const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();-- itemsContainer.hideItem("hoist", note.noteId === hoistedNoteId);- itemsContainer.hideItem("unhoist", note.noteId !== hoistedNoteId || !isNotRoot);+ itemsContainer.hideItem("hoist", isHoisted);+ itemsContainer.hideItem("unhoist", !isHoisted || !isNotRoot);// Activate node on right-clicknode.setActive();