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 * @return {boolean} returns true if the original note is still loaded, false if user switched to another
*/ */
this.isNoteStillActive = () => { 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 || {}; note.bundleCache = note.bundleCache || {};
if (!note.bundleCache[relationName]) { if (!note.bundleCache[relationName]) {
@ -37,7 +37,7 @@ async function executeRelationBundles(note, relationName) {
} }
for (const bundle of note.bundleCache[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 * @return {boolean} returns true if the original note is still loaded, false if user switched to another
*/ */
this.isNoteStillActive = () => { 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(); ctx.$scriptArea.empty();
await bundleService.executeRelationBundles(ctx.note, 'runOnNoteView'); await bundleService.executeRelationBundles(ctx.note, 'runOnNoteView', ctx);
if (utils.isDesktop()) { if (utils.isDesktop()) {
await ctx.attributes.showAttributes(); await ctx.attributes.showAttributes();

View File

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