This commit is contained in:
2026-01-17 03:18:47 +01:00
parent a13a434cf8
commit b306b7dbd3

View File

@@ -137,6 +137,20 @@
const modal = editor && editor.Modal; const modal = editor && editor.Modal;
if (!modal || editor.__bridgeRteModalOpen) return; if (!modal || editor.__bridgeRteModalOpen) return;
editor.__bridgeRteModalOpen = true; editor.__bridgeRteModalOpen = true;
editor.__bridgeRteAllowClose = false;
if (!modal.__bridgeCloseGuarded) {
modal.__bridgeCloseGuarded = true;
modal.__bridgeOriginalClose = modal.close ? modal.close.bind(modal) : null;
if (modal.close) {
modal.close = function (...args) {
if (editor.__bridgeRteAllowClose && modal.__bridgeOriginalClose) {
return modal.__bridgeOriginalClose(...args);
}
return undefined;
};
}
}
try { try {
const editing = editor.getEditing && editor.getEditing(); const editing = editor.getEditing && editor.getEditing();
@@ -149,12 +163,16 @@
} catch {} } catch {}
const closeModal = () => { const closeModal = () => {
editor.__bridgeRteAllowClose = true;
editor.__bridgeRteModalOpen = false; editor.__bridgeRteModalOpen = false;
if (typeof modal.close === 'function') { if (typeof modal.__bridgeOriginalClose === 'function') {
modal.__bridgeOriginalClose();
} else if (typeof modal.close === 'function') {
modal.close(); modal.close();
} else if (modal.getModel && modal.getModel().set) { } else if (modal.getModel && modal.getModel().set) {
modal.getModel().set('open', false); modal.getModel().set('open', false);
} }
editor.__bridgeRteAllowClose = false;
}; };
const doc = document; const doc = document;
@@ -430,6 +448,12 @@
if (modal.el) { if (modal.el) {
const closeBtn = modal.el.querySelector('.gjs-mdl-btn-close'); const closeBtn = modal.el.querySelector('.gjs-mdl-btn-close');
if (closeBtn) closeBtn.style.display = 'none'; if (closeBtn) closeBtn.style.display = 'none';
const backdrop = modal.el.querySelector('.gjs-mdl-dialog');
if (backdrop) {
backdrop.addEventListener('click', (evt) => {
evt.stopPropagation();
});
}
} }
modal.open(); modal.open();
}; };