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
fix(popup_editor): mermaid not rendering properly
Elian Doran39eac83d38a7
diff --git a/apps/client/src/widgets/dialogs/popup_editor.ts b/apps/client/src/widgets/dialogs/popup_editor.tsindex 252d4769e9..be36508744 100644--- a/apps/client/src/widgets/dialogs/popup_editor.ts+++ b/apps/client/src/widgets/dialogs/popup_editor.ts@@ -80,6 +80,13 @@ const TPL = /*html*/`\export default class PopupEditorDialog extends Container<BasicWidget> {+ private noteContext: NoteContext;++ constructor() {+ super();+ this.noteContext = new NoteContext("_popup-editor");+ }+doRender() {// This will populate this.$widget with the content of the children.super.doRender();@@ -95,34 +102,21 @@ export default class PopupEditorDialog extends Container<BasicWidget> {this.$widget = $newWidget;}- async refresh(noteIdOrPath: string) {- const noteContext = new NoteContext("_popup-editor");- await noteContext.setNote(noteIdOrPath);+ async openInPopupEvent({ noteIdOrPath }: EventData<"openInPopup">) {+ const $dialog = await openDialog(this.$widget, false, {+ focus: false+ });++ await this.noteContext.setNote(noteIdOrPath);- await this.handleEventInChildren("activeContextChanged", { noteContext });- return true;- }+ $dialog.on("shown.bs.modal", () => {+ // Reduce the z-index of modals so that ckeditor popups are properly shown on top of it.+ // The backdrop instance is not shared so it's OK to make a one-off modification.+ $("body > .modal-backdrop").css("z-index", "998");+ $dialog.css("z-index", "999");- async openInPopupEvent({ noteIdOrPath }: EventData<"openInPopup">) {- if (await this.refresh(noteIdOrPath)) {- const $dialog = await openDialog(this.$widget, false, {- focus: false- });-- $dialog.on("shown.bs.modal", () => {- // Reduce the z-index of modals so that ckeditor popups are properly shown on top of it.- // The backdrop instance is not shared so it's OK to make a one-off modification.- $("body > .modal-backdrop").css("z-index", "998");- $dialog.css("z-index", "999");-- // Mind map doesn't render off screen properly, so it needs refreshing once the modal is shown.- const $mindmap = $dialog.find(".note-detail-mind-map");- if ($mindmap.length) {- const mindmapComponent = appContext.getComponentByEl($mindmap[0]);- mindmapComponent.refresh();- }- });- }+ this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext });+ });}handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null {