From: Alexander Ebert Date: Sun, 26 Apr 2015 13:49:23 +0000 (+0200) Subject: Fixed expanded formatting in lists X-Git-Tag: 2.1.4~50 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3afbe61fc237061596f7e774ae2a15c1a2ecca3e;p=GitHub%2FWoltLab%2FWCF.git Fixed expanded formatting in lists --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 6719d5a471..2d4263cc48 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -958,10 +958,20 @@ RedactorPlugins.wbbcode = function() { } // [*] + var $hasListItems = false; data = data.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi, function(match, content) { + $hasListItems = true; + return '
  • ' + $.trim(content) + '
  • '; }); + // fix expanded formatting for lists + if ($hasListItems) { + data = data.replace(/(

    )(\[list[^\]]*\])?

  • /g, '$2
  • $1'); + data = data.replace(/(

    )<\/li>

  • /g, '
  • $1'); + data = data.replace(/(<\/li>\[\/list\])<\/p>/g, '$1'); + } + // fix superflous newlines with nested lists data = data.replace(/\n*(\[list\]<\/li>)/g, '$1');