From 84aabe73279541824c391ad7c79a8556d8c3b3c5 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sat, 17 Jan 2026 03:45:41 +0100 Subject: [PATCH] asdasd --- public/assets/js/bridge/rte-editor.js | 1 + public/editor/bridge-core.js | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/public/assets/js/bridge/rte-editor.js b/public/assets/js/bridge/rte-editor.js index 7cbd57d..efa3538 100644 --- a/public/assets/js/bridge/rte-editor.js +++ b/public/assets/js/bridge/rte-editor.js @@ -165,6 +165,7 @@ const closeModal = () => { editor.__bridgeRteAllowClose = true; editor.__bridgeRteModalOpen = false; + if (B.allowModalCloseOnce) B.allowModalCloseOnce(); if (typeof modal.__bridgeOriginalClose === 'function') { modal.__bridgeOriginalClose(); } else if (typeof modal.close === 'function') { diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index 7fb943c..c34e943 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -30,6 +30,7 @@ const installModalGuards = () => { if (window.__bridgeModalGuardsInstalled) return; window.__bridgeModalGuardsInstalled = true; + window.__bridgeModalAllowClose = false; document.addEventListener('click', (evt) => { const container = evt.target && evt.target.closest @@ -40,6 +41,12 @@ if (!content) { evt.preventDefault(); evt.stopPropagation(); + return; + } + const closeBtn = evt.target.closest && evt.target.closest('.gjs-mdl-btn-close,[data-bridge-modal-close="1"]'); + if (closeBtn) { + window.__bridgeModalAllowClose = true; + setTimeout(() => { window.__bridgeModalAllowClose = false; }, 0); } } }, true); @@ -570,7 +577,24 @@ // Keep the fix off live updates to avoid cursor jumps; run only on RTE close.          -        window.__gjs = ed; + window.__gjs = ed; + + if (ed && ed.Modal && !ed.Modal.__bridgeCloseGuarded) { + ed.Modal.__bridgeCloseGuarded = true; + ed.Modal.__bridgeOriginalClose = ed.Modal.close ? ed.Modal.close.bind(ed.Modal) : null; + if (ed.Modal.close) { + ed.Modal.close = function (...args) { + if (window.__bridgeModalAllowClose && ed.Modal.__bridgeOriginalClose) { + return ed.Modal.__bridgeOriginalClose(...args); + } + return undefined; + }; + } + B.allowModalCloseOnce = () => { + window.__bridgeModalAllowClose = true; + setTimeout(() => { window.__bridgeModalAllowClose = false; }, 0); + }; + }                  // 🛑 KRITISCHE KORREKTUR 1: Explizite Erstellung aller konfigurierten Kategorien         ensureConfiguredCategories(ed);