From 1b0b8480610cdd3f13254488e437a9f0f71bf18f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 30 Mar 2015 13:20:59 +0200 Subject: [PATCH] Fixed a few issues --- .../js/3rdParty/redactor/plugins/wbbcode.js | 4 ++-- .../files/js/3rdParty/redactor/plugins/wutil.js | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 06718ba9aa..039e3f9514 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -27,7 +27,7 @@ RedactorPlugins.wbbcode = function() { // use stored editor contents var $content = $.trim(this.wutil.getOption('woltlab.originalValue')); if ($content.length) { - this.wutil.replaceText($content, false); + this.wutil.replaceText($content); // ensure that the caret is not within a quote tag this.wutil.selectionEndOfEditor(); @@ -877,7 +877,7 @@ RedactorPlugins.wbbcode = function() { // [s] data = data.replace(/\[s\]([\s\S]*?)\[\/s]/gi, (function(match, content) { - return this.wbbcode._expandFormatting(content, '', ''); + return this.wbbcode._expandFormatting(content, '', ''); }).bind(this)); // [sub] diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 813d1407d1..302b302d19 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -884,9 +884,8 @@ RedactorPlugins.wutil = function() { * Replaces the current content with the provided value. * * @param string value - * @param boolean addNewlines */ - replaceText: function(value, addNewlines) { + replaceText: function(value) { var $document = $(document); var $offsetTop = $document.scrollTop(); var $wasInWysiwygMode = false; @@ -896,10 +895,7 @@ RedactorPlugins.wutil = function() { $wasInWysiwygMode = true; } - if (addNewlines !== false) { - value = this.wutil.addNewlines(value); - } - + value = this.wutil.addNewlines(value); this.$textarea.val(value); if ($wasInWysiwygMode) { @@ -1017,6 +1013,15 @@ RedactorPlugins.wutil = function() { continue; } + if ($child.innerHTML === "\n") { + $child.parentElement.removeChild($child); + + $i--; + $length--; + + continue; + } + if ($child.textContent.length > 0) { // element is non-empty continue; -- 2.20.1