Properly removing dialogs from DOM (the editor can quickly spawn lots of them)
authorAlexander Ebert <ebert@woltlab.com>
Sun, 18 Jan 2015 11:08:38 +0000 (12:08 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 18 Jan 2015 11:08:38 +0000 (12:08 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 89676dafe408f6ca2b6403cc59db9fbddc7b0e1c..6d0fcdfa4afc757cb4fd01b695acadc07067804e 100644 (file)
@@ -840,9 +840,18 @@ RedactorPlugins.wmonkeypatch = function() {
                                
                                try {
                                        this.modal.dialog.wcfDialog('close');
-                                       this.modal.dialog.remove();
                                }
-                               catch (e) { }
+                               catch (e) {
+                                       // ignore
+                               }
+                               finally {
+                                       var $container = this.modal.dialog.parents('.dialogContainer:eq(0)');
+                                       if ($container.length) {
+                                               setTimeout(function() {
+                                                       $container.remove();
+                                               }, 500);
+                                       }
+                               }
                                
                                this.modal.dialog = null;
                        }).bind(this);