I'm seeing the error "Drupal.settings.media_format_form is undefined" in my JS console when using the WYSIWYG to add media to a text area. This happens when I move from choosing the file to choosing the format.
The issue seems to be that:
if (Drupal.settings.media_format_form.autosubmit) {
$('.button.fake-ok').click();
}
was left over from the switch to views (or what ever happened). If this code is commented out or removed the error goes away but everything works. At no time in the current code is Drupal.settings.media_format_form every created as an object.
Note, this code is in media.format_form.js
Comments
Comment #1
jarrodirwin commentedI have created a patch that removes this code as I am having a similar issues with it.
When adding video files, the second popup auto-submits and does not allow the user to select a formatter. This is due to the Drupal.settings.media_format_form object being empty and Drupal.settings.media_format_form.autosubmit returning TRUE.
When adding images however, the object is not empty and has autosubmit set to FALSE so it does not auto-submit.
I feel there is a bigger issue here but this is currently needed until that is sorted.
Comment #2
dddave commentedCorrecting status.
Comment #3
idflood commentedI wasn't able to reproduce the issue, probably a mistake on my part. But the patch looks good, and the only reference to an "autosubmit" option is related to the view's exposed form.
I would mark this rtbc without hesitation if I would be able to reproduce the error.
Comment #4
drzraf commentedhit this one too, after applying the patch the process goes a bit further but stop again with:
definitively something wrong.
hints to debug this ?
Comment #5
drzraf commenteda very similar behaviour is described in #1062948: Issue getting Media, Styles and WYSIWYG working together with MediaElement.js
forgot to say that I was trying to insert a PDF file with the media wysiwyg icon and the View library while the "standard" library was not offering this file type (image/audio only).
Comment #6
drzraf commentedstill happen, can reproduce with any formatter which output something else than
<img>.Related: #1261194: Inline Player insertion and WYSIWYG Editor Integration and #1283844: [meta] Improve WYSIWYG integration
[edit] patch #4 of the later, did the trick
Comment #7
andrewbelcher commentedNot sure if this helps anyone else, but I ran into the autosubmit issue. Turns out it's not down to the view. In my case, both media_vimeo and media_youtube were setting the autosubmit, thus breaking that page. Possibly media shouldn't allow the ability to autosubmit as it allows other modules to break core functionality, but if you've got the same issue I've created issues in media_vimeo #1424120: Setting autosubmit breaks core media functionality and media_youtube #1240976: Allow users embedding videos with the insert Media wysiwyg button to pick display format which have patches attached...
Comment #8
devin carlson commentedThe patch in #1 still applies cleanly and removes the ability to automatically submit the form.
To my knowledge this was only ever used as a hack by media players such as YouTube and Vimeo to get around limitations of Media which have since been fixed.
Comment #9
aaron commented#1: remove-legacy-form-autosubmit_1301774_1.patch queued for re-testing.
Comment #11
ParisLiakos commentedreroll
Comment #12
ParisLiakos commentedabout time
http://drupalcode.org/project/media.git/commit/ff6c938
Comment #14
cyberwolf commentedAlso encountering some problems within media 7.x-1.x with the autosubmit code causing JavaScript errors. Attached is a patch for Media 7.x-1.3 which removes it there, using a similar approach as in #11.
Comment #15
dddave commentedHaven't tested it as I don't use the 1.x branch but patches should be against dev.
Comment #16
devin carlson commentedI suppose that this could be backported. Anyone that still desires this functionality should be able to alter it back in.
Comment #17
devin carlson commentedCommitted to Media 7.x-1.x.
Comment #18.0
(not verified) commentedadded a pointer to the js file