From 753b75b528c2678f167c6c476788b98b683925c9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 10 Mar 2015 17:53:19 +0100 Subject: [PATCH] Fixed handling of empty list items / code-bbcode --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 11 ++++++++--- .../files/js/3rdParty/redactor/plugins/wutil.js | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index adfee4506d..ce12a62483 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1301,7 +1301,7 @@ RedactorPlugins.wbbcode = function() { //$value = $value.replace(/^\[tt\](.*)\[\/tt\]/, '$1'); // [code] - $value = $value.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/, function(matches, parameters, content) { + $value = $value.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/, (function(matches, parameters, content) { var $highlighter = 'plain'; var $lineNumber = 0; var $filename = ''; @@ -1359,7 +1359,12 @@ RedactorPlugins.wbbcode = function() { content = content.replace(/^\n+/, '').replace(/\n+$/, '').split(/\n/); var $lines = ''; for (var $i = 0; $i < content.length; $i++) { - $lines += '
  • ' + content[$i] + '
  • '; + var $line = content[$i]; + if (!$line.length) { + $line = this.opts.invisibleSpace; + } + + $lines += '
  • ' + $line + '
  • '; } return '
    ' @@ -1372,7 +1377,7 @@ RedactorPlugins.wbbcode = function() { + '' + '
    ' + ''; - }); + }).bind(this)); data = data.replace($regex, $value); } diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index e80a5e1e46..7a9b9dc92f 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -996,6 +996,10 @@ RedactorPlugins.wutil = function() { var $parent = $listItem.parentElement; if ($parent.children.length > 1) { $listItem.parentElement.removeChild($listItem); + + // node list is live + $i--; + $length--; } } } -- 2.20.1