I am unable to insert media to a wysiwyg editor, because the submit button seems broken, on the last step to insert the media.

To reproduce:

-Install Media and File entity modules
-Install wysiwyg API and editor of choice (I use CKeditor)
-Add media button to editor
-Go to node/add/
-Press media button to instert/upload media
-Upload a file (I used a pdf)
-Pick the uploaded document in the media library
-On the modal titled "Embedding ", try to hit "Submit" -> Nothing happens

Firebug reports this js error:

imgElement is undefined
http://drupal79.dev/sites/all/modules/media/js/wysiwyg-media.js?ly5dsw
Line 195

Comments

adamgerthel’s picture

Title: Can't click submit » Can't click submit when adding file (not image)

Updated issue title to better reflect issue. It works using images.

adamgerthel’s picture

Issue summary: View changes

added more info

Marc-Antoine’s picture

Status: Active » Closed (duplicate)

That is because the Wysiwyg isn't meant (yet) to insert media types other than image, I've read in other subjects that it was hard coded that way (will try to find the source)

The bug here is that the wysiwyg still shows the other media types, as described in

Respect file type restrictions in media browser library view

and

'Allowed file types' rubric in wysiwyg upload interface is wrong

finally, i'll mark this bug a duplicate, because if you want more than one type of media to be added using the wysiwyg, this issue already exists:

Expose the media types allowed for WYSIWYG variable in the UI

drzraf’s picture

Version: 7.x-2.0-unstable3 » 7.x-2.x-dev
Component: User interface » WYSIWYG integration
Priority: Normal » Major
Status: Closed (duplicate) » Active
StatusFileSize
new636 bytes
new517 bytes

I tried to inline a PDF file as a simple link, using the default full view mode of the application file type (used for PDF).
In the format form the submit button is indeed buggy because imgElement is empty.

However, the markup (formattedMedia) is like :
<span class="file"><img class="file-icon" alt="" title="application/pdf" src="/modules/file/icons/application-pdf.png" /> <a href="URL" type="application/pdf; length=SIZE"> FILENAME </a></span>

That's what I would expect to see into the wysiwyg area (using tinymce).
The problem here is that var imgElement = $(this.stripDivs(formattedMedia)); fails miserably (or works as intended). I'm left with a simple PDF file icon.

Obvious fix : remove the workaround for ckeditor : 1412460-3-p1.patch

Then comes a second problem :
Activate the link file format to the application file type (renders the plain text file URL) => the format form is unable to bring anything to the textarea again.

fix : test for markup; if there isn't then use the text (in a span) : 1412460-3-p2.patch (above patch implied).

I still don't see why such kind of patches would have to wait for #1016376: Expose the media types allowed for WYSIWYG variable in the UI, #1037234: 'Allowed file types' rubric in wysiwyg upload interface is wrong or #1293908: Respect file type restrictions in media browser library view.

devin carlson’s picture

Status: Active » Closed (duplicate)

As mentioned in #3, Media's WYSIWYG integration currently only works with images. This limitation is currently being discussed at #1283844: [meta] Improve WYSIWYG integration and is being worked on in #1451316: Clean up wysiwyg-media.js.

devin carlson’s picture

Issue summary: View changes

Fixed a typo

loopy1492’s picture

Switching to an earlier version of jQuery in my Administration theme did the trick. I switched to 1.7. YMMV.

/admin/config/development/jquery_update