When I try to upload a file (image or other type) via the "add media" button in ckeditor. After choosing the file and selecting default format, I only see a generic file icon instead of a linked filename with generic file icon.

Comments

Status:Active» Needs review
StatusFileSize
new813 bytes

in sites/all/modules/contrib/ckeditor/plugins/media/library.js function stripDivs seems to also strip spans (which is wrapper arround the format output) and look for img tag (our generic icon).

I've added a patch, please test & review.

This works for me to give me both the generic icon and linked filename.

On second look, while this works to make the generic icon and linked filename appear and be formatted correctly, it doesn't address the fact that the document is not being tokenized like an image is. The reason the above patch works is because when documents are embedded they are just printed as html. The javascript goes through a step to strip out any surrounding elements around the image, in order to only work with the image element, in order to tokenize it. So, the above works if you don't mind document embeds just being html and not media tokens.

The attached patch includes a method for using the above to keep the plugin from stripping out the filename link, and also converting the document to a media token. It does this by removing the span wrapper and filename link when the editor detaches, and adding back the span wrapper and filename link when the editor attaches.

With this in place, it is then just a matter of working upstream to get the icon and filename link to appear properly when the document is rendered via theme file_link on output to the page. It looks like this may be able to be accomplished by hooking into file_link or media's own hook_media_token_to_markup_alter().

StatusFileSize
new770 bytes

Doesn't work for me. Added a patch for my problem which was that I couldn't show any file at all using the ckeditor together with the media module.

Patch in #3 works great here.

conflict with this ckeditor patch to fix media issue:
https://drupal.org/node/1504696#comment-7719339

Issue summary:View changes

Has anyone got ckeditor + media successfully embedding files/documents other than images?