From: Alexander Ebert Date: Thu, 7 Sep 2017 10:47:50 +0000 (+0200) Subject: Fixed handling of multiple editor instances X-Git-Tag: 3.1.0_Alpha_3~4^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e5aa9a0acfe5aa6ada5ae7131ffc1c9076a2a3c1;p=GitHub%2FWoltLab%2FWCF.git Fixed handling of multiple editor instances --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabObserve.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabObserve.js index 943eed8e4c..8314670c69 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabObserve.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabObserve.js @@ -83,32 +83,31 @@ $.Redactor.prototype.WoltLabObserve = function() { var editor = this.$editor[0]; if (current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode; - var tagName, tags = []; - while (current !== editor) { - tagName = current.nodeName.toLowerCase(); - if (tags.indexOf(tagName) === -1) { - if (this.opts.activeButtonsStates.hasOwnProperty(tagName)) { - this.button.setActive(this.opts.activeButtonsStates[tagName]); + if (current.closest('.redactor-layer') === editor) { + var tagName, tags = []; + while (current !== editor) { + tagName = current.nodeName.toLowerCase(); + if (tags.indexOf(tagName) === -1) { + if (this.opts.activeButtonsStates.hasOwnProperty(tagName)) { + this.button.setActive(this.opts.activeButtonsStates[tagName]); + } + + // mark as known + tags.push(tagName); } - // mark as known - tags.push(tagName); + current = current.parentNode; } - - current = current.parentNode; } - }).bind(this); this.observe.dropdowns = (function() { var current = this.selection.current(); + if (current && current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode; var editor = this.$editor[0]; - var isRedactor = this.utils.isRedactorParent(current); var tagName, tags = []; - if (current && isRedactor) { - if (current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode; - + if (current && current.closest('.redactor-layer') === editor) { while (current !== editor) { tagName = current.nodeName.toLowerCase(); if (tags.indexOf(tagName) === -1) {