diff --git a/lib/ui/elements/dialog.mjs b/lib/ui/elements/dialog.mjs index d4b66b6b8c..6ee615c25d 100644 --- a/lib/ui/elements/dialog.mjs +++ b/lib/ui/elements/dialog.mjs @@ -47,84 +47,78 @@ The show method will be called on an existing dialog unless the creation is impl */ export default function dialog(dialog) { - // Shortcircuit method and show existing dialog. // The new flag can be used to always create a new dialog. - if(!dialog.new && typeof dialog.show === 'function'){ - dialog.show() + if (!dialog.new && typeof dialog.show === 'function') { + dialog.show(); return; } - dialog.show = show - if (!dialog.target) { - // The dialog must be modal if no target is provided. dialog.modal = true; - // Ensure the target is an HTMLElement before proceeding + // Ensure the target is an HTMLElement before proceeding } else if (!(dialog.target instanceof HTMLElement)) return; + else dialog.show = show; // Close existing modal. - document.querySelector('dialog.modal')?.close() + document.querySelector('dialog.modal')?.close(); dialog.minimizeBtn &&= mapp.utils.html`