mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	put tabContext into frontend script API
This commit is contained in:
		| @@ -311,7 +311,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | ||||
|      * @return {boolean} returns true if the original note is still loaded, false if user switched to another | ||||
|      */ | ||||
|     this.isNoteStillActive = () => { | ||||
|         return this.originEntity.noteId === noteDetailService.getActiveNoteId(); | ||||
|         return this.originEntity.noteId === tabContext.noteId; | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -29,7 +29,7 @@ async function executeStartupBundles() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| async function executeRelationBundles(note, relationName) { | ||||
| async function executeRelationBundles(note, relationName, tabContext) { | ||||
|     note.bundleCache = note.bundleCache || {}; | ||||
|  | ||||
|     if (!note.bundleCache[relationName]) { | ||||
| @@ -37,7 +37,7 @@ async function executeRelationBundles(note, relationName) { | ||||
|     } | ||||
|  | ||||
|     for (const bundle of note.bundleCache[relationName]) { | ||||
|         await executeBundle(bundle, note); | ||||
|         await executeBundle(bundle, note, tabContext); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -283,7 +283,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | ||||
|      * @return {boolean} returns true if the original note is still loaded, false if user switched to another | ||||
|      */ | ||||
|     this.isNoteStillActive = () => { | ||||
|         return this.originEntity.noteId === noteDetailService.getActiveNoteId(); | ||||
|         return this.originEntity.noteId === tabContext.noteId; | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -215,7 +215,7 @@ async function loadNoteDetailToContext(ctx, note, notePath) { | ||||
|  | ||||
|     ctx.$scriptArea.empty(); | ||||
|  | ||||
|     await bundleService.executeRelationBundles(ctx.note, 'runOnNoteView'); | ||||
|     await bundleService.executeRelationBundles(ctx.note, 'runOnNoteView', ctx); | ||||
|  | ||||
|     if (utils.isDesktop()) { | ||||
|         await ctx.attributes.showAttributes(); | ||||
|   | ||||
| @@ -235,7 +235,7 @@ class TabContext { | ||||
|         this.$savedIndicator.fadeIn(); | ||||
|  | ||||
|         // run async | ||||
|         bundleService.executeRelationBundles(this.note, 'runOnNoteChange'); | ||||
|         bundleService.executeRelationBundles(this.note, 'runOnNoteChange', this); | ||||
|     } | ||||
|  | ||||
|     async saveNoteIfChanged() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user