Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There seems to be an issue with embedding some provider content such as Twitter and Facebook from the media browser in the wysiwyg. When attempting to insert the media item from the media browser on the view mode selection pop up I'm getting the following js error: Uncaught TypeError: Cannot read property 'match' of undefined, which prevents me from submitting the form. See attached screenshot. The error is produced from css.match in the following code:
if (info.view_mode) {
// Remove any existing view mode classes.
element.removeClass (function (index, css) {
return (css.match (/\bfile-\S+/g) || []).join(' ');
});
classes.push('file-' + info.view_mode.replace(/_/g, '-'));
}
// Check for alignment info, after removing any existing alignment class.
element.removeClass (function (index, css) {
return (css.match (/\bmedia-wysiwyg-align-\S+/g) || []).join(' ');
});
I'm not quite sure how to get around this limitation.
Comment | File | Size | Author |
---|---|---|---|
Screen Shot 2017-04-25 at 2.28.44 PM.png | 215.02 KB | adam-delaney |
Comments
Comment #2
adam-delaney CreditAttribution: adam-delaney at The University of Iowa commentedComment #3
adam-delaney CreditAttribution: adam-delaney at The University of Iowa commentedThere are actually 2 offending lines in media_wysiwyg.filter.js in the media module that prevents the form submission for the media browser for certain providers. Both are returning the same error.
Comment #4
Devin Carlson CreditAttribution: Devin Carlson commentedThis code lives in the Media module, not Media: oEmbed.
Comment #5
joseph.olstadthis might be fixed in the latest release. 7.x-2.8 or maybe 7.x-2.6
Comment #6
almunningsThis can be replicated by turning $conf['theme_debug'] to true inside settings.php
Seems in media_wysiwyg.filter.js, element = element.children(); is picking up the comments and text nodes.
Comment #7
joseph.olstadThanks!
Comment #8
joseph.olstadGenerally, theme debug turned on is only used for debugging, expect some advanced functionality to break.
Workaround is to disable theme debug as mentioned. You should NEVER have this enabled on a production site unless momentarily, normally you'd do the debugging on a development copy of the site.
Comment #10
criznach CreditAttribution: criznach as a volunteer commentedI'm still seeing this in the latest 7.x-2.18+1-dev. I do not set $conf['theme_debug'], and drush shows the default of FALSE
drush vget theme_debug
theme_debug: false
media_wysiwyg.filter.js?p7stfi:287 Uncaught TypeError: Cannot read property 'match' of undefined
at Comment. (media_wysiwyg.filter.js?p7stfi:287)
at Comment. (jquery.min.js?v=1.5.2:16)
at Function.each (jquery.min.js?v=1.5.2:16)
at $.fn.init.each (jquery.min.js?v=1.5.2:16)
at $.fn.init.removeClass (jquery.min.js?v=1.5.2:16)
at Object.create_element (media_wysiwyg.filter.js?p7stfi:286)
at Object.replaceTokenWithPlaceholder (media_wysiwyg.filter.js?p7stfi:60)
at Object.attach (wysiwyg-media.js?p7stfi:77)
at CKEDITOR.htmlDataProcessor.toHtml (ckeditor-3.0.js?p7stfi:100)
at $.setData (ckeditor.js?p7stfi:774)