diff --git a/apps/client/src/widgets/dialogs/popup_editor.ts b/apps/client/src/widgets/dialogs/popup_editor.ts index eb543c3ed..107cfe0aa 100644 --- a/apps/client/src/widgets/dialogs/popup_editor.ts +++ b/apps/client/src/widgets/dialogs/popup_editor.ts @@ -1,3 +1,4 @@ +import type { EventNames, EventData } from "../../components/app_context.js"; import NoteContext from "../../components/note_context.js"; import { openDialog } from "../../services/dialog.js"; import froca from "../../services/froca.js"; @@ -28,7 +29,7 @@ export default class PopupEditorDialog extends Container { constructor() { super(); setTimeout(() => { - this.openPopupEditorEvent("vdJ8utb0A0Kd"); + this.openPopupEditorEvent("f4sIt7iRg0Lc"); }, 750); } @@ -57,9 +58,7 @@ export default class PopupEditorDialog extends Container { const noteContext = new NoteContext("_popup-editor"); await noteContext.setNote(note.noteId); - await this.handleEventInChildren("setNoteContext", { - noteContext: noteContext - }); + await this.handleEventInChildren("activeContextChanged", { noteContext }); return true; } @@ -69,4 +68,14 @@ export default class PopupEditorDialog extends Container { openDialog(this.$widget); } } + + handleEventInChildren(name: T, data: EventData): Promise | null { + // Avoid events related to the current tab interfere with our popup. + if (["noteSwitched", "noteSwitchedAndActivated"].includes(name)) { + return Promise.resolve(); + } + + return super.handleEventInChildren(name, data); + } + }