diff --git a/config/current.ver b/config/current.ver index 6e3ccb0..a54e136 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.1.68 \ No newline at end of file +1.1.69 \ No newline at end of file diff --git a/public/assets/js/bridge/blocks-placeholder.js b/public/assets/js/bridge/blocks-placeholder.js index 8dd8457..4cb4a3f 100644 --- a/public/assets/js/bridge/blocks-placeholder.js +++ b/public/assets/js/bridge/blocks-placeholder.js @@ -521,13 +521,32 @@ const refreshPlaceholderComponent = (component) => { } }); + const closeModalSafe = () => { + if (!modal) return; + const modalWindow = (modal.el && modal.el.ownerDocument && modal.el.ownerDocument.defaultView) || window; + if (modalWindow && modalWindow.B && typeof modalWindow.B.allowModalCloseOnce === 'function') { + modalWindow.B.allowModalCloseOnce(); + } + if (typeof modal.__bridgeOriginalClose === 'function') { + modal.__bridgeOriginalClose(); + return; + } + if (typeof modal.close === 'function') { + modal.close(); + return; + } + if (modal.getModel && typeof modal.getModel === 'function') { + const mdl = modal.getModel(); + if (mdl && typeof mdl.set === 'function') { + mdl.set('open', false); + } + } + }; + cancelBtn.addEventListener('click', (e) => { e.preventDefault(); fireCancel('cancel-button'); - if (window.B && typeof window.B.allowModalCloseOnce === 'function') { - window.B.allowModalCloseOnce(); - } - modal.close(); + closeModalSafe(); }); const applyPayload = (payload) => { @@ -603,10 +622,7 @@ const refreshPlaceholderComponent = (component) => { } } didSave = true; - if (window.B && typeof window.B.allowModalCloseOnce === 'function') { - window.B.allowModalCloseOnce(); - } - modal.close(); + closeModalSafe(); }); toggleSections();