From 95b90d90654f6381aa2c84aadb9b1d5c6579dcb0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 13 Feb 2017 11:33:22 +0100 Subject: [PATCH] Fixed DOM mutation detection --- .../redactor2/plugins/WoltLabEvent.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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) { -- 2.20.1