From 3afbe61fc237061596f7e774ae2a15c1a2ecca3e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 26 Apr 2015 15:49:23 +0200 Subject: [PATCH] Fixed expanded formatting in lists --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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'); -- 2.20.1