mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
put tabContext into frontend script API
This commit is contained in:
parent
890c00d4ba
commit
012a18be00
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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();
|
||||||
|
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user