From d3c72bb835a833d8e446fe797c4f2995b2d09831 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 3 Aug 2014 02:33:03 +0200 Subject: [PATCH] Fixed some minor issues with visual quotes --- .../js/3rdParty/redactor/plugins/wbbcode.js | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index f70ba4b943..c196cf2d8b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -429,7 +429,7 @@ RedactorPlugins.wbbcode = { // trim whitespaces within quote tags html = html.replace(/\[quote([^\]]+)?\](.*?)\[\/quote\]/, function(match, attributes, content) { - return '[quote' + attributes + ']' + $.trim(content) + '[/quote]'; + return '[quote' + (attributes || '') + ']' + $.trim(content) + '[/quote]'; }); // insert codes @@ -439,7 +439,6 @@ RedactorPlugins.wbbcode = { html = html.replace($regex, $cachedCodes[$key]); } } - this.$source.val(html); }, @@ -618,14 +617,13 @@ RedactorPlugins.wbbcode = { return quotedString.replace(/^['"]/, '').replace(/['"]$/, ''); }; - data = data.replace(/\[quote([^\]]+)?\]/gi, function(match, attributes) { - var $quote = '
'; + data = data.replace(/\[quote([^\]]+)?\]/gi, $.proxy(function(match, attributes) { + var $author = ''; + var $link = ''; if (attributes) { attributes = attributes.substr(1); attributes = attributes.split(','); - var $author = ''; - var $link = ''; switch (attributes.length) { case 1: @@ -640,21 +638,20 @@ RedactorPlugins.wbbcode = { $author = WCF.String.escapeHTML($unquoteString($.trim($author))); $link = WCF.String.escapeHTML($unquoteString($.trim($link))); - - $quote = '
'; - $quote += '
' - + '
' - + '

' - + ($link ? '' : '') + WCF.Language.get('wcf.bbcode.quote.title.javascript', { quoteAuthor: WCF.String.unescapeHTML($author) }) + ($link ? '' : '') - + '

' - + '' - + '
'; } - $quote += '
'; - + var $quote = '
' + + '
' + + '
' + + '

' + + this._buildQuoteHeader($author, $link) + + '

' + + '' + + '
' + + '
'; + console.debug($quote); return $quote; - }); + }, this)); data = data.replace(/\[\/quote\]/gi, '
'); data = data.replace(/