Skip to content

Build your personal knowledge base with Trilium Notes

fix right click delete (or other action) when other node is activated

azivner5cc91c64a31d
diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.js
index d2e5ef7523..cfb1ba77aa 100644
--- a/src/public/javascripts/services/tree_context_menu.js
+++ b/src/public/javascripts/services/tree_context_menu.js
@@ -126,6 +126,13 @@ const contextMenuOptions = {
// Activate node on right-click
node.setActive();
+
+ // right click resets selection to just this node
+ // this is important when e.g. you right click on a note while having different note active
+ // and then click on delete - obviously you want to delete only that one right-clicked
+ node.setSelected(true);
+ treeService.clearSelectedNodes();
+
// Disable tree keyboard handling
ui.menu.prevKeyboard = node.tree.options.keyboard;
node.tree.options.keyboard = false;