From 4115e3c9ab2776e3df96ca3c262345685e804af4 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 25 Oct 2020 20:58:57 +0100 Subject: [PATCH] Fixed: Destroy popup when upload has failed --- formwidgets/responsiveimage/assets/src/popup.mixin.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/formwidgets/responsiveimage/assets/src/popup.mixin.js b/formwidgets/responsiveimage/assets/src/popup.mixin.js index 0a52646..dd986de 100644 --- a/formwidgets/responsiveimage/assets/src/popup.mixin.js +++ b/formwidgets/responsiveimage/assets/src/popup.mixin.js @@ -18,15 +18,13 @@ export default { values: { crop: null } }; - if ($(`#${this.popupId}`).length == 0) { - $('body').append(this.popupContent); - } + $('body').append(this.popupContent); return new Promise((resolve, reject) => { var $popup = $(`#${this.popupId}`); $popup.modal({ backdrop: false }); - $popup.on('shown.bs.modal', function() { + $popup.one('shown.bs.modal', function() { var $cropContainer = $popup.find('[data-jcrop]'); var imageElement = new Image(); @@ -60,7 +58,7 @@ export default { }); $popup.off('hidden.bs.modal').one('hidden.bs.modal', () => { - $popup.modal('hide'); + $popup.remove(); reject(null); });