Needs review
Project:
CKEditor 4 - WYSIWYG HTML editor
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2013 at 15:44 UTC
Updated:
3 Feb 2016 at 20:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
filsterjisah commentedin 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.
Comment #2
kevinchampion commentedThis works for me to give me both the generic icon and linked filename.
Comment #3
kevinchampion commentedOn 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().
Comment #4
isolate commentedDoesn'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.
Comment #5
caktux commentedPatch in #3 works great here.
Comment #6
socialnicheguru commentedconflict with this ckeditor patch to fix media issue:
https://drupal.org/node/1504696#comment-7719339
Comment #7
PI_Ron commentedHas anyone got ckeditor + media successfully embedding files/documents other than images?
Comment #8
wwalc commentedI'd like to encourage everyone to test instead the following code: #2159403: Make CKEditor plugin system modular and clean
Comment #9
hkirsman commentedPI_Ron, got the file embedding working Media dev + Media CKEditor dev + CKEditor dev!