From: Alexander Ebert Date: Mon, 13 Feb 2017 10:33:22 +0000 (+0100) Subject: Fixed DOM mutation detection X-Git-Tag: 3.0.2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=95b90d90654f6381aa2c84aadb9b1d5c6579dcb0;p=GitHub%2FWoltLab%2FWCF.git Fixed DOM mutation detection --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js index e8b7818599..601722dce3 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js @@ -35,6 +35,32 @@ $.Redactor.prototype.WoltLabEvent = function() { }, 100); }); } + + this.events.iterateObserver = (function(mutation) { + var stop = false; + + // target + // WoltLab modification: do not suppress event if nodes have been added + if (((this.opts.type === 'textarea' || this.opts.type === 'div') + && (!this.detect.isFirefox() && mutation.target === this.core.editor()[0]) && (mutation.type === 'childList' && !mutation.addedNodes.length)) + || (mutation.attributeName === 'class' && mutation.target === this.core.editor()[0]) + ) + { + console.log(mutation, mutation.addedNodes.length); + stop = true; + } + + if (!stop) + { + this.observe.load(); + this.events.changeHandler(); + } + }).bind(this); + + // re-attach the observer + this.events.observer.disconnect(); + this.events.createObserver(); + this.events.setupObserver(); }, _setEvents: function(EventHandler) {