mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	implement shift-click to select notes in between clicked and active note, closes #2647
This commit is contained in:
		| @@ -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 note | ||||
|                         this.tree.reactivate(true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user