From 50e939dd16de6b4f67f276faf84d16195b36de97 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 10 Feb 2015 14:09:15 +0100 Subject: [PATCH] Proper cleanup of incorrectly used lists --- .../js/3rdParty/redactor/plugins/wbbcode.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 15dd5ae06c..2ec6061dc4 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -826,6 +826,27 @@ RedactorPlugins.wbbcode = function() { // [align] data = data.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'
$2
'); + // search for [*] not preceeded by [list by searching for the first occurence of [list and then check the left + var $firstList = data.indexOf('[list'); + if ($firstList > 0) { + var $tmp = data.substr(0, $firstList); + $tmp = $tmp.replace(/\[\*\]/g, ''); + data = $tmp + data.substr($firstList); + } + + // search for [*] not followed by [/list] + var $lastList = data.indexOf('[/list]'); + if ($lastList === -1) { + // drop all [list*] and [*] + data = data.replace(/\[\*\]/g, ''); + data = data.replace(/\[list[^\]]*\]/g, ''); + } + else { + var $tmp = data.substr($lastList + 7); + $tmp = $tmp.replace(/\[\*\]/g, ''); + data = data.substr(0, $lastList + 7) + $tmp; + } + // [*] data = data.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi, function(match, content) { return '
  • ' + $.trim(content) + '
  • '; -- 2.20.1