diff --git a/public/assets/js/bridge/blocks-standard.js b/public/assets/js/bridge/blocks-standard.js index 2a11e8a..3b7a4a5 100644 --- a/public/assets/js/bridge/blocks-standard.js +++ b/public/assets/js/bridge/blocks-standard.js @@ -123,7 +123,7 @@ // MAP (Registriert als 'std-map') addOrUpdate(bm, 'std-map', { label:'Karte', - content:`` }); + content:`` }); // Löst die notwendigen Events für den Bridge Core / Cleanup aus. editor.trigger('block:add'); diff --git a/public/editor/bridge-core.js b/public/editor/bridge-core.js index a4fe7fd..bfecc27 100644 --- a/public/editor/bridge-core.js +++ b/public/editor/bridge-core.js @@ -326,6 +326,18 @@ editor.__bridgeRteModalOpen = true; editor.__bridgeRteAllowClose = false; let reopenGuard = false; + const closeModal = () => { + editor.__bridgeRteAllowClose = true; + editor.__bridgeRteModalOpen = false; + const mdl = modal.getModel && modal.getModel(); + if (modal.__bridgeOriginalClose) { + modal.__bridgeOriginalClose(); + } else if (mdl && typeof mdl.set === 'function') { + mdl.set('open', false); + } else if (modal.el) { + modal.el.style.display = 'none'; + } + }; if (!modal.__bridgeCloseLocked) { modal.__bridgeCloseLocked = true; @@ -335,6 +347,15 @@ editor.__bridgeRteAllowClose = false; return modal.__bridgeOriginalClose(...args); } + if (editor.__bridgeRteAllowClose && !modal.__bridgeOriginalClose) { + editor.__bridgeRteAllowClose = false; + const mdl = modal.getModel && modal.getModel(); + if (mdl && typeof mdl.set === 'function') { + mdl.set('open', false); + } else if (modal.el) { + modal.el.style.display = 'none'; + } + } }; } @@ -497,14 +518,12 @@ cancelBtn.style.background = '#f8fafc'; cancelBtn.style.cursor = 'pointer'; cancelBtn.addEventListener('click', () => { - editor.__bridgeRteAllowClose = true; - editor.__bridgeRteModalOpen = false; - modal.close(); + closeModal(); }); const saveBtn = doc.createElement('button'); saveBtn.type = 'button'; - saveBtn.textContent = 'Uebernehmen'; + saveBtn.textContent = 'Speichern'; saveBtn.style.padding = '6px 12px'; saveBtn.style.border = '1px solid #0ea5e9'; saveBtn.style.borderRadius = '4px'; @@ -529,9 +548,7 @@ editor.trigger('component:update', component); } } catch {} - editor.__bridgeRteAllowClose = true; - editor.__bridgeRteModalOpen = false; - modal.close(); + closeModal(); }); actions.appendChild(cancelBtn);