update
This commit is contained in:
@@ -32,13 +32,17 @@
|
||||
window.__bridgeModalGuardsInstalled = true;
|
||||
window.__bridgeModalAllowClose = false;
|
||||
|
||||
const allowCloseOnce = () => {
|
||||
window.__bridgeModalAllowClose = true;
|
||||
setTimeout(() => { window.__bridgeModalAllowClose = false; }, 0);
|
||||
};
|
||||
|
||||
document.addEventListener('click', (evt) => {
|
||||
const closeHit = evt.target && evt.target.closest
|
||||
? evt.target.closest('.gjs-mdl-btn-close,[data-bridge-modal-close="1"]')
|
||||
: null;
|
||||
if (closeHit) {
|
||||
window.__bridgeModalAllowClose = true;
|
||||
setTimeout(() => { window.__bridgeModalAllowClose = false; }, 0);
|
||||
allowCloseOnce();
|
||||
}
|
||||
const container = evt.target && evt.target.closest
|
||||
? evt.target.closest('.gjs-mdl-container')
|
||||
@@ -53,6 +57,15 @@
|
||||
}
|
||||
}, true);
|
||||
|
||||
document.addEventListener('mousedown', (evt) => {
|
||||
const closeHit = evt.target && evt.target.closest
|
||||
? evt.target.closest('.gjs-mdl-btn-close,[data-bridge-modal-close="1"]')
|
||||
: null;
|
||||
if (closeHit) {
|
||||
allowCloseOnce();
|
||||
}
|
||||
}, true);
|
||||
|
||||
document.addEventListener('keydown', (evt) => {
|
||||
if (evt.key !== 'Escape') return;
|
||||
const hasModal = document.querySelector('.gjs-mdl-container');
|
||||
@@ -603,9 +616,9 @@
|
||||
try {
|
||||
const modalEl = ed.Modal && ed.Modal.el;
|
||||
if (!modalEl) return;
|
||||
if (modalEl.querySelector('[data-bridge-viewcode-close]')) return;
|
||||
const contentEl = modalEl.querySelector('.gjs-mdl-content');
|
||||
if (!contentEl) return;
|
||||
if (modalEl.querySelector('[data-bridge-viewcode-close]')) return;
|
||||
const footer = document.createElement('div');
|
||||
footer.style.display = 'flex';
|
||||
footer.style.justifyContent = 'flex-end';
|
||||
@@ -629,6 +642,45 @@
|
||||
} catch {}
|
||||
});
|
||||
}
|
||||
|
||||
if (ed && ed.Modal && ed.Modal.getModel && !ed.Modal.__bridgeModelHooked) {
|
||||
ed.Modal.__bridgeModelHooked = true;
|
||||
const mdl = ed.Modal.getModel();
|
||||
if (mdl && typeof mdl.on === 'function') {
|
||||
mdl.on('change:open', () => {
|
||||
if (!mdl.get('open')) return;
|
||||
setTimeout(() => {
|
||||
try {
|
||||
const modalEl = ed.Modal && ed.Modal.el;
|
||||
if (!modalEl) return;
|
||||
const contentEl = modalEl.querySelector('.gjs-mdl-content');
|
||||
if (!contentEl) return;
|
||||
if (modalEl.querySelector('[data-bridge-viewcode-close]')) return;
|
||||
const footer = document.createElement('div');
|
||||
footer.style.display = 'flex';
|
||||
footer.style.justifyContent = 'flex-end';
|
||||
footer.style.paddingTop = '12px';
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.textContent = 'Schließen';
|
||||
btn.setAttribute('data-bridge-viewcode-close', '1');
|
||||
btn.setAttribute('data-bridge-modal-close', '1');
|
||||
btn.style.padding = '6px 12px';
|
||||
btn.style.border = '1px solid #cbd5f5';
|
||||
btn.style.borderRadius = '4px';
|
||||
btn.style.background = '#f8fafc';
|
||||
btn.style.cursor = 'pointer';
|
||||
btn.addEventListener('click', () => {
|
||||
if (B.allowModalCloseOnce) B.allowModalCloseOnce();
|
||||
if (ed.Modal && ed.Modal.close) ed.Modal.close();
|
||||
});
|
||||
footer.appendChild(btn);
|
||||
contentEl.appendChild(footer);
|
||||
} catch {}
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 🛑 KRITISCHE KORREKTUR 1: Explizite Erstellung aller konfigurierten Kategorien
|
||||
ensureConfiguredCategories(ed);
|
||||
|
||||
Reference in New Issue
Block a user