From: Alexander Ebert Date: Tue, 10 Mar 2015 16:53:19 +0000 (+0100) Subject: Fixed handling of empty list items / code-bbcode X-Git-Tag: 2.1.2~63 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=753b75b528c2678f167c6c476788b98b683925c9;p=GitHub%2FWoltLab%2FWCF.git Fixed handling of empty list items / code-bbcode --- 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--; } } }