From 87337eaeeff673af1da05c2fc592f17201b94b93 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 6 Apr 2019 22:10:00 +0200 Subject: [PATCH] Bugfix. Modal auto-closes when you open it a second time --- CHANGES.md | 3 ++- dist/converse.js | 7 ++++++- src/converse-modal.js | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b83a3057a..1a88f75b8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,8 @@ ## 4.2.1 (Unreleased) -* Bugfix. Don't set `muc_domain` for roomspanel if `locked_muc_domain` is `true`. +* Bugfix: Don't set `muc_domain` for roomspanel if `locked_muc_domain` is `true`. +* Bugfix: Modal auto-closes when you open it for a second time. ## 4.2.0 (2019-04-04) diff --git a/dist/converse.js b/dist/converse.js index d61c3e34a..513361f03 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -53173,6 +53173,7 @@ const _converse$env = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_ Strophe = _converse$env.Strophe, Backbone = _converse$env.Backbone, _ = _converse$env._; +const u = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].env.utils; _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-modal', { initialize() { const _converse = this._converse; @@ -53187,7 +53188,11 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins if (!_.isNil(this.trigger_el)) { this.trigger_el.classList.remove('selected'); } - }, false); + }, false); // XXX: Workaround for an apparent Bootstrap.Native bug, where + // the 'fade' class isn't removed after closing the modal, + // causing it to flash-close when you open it again. + + this.el.addEventListener('shown.bs.modal', () => u.removeClass('fade', this.el), false); }, insertIntoDOM() { diff --git a/src/converse-modal.js b/src/converse-modal.js index e1d9342ab..a47b2448c 100644 --- a/src/converse-modal.js +++ b/src/converse-modal.js @@ -10,6 +10,7 @@ import converse from "@converse/headless/converse-core"; import tpl_alert_modal from "templates/alert_modal.html"; const { Strophe, Backbone, _ } = converse.env; +const u = converse.env.utils; converse.plugins.add('converse-modal', { @@ -30,6 +31,11 @@ converse.plugins.add('converse-modal', { this.trigger_el.classList.remove('selected'); } }, false); + + // XXX: Workaround for an apparent Bootstrap.Native bug, where + // the 'fade' class isn't removed after closing the modal, + // causing it to flash-close when you open it again. + this.el.addEventListener('shown.bs.modal', () => u.removeClass('fade', this.el), false); }, insertIntoDOM () {