chore(popup_editor): clean up after closing modal

This commit is contained in:
Elian Doran 2025-07-11 12:00:32 +03:00
parent cab86175ef
commit ddbe7e9936
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

@ -3,6 +3,7 @@ import NoteContext from "../../components/note_context.js";
import { openDialog } from "../../services/dialog.js";
import BasicWidget from "../basic_widget.js";
import Container from "../containers/container.js";
import TypeWidget from "../type_widgets/type_widget.js";
const TPL = /*html*/`\
<div class="popup-editor-dialog modal fade mx-auto" tabindex="-1" role="dialog">
@ -112,6 +113,13 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext });
});
$dialog.on("hidden.bs.modal", () => {
const $typeWidgetEl = $dialog.find(".note-detail-printable");
if ($typeWidgetEl.length) {
const typeWidget = glob.getComponentByEl($typeWidgetEl[0]) as TypeWidget;
typeWidget.cleanup();
}
});
}
handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null {

View file

@ -3,7 +3,6 @@ import TypeWidget from "./type_widget.js";
import appContext from "../../components/app_context.js";
import searchService from "../../services/search.js";
import { t } from "../../services/i18n.js";
import type FNote from "../../entities/fnote.js";
const TPL = /*html*/`
<div class="note-detail-empty note-detail-printable">