From 3559978dc169d8fbb9039d1e1d1ddc4ff03e786c Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 27 Nov 2024 11:25:17 +0200 Subject: [PATCH] modal set element change --- client/src/views/modal.js | 10 +++++++--- client/src/views/popup-notification.js | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/views/modal.js b/client/src/views/modal.js index c0921025e6..d4c2a6ab90 100644 --- a/client/src/views/modal.js +++ b/client/src/views/modal.js @@ -314,6 +314,9 @@ class ModalView extends View { this.dialog.close(); } + // Otherwise, re-render won't work. + this.element = undefined; + this.isCollapsed = false; $(this.containerSelector).remove(); @@ -372,7 +375,6 @@ class ModalView extends View { this.containerElement = document.querySelector(this.containerSelector); this.setElement(this.containerSelector + ' .body'); - this.bodyElement = this.element; // @todo Review that the element is set back to the container afterwards. @@ -380,6 +382,10 @@ class ModalView extends View { }); this.on('after:render', () => { + // Trick to delegate events for the whole modal. + this.element = undefined; + this.setElement(this.containerSelector); + $(this.containerSelector).show(); this.dialog.show(); @@ -397,8 +403,6 @@ class ModalView extends View { if (this.getParentView()) { this.getParentView().trigger('modal-shown'); } - - //this.setElement(this.containerSelector); }); this.once('remove', () => { diff --git a/client/src/views/popup-notification.js b/client/src/views/popup-notification.js index d0cca4a17c..4456858af5 100644 --- a/client/src/views/popup-notification.js +++ b/client/src/views/popup-notification.js @@ -55,6 +55,8 @@ class PopupNotificationView extends View { (this.getConfig().get('popupNotificationSound') || this.soundPath); this.on('render', () => { + this.element = undefined; + $(containerSelector).remove(); const className = 'popup-notification-' + Espo.Utils.toDom(this.type);