From 49260242c329ca103be4e637f71a52abbaf65d60 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Dec 2016 12:40:17 +0100 Subject: [PATCH] Fixed newline handling on paste --- .../files/js/3rdParty/redactor2/plugins/WoltLabClean.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js index 40070d235f..687ecbc4fb 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js @@ -150,7 +150,7 @@ $.Redactor.prototype.WoltLabClean = function() { }); elBySelAll('br', div, function (br) { - br.parentNode.insertBefore(document.createTextNode('@@@WOLTLAB-BR-MARKER@@@'), br); + br.parentNode.insertBefore(document.createTextNode('@@@WOLTLAB-BR-MARKER@@@'), br.nextSibling); }); html = mpOnPaste.call(this, div.innerHTML, data, insert); @@ -167,14 +167,13 @@ $.Redactor.prototype.WoltLabClean = function() { while (marker.nextSibling) { p.appendChild(marker.nextSibling); } - p.appendChild(elCreate('br')); - parent.parentNode.insertBefore(p, parent.nextSibling); - - var previous = marker.previousElementSibling; + var previous = marker.previousSibling; if (previous && previous.nodeName === 'BR') { elRemove(previous); } + + parent.parentNode.insertBefore(p, parent.nextSibling); } else { parent.insertBefore(elCreate('br'), marker); -- 2.20.1