Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
layout fixes
zadam3752cf8cba16
diff --git a/src/public/javascripts/services/bundle.js b/src/public/javascripts/services/bundle.jsindex d85638b5ea..33ee8ddee6 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.jsindex 7c27047907..f813d3a134 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 APIthis.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 tooltipdiff --git a/src/public/javascripts/services/render.js b/src/public/javascripts/services/render.jsindex c9df86980a..5552d23860 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.jsindex 86b1c82f12..f6bbbef340 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, tabCoreturn {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.jsindex e2ed8254fa..6d270d2ff7 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.jsindex 076fc6c17c..ea02709b2b 100644--- a/src/public/javascripts/widgets/note_detail.js+++ b/src/public/javascripts/widgets/note_detail.js@@ -23,6 +23,7 @@ const TPL = `<style>.note-detail {height: 100%;+ min-height: 0;}</style></div>@@ -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.jsindex e2c8c08d92..57c2aad89e 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 = $("<a>").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.jsindex 4dc55596d5..37633afeb1 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();