mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	better behavior of activateNote frontend script
This commit is contained in:
		| @@ -40,9 +40,13 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | ||||
|      * @returns {Promise<void>} | ||||
|      */ | ||||
|     this.activateNote = async (notePath, noteLoadedListener) => { | ||||
|         await treeService.activateNote(notePath, noteLoadedListener); | ||||
|  | ||||
|         await treeService.activateNote(notePath, async () => { | ||||
|             await treeService.scrollToActiveNote(); | ||||
|  | ||||
|             if (noteLoadedListener) { | ||||
|                 noteLoadedListener(); | ||||
|             } | ||||
|         }); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -562,7 +562,7 @@ async function collapseTree(node = null) { | ||||
| } | ||||
|  | ||||
| function focusTree() { | ||||
|     $tree.find('.fancytree-container').focus(); | ||||
|     getTree().setFocus(); | ||||
| } | ||||
|  | ||||
| async function scrollToActiveNote() { | ||||
| @@ -573,8 +573,8 @@ async function scrollToActiveNote() { | ||||
|  | ||||
|         const node = await expandToNote(activeContext.notePath); | ||||
|  | ||||
|         node.makeVisible({scrollIntoView: true}); | ||||
|         node.setFocus(true); | ||||
|         await node.makeVisible({scrollIntoView: true}); | ||||
|         node.setFocus(); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user