From ff810213f114b5438e9b35e2e2044d0951a328a4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 28 Nov 2014 01:23:54 +0100 Subject: [PATCH] Fixed issue with quote detection in Opera 12.17 --- .../js/3rdParty/redactor/plugins/wbbcode.js | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 2528d3855d..422306dd6d 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -193,6 +193,9 @@ RedactorPlugins.wbbcode = function() { convertFromHtml: function(html) { WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'beforeConvertFromHtml', { html: html }); + $('
').text(html).appendTo(document.body);
+			
+			console.debug(html);
 			// remove data-redactor-tag="" attribute
 			html = html.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g, '$1');
 			
@@ -281,17 +284,24 @@ RedactorPlugins.wbbcode = function() {
 			html = html.replace(/ /gi, " ");
 			
 			// [quote]
-			html = html.replace(/
]*?>\n?]+>\n?]*?>[\s\S]*?<\/header>/gi, function(match, link, author, innerContent) { + html = html.replace(/]+)>\n?]+>\n?]*?>[\s\S]*?<\/header>/gi, function(match, attributes, innerContent) { var $quote; + var $author = ''; + var $link = ''; - if (author) author = WCF.String.unescapeHTML(author); - if (link) link = WCF.String.unescapeHTML(link); + if (attributes.match(/data-author="([^"]+)"/)) { + $author = WCF.String.unescapeHTML(RegExp.$1); + } - if (link) { - $quote = "[quote='" + author + "','" + link + "']"; + if (attributes.match(/cite="([^"]+)"/)) { + $link = WCF.String.unescapeHTML(RegExp.$1); + } + + if ($link) { + $quote = "[quote='" + $author + "','" + $link + "']"; } else if (author) { - $quote = "[quote='" + author + "']"; + $quote = "[quote='" + $author + "']"; } else { $quote = "[quote]"; -- 2.20.1