mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix(popup_editor): mermaid not rendering properly
This commit is contained in:
		| @@ -80,6 +80,13 @@ const TPL = /*html*/`\ | |||||||
|  |  | ||||||
| export default class PopupEditorDialog extends Container<BasicWidget> { | export default class PopupEditorDialog extends Container<BasicWidget> { | ||||||
|  |  | ||||||
|  |     private noteContext: NoteContext; | ||||||
|  |  | ||||||
|  |     constructor() { | ||||||
|  |         super(); | ||||||
|  |         this.noteContext = new NoteContext("_popup-editor"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         // This will populate this.$widget with the content of the children. |         // This will populate this.$widget with the content of the children. | ||||||
|         super.doRender(); |         super.doRender(); | ||||||
| @@ -95,35 +102,22 @@ export default class PopupEditorDialog extends Container<BasicWidget> { | |||||||
|         this.$widget = $newWidget; |         this.$widget = $newWidget; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     async refresh(noteIdOrPath: string) { |  | ||||||
|         const noteContext = new NoteContext("_popup-editor"); |  | ||||||
|         await noteContext.setNote(noteIdOrPath); |  | ||||||
|  |  | ||||||
|         await this.handleEventInChildren("activeContextChanged", { noteContext }); |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     async openInPopupEvent({ noteIdOrPath }: EventData<"openInPopup">) { |     async openInPopupEvent({ noteIdOrPath }: EventData<"openInPopup">) { | ||||||
|         if (await this.refresh(noteIdOrPath)) { |  | ||||||
|         const $dialog = await openDialog(this.$widget, false, { |         const $dialog = await openDialog(this.$widget, false, { | ||||||
|             focus: false |             focus: false | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  |         await this.noteContext.setNote(noteIdOrPath); | ||||||
|  |  | ||||||
|         $dialog.on("shown.bs.modal", () => { |         $dialog.on("shown.bs.modal", () => { | ||||||
|             // Reduce the z-index of modals so that ckeditor popups are properly shown on top of it. |             // 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. |             // The backdrop instance is not shared so it's OK to make a one-off modification. | ||||||
|             $("body > .modal-backdrop").css("z-index", "998"); |             $("body > .modal-backdrop").css("z-index", "998"); | ||||||
|             $dialog.css("z-index", "999"); |             $dialog.css("z-index", "999"); | ||||||
|  |  | ||||||
|                 // Mind map doesn't render off screen properly, so it needs refreshing once the modal is shown. |             this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext }); | ||||||
|                 const $mindmap = $dialog.find(".note-detail-mind-map"); |  | ||||||
|                 if ($mindmap.length) { |  | ||||||
|                     const mindmapComponent = appContext.getComponentByEl($mindmap[0]); |  | ||||||
|                     mindmapComponent.refresh(); |  | ||||||
|                 } |  | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|  |  | ||||||
|     handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null { |     handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null { | ||||||
|         // Avoid events related to the current tab interfere with our popup. |         // Avoid events related to the current tab interfere with our popup. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user