put tabContext into frontend script API

This commit is contained in:
zadam 2019-05-29 21:48:48 +02:00
parent 890c00d4ba
commit 012a18be00
5 changed files with 6 additions and 6 deletions

View file

@ -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;
};
/**

View file

@ -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);
}
}

View file

@ -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;
};
/**

View file

@ -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();

View file

@ -235,7 +235,7 @@ class TabContext {
this.$savedIndicator.fadeIn();
// run async
bundleService.executeRelationBundles(this.note, 'runOnNoteChange');
bundleService.executeRelationBundles(this.note, 'runOnNoteChange', this);
}
async saveNoteIfChanged() {