From 05d8e4b162e582786d7bf7e3f7260de3d74d082d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 31 Mar 2015 13:36:57 +0200 Subject: [PATCH] Fixed some regex being too greedy --- .../install/files/js/3rdParty/redactor/plugins/wbbcode.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 039e3f9514..46204aea26 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -290,7 +290,7 @@ RedactorPlugins.wbbcode = function() { // preserve code listings var $cachedCodeListings = { }; - html = html.replace(/\n*
[\s\S]+?
    ([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g, function(match, codeBoxAttributes1, codeBoxAttributes2, lineNumber, codeContent) { + html = html.replace(/]+?)class="codeBox[^"]+"([^>]*?)>\n*
    [\s\S]+?
      ([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g, function(match, codeBoxAttributes1, codeBoxAttributes2, lineNumber, codeContent) { var $attributes = codeBoxAttributes1 + ' ' + codeBoxAttributes2; var $highlighter = ''; var $filename = ''; @@ -616,7 +616,7 @@ RedactorPlugins.wbbcode = function() { html = html.replace(/ ?]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi, ' $1 '); // chrome, ie // attachments - html = html.replace(//gi, function(match, attributesBefore, attributesAfter) { + html = html.replace(/]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi, function(match, attributesBefore, attributesAfter) { var $attributes = attributesBefore + ' ' + attributesAfter; var $attachmentID; if ($attributes.match(/data-attachment-id="(\d+)"/)) { @@ -654,7 +654,7 @@ RedactorPlugins.wbbcode = function() { }); // [img] - html = html.replace(/]*?src=(["'])([^"']+?)\1.*?style="([^"]+)".*?>/gi, function(match, quotationMarks, source, style) { + html = html.replace(/]*?src=(["'])([^"']+?)\1[^>]*?style="([^"]+)"[^>]*?>/gi, function(match, quotationMarks, source, style) { var $float = 'none'; var $width = 0; @@ -679,7 +679,7 @@ RedactorPlugins.wbbcode = function() { return "[img]" + source + "[/img]"; }); - html = html.replace(/]*?src=(["'])([^"']+?)\1.*?>/gi, '[img]$2[/img]'); + html = html.replace(/]*?src=(["'])([^"']+?)\1[^>]*?>/gi, '[img]$2[/img]'); // [*] html = html.replace(/
    1. /gi, '[*]'); -- 2.20.1