When media_youtube is enabled, users can't choose the media format (Link, Preview, Small, Large, Original, etc) when embedding video in WYSIWYG textareas using the media filter. Is there a reason why users should not be able to choose the size of their embedded YouTube videos? It seems like the 'autosubmit' behavior was intentionally enabled, but it's not clear why.
I would prefer that users have the opportunity to choose the media format, so I've attached a patch that removes the autosubmit behavior from the format dialog.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | media_youtube-fix_autosubmit-1240976-14.patch | 669 bytes | RobW |
| #10 | media_youtube-fix_autosubmit-1240976-10.patch | 530 bytes | lucascaro |
| #10 | media_youtube-fix_autosubmit-1240976-10-b.patch | 1.47 KB | lucascaro |
| #5 | media_youtube-fix-autosubmit.patch | 511 bytes | andrewbelcher |
Comments
Comment #1
ar-jan commentedIs the autosubmit behavior defined only in code? I'm not seeing any setting for this in the UI.
Being able to select a media format for display, like with images, is quite important imo.
Comment #2
stijndm commentedI had a look at this yesterday. It's hardcoded in the module. I did a quick test by removing the code. I would then get format selection form but, some formats won't submit (javascript errors: missing attributes, meaning nothing is set for that format). Those formats that would submit only showed an icon or a link. So I'm guessing that is the reason for the autosubmit.
Good to know: I was also using the media_vimeo module (which has the same code, which I also removed) and the mediaelement module for videos.
Some observations:
- Submit failure (javascript errors) seemed to occur on displays that had the youtube, vimeo, mediaelement formatters enabled.
- If I used one of the other displays it would insert an html link or image instead of a media token with formatter settings.
- If I would add a video formatter to one of the 'working' displays it would become unusable in the format selection (javascript errors)
- some other stuff I can't seem to remember
So it seems there is quite a lot to look at before we can remove the autosubmit code.
Comment #3
victoriachan commentedHi,
Can someone attach the patch please? Did becw forget to attach the patch? I can't seem to see it on this page.
Thanks,
Victoria
Comment #4
jkaine commentedI ran into the same issue, and on a site with a tight deadline. Ended up using CSS styles to reset the width and height-- via the CKeditor styles menu.
Running short on time here. The gist of the CSS controls can be found here: http://drupal.org/node/1244372
If any of you want more on this, let me know.
Comment #5
andrewbelcher commentedI would say this is critical as it renders one of the key features of core media un-usable. I've created an issue in the media_vimeo queue with a patch, and here is a patch for media_youtube...
Comment #6
stijndm commentedI believe the submitted patch in #5 is insufficient. I tried this a couple of months back (#2). The only thing the patch did for me was preventing the autosubmit. The steps afterwards, and properly inserting and rendering the video are then broken.
(This was together with the media_vimeo and mediaelement projects. And heavily configured media diplays.)
Comment #7
andrewbelcher commentedAfter applying the patch above, I seemed to be able to insert things properly. It might be that you're experiencing a related issue which is that if the code that get's rendered doesn't include an img tag (for example if you only have the embed as an rendering method in file display), then WYSIWYG cannot handle it... I think that is what #1062948: Issue getting Media, Styles and WYSIWYG working together with MediaElement.js is about... At least in part (comment 6 was the issue I had).
Comment #8
stijndm commentedAllright, thanks for the heads up on the issues with MediaElement. I always assumed it was a media_youtube/vimeo issue because submitting the worked when I selected a custom uploaded video (although formatting was wrong).
I'll keep an eye on the related issues, see where this goes. When I have time, I'll try this patch on a vanilla media + media_youtube install, see what happens.
Comment #9
RobW commentedI believe the reason for the autosubmit is to prevent problems with wysiwyg embedding described in #1283844: [meta] Improve WYSIWYG integration. I think we have to postpone this until the Media issue is resolved.
Comment #10
lucascaro commentedIn case it helps anyone, here's the patch re-rolled against the current -dev.
I am getting the following errors though:
That error is due to $variables['options']['attributes']['class'] being = to "media-image" and not an array.
In the following line:
That could be changed to
and that removes the error, but a safer option would be
What do you think?
The second patch (media_youtube-fix_autosubmit-1240976-10-b.patch) contains both changes mentioned above and seems to work on my development site.
Comment #11
RobW commentedThanks for the re-roll, lucascaro. There's an issue for those errors at #1797668: Errors when embedding youtube video with media_youtube & tinymce 'media' plugin; your last snippet is exactly the code I suggested there, just haven't had time to test before committing.
Comment #12
RobW commentedLet's give this some testing.
Comment #13
lucascaro commentedFWIW I'm using it and so far there seem to be no problems with the patch. Will report back if I find anything. :)
Comment #14
RobW commentedSince the default for autosubmit is false, I believe we can take the whole hook out.
Comment #15
lucascaro commented+1
With #1797668: Errors when embedding youtube video with media_youtube & tinymce 'media' plugin committed, #14 is the only thing missing to get this working :)
Comment #16
lucascaro commentedalso confirming that appliyig this patch to f2a44ea works as expected.
Comment #17
RobW commentedCommitted: http://drupalcode.org/project/media_youtube.git/commit/825d80b. Thanks to everyone who contributed and Lucas in particular for the cross post debugging and speedy testing.