bugfix: linkPreview - remove s flag from regexp because FF don't support it
authorrabuzarus <rabuzarus@t-online.de>
Wed, 13 Feb 2019 14:14:56 +0000 (15:14 +0100)
committerrabuzarus <rabuzarus@t-online.de>
Wed, 13 Feb 2019 14:14:56 +0000 (15:14 +0100)
view/js/linkPreview.js

index 194ab64..09583ae 100644 (file)
                var getAttachmentData = function(content) {
                        var data = {};
 
-                       var match = content.match(/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism);
+                       var match = content.match(/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/im);
                        if (match === null || match.length < 5) {
                                return null;
                        }
                        data.text = trim(match[1]);
 
                        var type = '';
-                       var matches = attributes.match(/type='(.*?)'/ism);
+                       var matches = attributes.match(/type='(.*?)'/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                type = matches[1].toLowerCase();
                        }
 
-                       matches = attributes.match(/type="(.*?)"/ism);
+                       matches = attributes.match(/type="(.*?)"/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                type = matches[1].toLowerCase();
                        }
 
                        var url = '';
 
-                       matches = attributes.match(/url='(.*?)'/ism);
+                       matches = attributes.match(/url='(.*?)'/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                url = matches[1].toLowerCase();
                        }
 
-                       matches = attributes.match(/url="(.*?)"/ism);
+                       matches = attributes.match(/url="(.*?)"/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                url = matches[1].toLowerCase();
                        }
 
                        var title = '';
 
-                       matches = attributes.match(/title='(.*?)'/ism);
+                       matches = attributes.match(/title='(.*?)'/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                title = matches[1].toLowerCase();
                        }
 
-                       matches = attributes.match(/title="(.*?)"/ism);
+                       matches = attributes.match(/title="(.*?)"/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                title = matches[1].toLowerCase();
                        }
 
                        var image = '';
 
-                       matches = attributes.match(/image='(.*?)'/ism);
+                       matches = attributes.match(/image='(.*?)'/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                image = matches[1].toLowerCase();
                        }
 
-                       matches = attributes.match(/image="(.*?)"/ism);
+                       matches = attributes.match(/image="(.*?)"/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                image = matches[1].toLowerCase();
                        }
 
                        var preview = '';
 
-                       matches = attributes.match(/preview='(.*?)'/ism);
+                       matches = attributes.match(/preview='(.*?)'/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                preview = matches[1].toLowerCase();
                        }
 
-                       matches = attributes.match(/preview="(.*?)"/ism);
+                       matches = attributes.match(/preview="(.*?)"/im);
                        if (matches !== null && typeof matches[1] !== 'undefined') {
                                preview = matches[1].toLowerCase();
                        }
                        if (attachmentData) {
                                reAddAttachment(attachmentData);
                                // Remove the attachment bbcode from the textarea.
-                               var content = content.replace(/\[attachment.*\[\/attachment]/ism, '');
+                               var content = content.replace(/\[attachment.*\[\/attachment]/im, '');
                                $('#' + selector).val(content);
                                $('#' + selector).focus();
                        }