Fixed codes not replaced in quotes and issues with inv. spaces
authorAlexander Ebert <ebert@woltlab.com>
Mon, 27 Oct 2014 15:55:48 +0000 (16:55 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 27 Oct 2014 15:55:48 +0000 (16:55 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index ee26a7438677710e63702b82fc86b3c8226f1561..99b285c6b5583366fe6c45dd1ced3025bfeb43cb 100644 (file)
@@ -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(/&#8203;/g, '');
+                       
                        // revert conversion of special characters
                        html = html.replace(/&trade;/gi, '\u2122');
                        html = html.replace(/&copy;/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, '<span class="inlineCode">$1</span>');
-                       }
-                       
-                       // preserve leading whitespaces in [code] tags
-                       data = data.replace(/\[code\][\S\s]*?\[\/code\]/, '<pre>$&</pre>');
-                       
                        // 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, '<span class="inlineCode">$1</span>');
+                       }
+                       
+                       // preserve leading whitespaces in [code] tags
+                       data = data.replace(/\[code\][\S\s]*?\[\/code\]/, '<pre>$&</pre>');
+                       
                        WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'afterConvertToHtml', { data: data });
                        
                        return data;