This commit is contained in:
2026-01-17 03:36:27 +01:00
parent 83bde470d4
commit c36209975c
2 changed files with 66 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ async function ensureAuthenticated() {
}
function initAppFeatures() {
installGlobalModalGuards();
initTabs();
initLists();
initCreate();
@@ -43,6 +44,30 @@ function initAppFeatures() {
ensureFloatingLogout({ redirect: '/login.php' });
}
function installGlobalModalGuards() {
if (window.__modalGuardsInstalled) return;
window.__modalGuardsInstalled = true;
document.addEventListener('click', (evt) => {
const dlg = evt.target && evt.target.tagName === 'DIALOG'
? evt.target
: (evt.target && evt.target.closest ? evt.target.closest('dialog') : null);
if (!dlg) return;
if (evt.target === dlg) {
evt.preventDefault();
evt.stopPropagation();
}
}, true);
document.addEventListener('cancel', (evt) => {
const dlg = evt.target;
if (dlg && dlg.tagName === 'DIALOG') {
evt.preventDefault();
evt.stopPropagation();
}
}, true);
}
// Sync-Nachrichten aus dem Editor-Iframe (unverändert, aber mit credentials)
async function handleEditorMessages(ev) {
const msg = ev.data || {};