From: Alexander Ebert Date: Mon, 27 Oct 2014 15:55:48 +0000 (+0100) Subject: Fixed codes not replaced in quotes and issues with inv. spaces X-Git-Tag: 2.1.0_Alpha_1~154^2~22 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=530187954921f89bbd88b9461eafe6a8c3392e32;p=GitHub%2FWoltLab%2FWCF.git Fixed codes not replaced in quotes and issues with inv. spaces --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index ee26a74386..99b285c6b5 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -191,6 +191,9 @@ RedactorPlugins.wbbcode = function() { // remove data-redactor-tag="" attribute html = html.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g, '$1'); + // remove zero-width space sometimes slipping through + html = html.replace(/​/g, ''); + // revert conversion of special characters html = html.replace(/™/gi, '\u2122'); html = html.replace(/©/gi, '\u00a9'); @@ -780,20 +783,6 @@ RedactorPlugins.wbbcode = function() { } } - // insert codes - if ($.getLength($cachedCodes)) { - for (var $key in $cachedCodes) { - var $regex = new RegExp('@@' + $key + '@@', 'g'); - data = data.replace($regex, $cachedCodes[$key]); - } - - // [tt] - data = data.replace(/\[tt\](.*?)\[\/tt\]/gi, '$1'); - } - - // preserve leading whitespaces in [code] tags - data = data.replace(/\[code\][\S\s]*?\[\/code\]/, '
$&
'); - // insert quotes if ($cachedQuotes.length) { // [quote] @@ -875,6 +864,20 @@ RedactorPlugins.wbbcode = function() { } } + // insert codes + if ($.getLength($cachedCodes)) { + for (var $key in $cachedCodes) { + var $regex = new RegExp('@@' + $key + '@@', 'g'); + data = data.replace($regex, $cachedCodes[$key]); + } + + // [tt] + data = data.replace(/\[tt\](.*?)\[\/tt\]/gi, '$1'); + } + + // preserve leading whitespaces in [code] tags + data = data.replace(/\[code\][\S\s]*?\[\/code\]/, '
$&
'); + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'afterConvertToHtml', { data: data }); return data;