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
implement shift-click to select notes in between clicked and active note, closes #2647
zadame1cd09df3670
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.jsindex d8caaac4cd..1b365074af 100644--- a/src/public/app/widgets/note_tree.js+++ b/src/public/app/widgets/note_tree.js@@ -309,13 +309,39 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {if (targetType === 'title' || targetType === 'icon') {if (event.shiftKey) {- node.setSelected(!node.isSelected());+ const activeNode = this.getActiveNode();++ if (activeNode.getParent() !== node.getParent()) {+ return;+ }++ this.clearSelectedNodes();++ function selectInBetween(first, second) {+ for (let i = 0; first && first !== second && i < 10000; i++) {+ first.setSelected(true);+ first = first.getNextSibling();+ }++ second.setSelected();+ }++ if (activeNode.getIndex() < node.getIndex()) {+ selectInBetween(activeNode, node);+ } else {+ selectInBetween(node, activeNode);+ }+node.setFocus(true);}else if (event.ctrlKey) {const notePath = treeService.getNotePath(node);appContext.tabManager.openTabWithNoteWithHoisting(notePath);}+ else if (event.altKey) {+ node.setSelected(!node.isSelected());+ node.setFocus(true);+ }else if (data.node.isActive()) {// this is important for single column mobile view, otherwise it's not possible to see again previously displayed notethis.tree.reactivate(true);