Improved detection of embedded attachment images
authorAlexander Ebert <ebert@woltlab.com>
Sun, 11 Jan 2015 17:09:25 +0000 (18:09 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 11 Jan 2015 17:09:25 +0000 (18:09 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 58b10c5a5f5f7e3e8ccdbc2250c82dbf71fcd7b2..86fb2236f426d1cf92ae56ff0b99417ea2602a5c 100644 (file)
@@ -504,7 +504,7 @@ RedactorPlugins.wbbcode = function() {
                        html = html.replace(/ ?<img [^>]*?class="smiley" alt="([^"]+?)".*?> ?/gi, ' $1 '); // chrome, ie
                        
                        // attachments
-                       html = html.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)"( style="([^"]+)")?>/gi, function(match, attachmentID, styleTag, style) {
+                       html = html.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)".*?( style="([^"]+)")?.*?>/gi, function(match, attachmentID, styleTag, style) {
                                var $float = 'none';
                                var $width = null;
                                
@@ -533,7 +533,7 @@ RedactorPlugins.wbbcode = function() {
                        });
                        
                        // [img]
-                       html = html.replace(/<img [^>]*?src=(["'])([^"']+?)\1 style="([^"]+)".*?>/gi, function(match, quotationMarks, source, style) {
+                       html = html.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?style="([^"]+)".*?>/gi, function(match, quotationMarks, source, style) {
                                var $float = 'none';
                                var $width = 0;
                                
@@ -557,6 +557,7 @@ RedactorPlugins.wbbcode = function() {
                                
                                return "[img]" + source + "[/img]";
                        });
+                       
                        html = html.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi, '[img]$2[/img]');
                        
                        // [*]