diff --git a/src/public/javascripts/services/bundle.js b/src/public/javascripts/services/bundle.js
index d85638b5e..33ee8ddee 100644
--- a/src/public/javascripts/services/bundle.js
+++ b/src/public/javascripts/services/bundle.js
@@ -8,8 +8,8 @@ async function getAndExecuteBundle(noteId, originEntity = null) {
return await executeBundle(bundle, originEntity);
}
-async function executeBundle(bundle, originEntity, tabContext, $container) {
- const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, tabContext, $container);
+async function executeBundle(bundle, originEntity, $container) {
+ const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, $container);
try {
return await (function () {
diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js
index 7c2704790..f813d3a13 100644
--- a/src/public/javascripts/services/frontend_script_api.js
+++ b/src/public/javascripts/services/frontend_script_api.js
@@ -18,7 +18,7 @@ import appContext from "./app_context.js";
* @constructor
* @hideconstructor
*/
-function FrontendScriptApi(startNote, currentNote, originEntity = null, tabContext = null, $container = null) {
+function FrontendScriptApi(startNote, currentNote, originEntity = null, $container = null) {
const $pluginButtons = $("#plugin-buttons");
/** @property {jQuery} container of all the rendered script content */
@@ -34,9 +34,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
// to keep consistency with backend API
this.dayjs = dayjs;
- /** @property {TabContext|null} - experimental! */
- this.tabContext = tabContext;
-
/** @property {CollapsibleWidget} */
this.CollapsibleWidget = CollapsibleWidget;
@@ -301,19 +298,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
*/
this.getActiveTabNotePath = appContext.tabManager.getActiveTabNotePath;
- /**
- * This method checks whether user navigated away from the note from which the scripts has been started.
- * This is necessary because script execution is async and by the time it is finished, the user might have
- * already navigated away from this page - the end result would be that script might return data for the wrong
- * note.
- *
- * @method
- * @return {boolean} returns true if the original note is still loaded, false if user switched to another
- */
- this.isNoteStillActive = () => {
- return tabContext.note && this.originEntity.noteId === tabContext.note.noteId;
- };
-
/**
* @method
* @param {object} $el - jquery object on which to setup the tooltip
diff --git a/src/public/javascripts/services/render.js b/src/public/javascripts/services/render.js
index c9df86980..5552d2386 100644
--- a/src/public/javascripts/services/render.js
+++ b/src/public/javascripts/services/render.js
@@ -1,7 +1,7 @@
import server from "./server.js";
import bundleService from "./bundle.js";
-async function render(note, $el, tabContext) {
+async function render(note, $el) {
const relations = await note.getRelations('renderNote');
const renderNoteIds = relations
.map(rel => rel.value)
@@ -18,7 +18,7 @@ async function render(note, $el, tabContext) {
$scriptContainer.append(bundle.html);
// async so that scripts cannot block trilium execution
- bundleService.executeBundle(bundle, note, tabContext, $scriptContainer);
+ bundleService.executeBundle(bundle, note, $scriptContainer);
}
return renderNoteIds.length > 0;
diff --git a/src/public/javascripts/services/script_context.js b/src/public/javascripts/services/script_context.js
index 86b1c82f1..f6bbbef34 100644
--- a/src/public/javascripts/services/script_context.js
+++ b/src/public/javascripts/services/script_context.js
@@ -2,7 +2,7 @@ import FrontendScriptApi from './frontend_script_api.js';
import utils from './utils.js';
import treeCache from './tree_cache.js';
-async function ScriptContext(startNoteId, allNoteIds, originEntity = null, tabContext = null, $container = null) {
+async function ScriptContext(startNoteId, allNoteIds, originEntity = null, $container = null) {
const modules = {};
const startNote = await treeCache.getNote(startNoteId);
@@ -11,7 +11,7 @@ async function ScriptContext(startNoteId, allNoteIds, originEntity = null, tabCo
return {
modules: modules,
notes: utils.toObject(allNotes, note => [note.noteId, note]),
- apis: utils.toObject(allNotes, note => [note.noteId, new FrontendScriptApi(startNote, note, originEntity, tabContext, $container)]),
+ apis: utils.toObject(allNotes, note => [note.noteId, new FrontendScriptApi(startNote, note, originEntity, $container)]),
require: moduleNoteIds => {
return moduleName => {
const candidates = allNotes.filter(note => moduleNoteIds.includes(note.noteId));
diff --git a/src/public/javascripts/widgets/layout.js b/src/public/javascripts/widgets/layout.js
index e2ed8254f..6d270d2ff 100644
--- a/src/public/javascripts/widgets/layout.js
+++ b/src/public/javascripts/widgets/layout.js
@@ -35,7 +35,7 @@ export default class Layout {
parent => new TitleBarButtonsWidget(parent)
]),
parent => new StandardTopWidget(parent),
- parent => new FlexContainer(parent, { 'flex-direction': 'row', 'overflow': 'hidden' }, [
+ parent => new FlexContainer(parent, { 'flex-direction': 'row', 'min-height': '0' }, [
parent => new SidePaneContainer(parent, 'left', [
parent => new GlobalButtonsWidget(parent),
parent => new SearchBoxWidget(parent),
diff --git a/src/public/javascripts/widgets/note_detail.js b/src/public/javascripts/widgets/note_detail.js
index 076fc6c17..ea02709b2 100644
--- a/src/public/javascripts/widgets/note_detail.js
+++ b/src/public/javascripts/widgets/note_detail.js
@@ -23,6 +23,7 @@ const TPL = `
@@ -164,8 +165,6 @@ export default class NoteDetailWidget extends TabAwareWidget {
const noteComplement = await this.tabContext.getNoteComplement();
- console.log(note, noteComplement);
-
if (utils.isHtmlEmpty(noteComplement.content)) {
type = 'book';
}
diff --git a/src/public/javascripts/widgets/note_revisions.js b/src/public/javascripts/widgets/note_revisions.js
index e2c8c08d9..57c2aad89 100644
--- a/src/public/javascripts/widgets/note_revisions.js
+++ b/src/public/javascripts/widgets/note_revisions.js
@@ -20,7 +20,7 @@ class NoteRevisionsWidget extends CollapsibleWidget {
const $showFullButton = $("").append("show dialog").addClass('widget-header-action');
$showFullButton.on('click', async () => {
const attributesDialog = await import("../dialogs/note_revisions.js");
- attributesDialog.showCurrentNoteRevisions(this.ctx.note.noteId);
+ attributesDialog.showCurrentNoteRevisions(this.noteId);
});
return [$showFullButton];
diff --git a/src/public/javascripts/widgets/type_widgets/render.js b/src/public/javascripts/widgets/type_widgets/render.js
index 4dc55596d..37633afeb 100644
--- a/src/public/javascripts/widgets/type_widgets/render.js
+++ b/src/public/javascripts/widgets/type_widgets/render.js
@@ -21,7 +21,7 @@ export default class RenderTypeWidget extends TypeWidget {
this.$noteDetailRenderContent = this.$widget.find('.note-detail-render-content');
this.$renderButton = this.$widget.find('.render-button');
- this.$renderButton.on('click', () => this.render()); // long form!
+ this.$renderButton.on('click', () => this.refresh());
return this.$widget;
}
@@ -30,7 +30,9 @@ export default class RenderTypeWidget extends TypeWidget {
this.$widget.show();
this.$noteDetailRenderHelp.hide();
- const renderNotesFound = await renderService.render(note, this.$noteDetailRenderContent, this.tabContext);
+ const renderNotesFound = await renderService.render(note, this.$noteDetailRenderContent);
+
+ console.log("render", this.$noteDetailRenderContent);
if (!renderNotesFound) {
this.$noteDetailRenderHelp.show();