From: Alexander Ebert Date: Sat, 27 Dec 2014 13:46:07 +0000 (+0100) Subject: There are two different methods causing empty text nodes X-Git-Tag: 2.1.0_Beta_3~70 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d31b1307ab73f08cff9a828025588c825ed7f117;p=GitHub%2FWoltLab%2FWCF.git There are two different methods causing empty text nodes --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 7043fbd9a2..d5b757fc80 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -797,16 +797,24 @@ RedactorPlugins.wmonkeypatch = function() { * - remove superflous empty text nodes caused by the selection markers (#2083) */ selection: function() { + var $removeEmptyTextNodes = function(index, marker) { + var $nextSibling = marker.nextSibling; + if ($nextSibling !== null && $nextSibling.nodeType === Node.TEXT_NODE && $nextSibling.length === 0) { + $($nextSibling).remove(); + } + + $(marker).remove(); + }; + // selection.removeMarkers this.selection.removeMarkers = (function() { - this.$editor.find('span.redactor-selection-marker').each(function(index, marker) { - var $nextSibling = marker.nextSibling; - if ($nextSibling !== null && $nextSibling.nodeType === Element.TEXT_NODE && $nextSibling.length === 0) { - $($nextSibling).remove(); - } - - $(marker).remove(); - }); + this.$editor.find('span.redactor-selection-marker').each($removeEmptyTextNodes); + }).bind(this); + + // selection.removeNodesMarkers + this.selection.removeNodesMarkers = (function() { + $(document).find('span.redactor-nodes-marker').each($removeEmptyTextNodes); + this.$editor.find('span.redactor-nodes-marker').each($removeEmptyTextNodes); }).bind(this); },