From 530187954921f89bbd88b9461eafe6a8c3392e32 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 27 Oct 2014 16:55:48 +0100 Subject: [PATCH] Fixed codes not replaced in quotes and issues with inv. spaces --- .../js/3rdParty/redactor/plugins/wbbcode.js | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) 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; -- 2.20.1