diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index 71cf083..f040720 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -681,6 +681,43 @@ }); } } + + if (ed && !ed.__bridgeModalObserver) { + ed.__bridgeModalObserver = true; + const injectCloseButton = () => { + 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-modal-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-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 {} + }; + const observer = new MutationObserver(() => { + injectCloseButton(); + }); + observer.observe(document.body, { childList: true, subtree: true }); + setTimeout(injectCloseButton, 0); + }                  // 🛑 KRITISCHE KORREKTUR 1: Explizite Erstellung aller konfigurierten Kategorien         ensureConfiguredCategories(ed);