mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	jump to note works with lazy loaded note tree
This commit is contained in:
		| @@ -15,10 +15,31 @@ const treeUtils = (function() { | |||||||
|         return treeEl.fancytree('getNodeByKey', noteId); |         return treeEl.fancytree('getNodeByKey', noteId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function activateNode(noteId) { |     async function activateNode(noteIdToActivate) { | ||||||
|  |         const noteIdPath = [ noteIdToActivate ]; | ||||||
|  |  | ||||||
|  |         let note = noteTree.getByNoteId(noteIdToActivate); | ||||||
|  |  | ||||||
|  |         while (note) { | ||||||
|  |             if (note.note_pid !== 'root') { | ||||||
|  |                 noteIdPath.push(note.note_pid); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             note = noteTree.getByNoteId(note.note_pid); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         for (const noteId of noteIdPath.reverse()) { | ||||||
|  |             console.log("Activating/expanding " + noteId); | ||||||
|  |  | ||||||
|             const node = treeUtils.getNodeByKey(noteId); |             const node = treeUtils.getNodeByKey(noteId); | ||||||
|  |  | ||||||
|         node.setActive(); |             if (noteId !== noteIdToActivate) { | ||||||
|  |                 await node.setExpanded(); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 await node.setActive(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     function getNoteTitle(noteId) { |     function getNoteTitle(noteId) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user