mirror of
https://github.com/zadam/trilium.git
synced 2024-11-10 17:13:45 +08:00
put tabContext into frontend script API
This commit is contained in:
parent
890c00d4ba
commit
012a18be00
5 changed files with 6 additions and 6 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue