From: Alexander Ebert Date: Fri, 6 Oct 2017 10:44:08 +0000 (+0200) Subject: Cleanup of superfluous whitespaces after pasting X-Git-Tag: 3.0.10~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=83ea2e6fd31337d9a67658aa92f2072a30724ece;p=GitHub%2FWoltLab%2FWCF.git Cleanup of superfluous whitespaces after pasting --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index f0de39ad39..55f876316f 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -236,6 +236,18 @@ $.Redactor.prototype.WoltLabPaste = function() { }).bind(this), 50); } + // cleanup any stray text fragments caused by paragraphs + // being replaced by the clipboard contents + var node, badNodes = []; + var editor = this.core.editor()[0]; + for (i = 0, length = editor.childNodes.length; i < length; i++) { + node = editor.childNodes[i]; + if (node.nodeType === Node.TEXT_NODE && node.textContent === '\u200B') { + badNodes.push(node); + } + } + badNodes.forEach(elRemove); + this.rtePaste = false; }).bind(this);