mirror of
https://github.com/zadam/trilium.git
synced 2025-10-05 21:15:01 +08:00
fix(popup_editor): mermaid not rendering properly
This commit is contained in:
parent
55bd6fb57d
commit
39eac83d38
1 changed files with 19 additions and 25 deletions
|
@ -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,34 +102,21 @@ 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
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$dialog.on("shown.bs.modal", () => {
|
await this.noteContext.setNote(noteIdOrPath);
|
||||||
// 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.
|
$dialog.on("shown.bs.modal", () => {
|
||||||
const $mindmap = $dialog.find(".note-detail-mind-map");
|
// Reduce the z-index of modals so that ckeditor popups are properly shown on top of it.
|
||||||
if ($mindmap.length) {
|
// The backdrop instance is not shared so it's OK to make a one-off modification.
|
||||||
const mindmapComponent = appContext.getComponentByEl($mindmap[0]);
|
$("body > .modal-backdrop").css("z-index", "998");
|
||||||
mindmapComponent.refresh();
|
$dialog.css("z-index", "999");
|
||||||
}
|
|
||||||
});
|
this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext });
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue