The patch in #22 of #2317519: Blank WYSIWYG with existing multiple Media content eliminated the JavaScript error I was getting (something about the source variable not being set) that was causing Ckeditor not to load properly in the Summary of the Node Body when an image had been added and saved.

However, now when I add an image, save, and then edit the node again, the token appears in the view mode of Ckeditor. If I toggle source mode, the token appears encoded with HTML entity quotes: "
If I click save again, the image will stop appearing in the summary when the node is viewed.

In Ckeditor, I have the Media button on my toolbar, and the Entity Embed buttons not added. For plugins, I have the following enabled: Plugin for inserting images from Drupal media module, Plugin for inserting embeded media, Plugin to count symbols, symbols without blanks and words, Plugin for inserting Drupal teaser and page breaks. Also, ACF is turned off. Under Advanced, I have HTML Entities set to "Yes", and Custom JS is set to: config.emailProtection = 'encode'; config.allowedContent = true;

In the corresponding Text Format I have (in this exact order):
-Convert URLs into links
-Convert all characters to US-ASCII
-Convert Media tags to markup
-Correct faulty and chopped off HTML

Drupal 7.37
Install profile Commons (commons-7.x-3.26)
CKEditor (library) 4.4.7
jQuery 1.7
CKEditor - WYSIWYG HTML editor 7.x-1.16
Media 7.x-2.0-alpha4+37-dev (2015-May-12)
I have the Commons Images feature disabled.

I spent a few hours browsing through issues on here looking for a solution but couldn't find a solution that worked. The patch here looked promising but didn't seem to do anything for me: https://www.drupal.org/node/2028253#comment-9569105

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jlea9378’s picture

jlea9378’s picture

Issue summary: View changes
brockfanning’s picture

Status: Active » Needs review
FileSize
826 bytes

I'm not sure if this fixes the same issue you're having, but it seems like a possibility. This adds a bit of support for Ckeditor (specifically, it does an encodeURIComponent() on the Ckeditor input, if available.) It's a shame to add Ckeditor-specific code to this module, since media_ckeditor is now a separate project. However, at this moment it's not clear to me how I could hook into this logic from outside the module.

brockfanning’s picture

Just a note that I also posted a patch for this same fix, but as done from the media_ckeditor project. I'm not sure which is a more sensible place for it. That issue is: #2720997: Overridden fields not encoded in token

othermachines’s picture

I'm experiencing a very similar problem after applying patch in #2317519: Blank WYSIWYG with existing multiple Media content. The difference is that the token is only encoded in the rich text editor and so there are no adverse effects when saving.

Not serious, but a wee bit confusing.

Unfortunately the patch in #3 doesn't resolve it.

media 7.x-2.0-beta1+10-dev
media_ckeditor 7.x-2.0-alpha1+4-dev

othermachines’s picture

Ah, this comment explains it: #2317519-45: Blank WYSIWYG with existing multiple Media content

Edit: Except ... not. My media token is being improperly rendered in rich text, but is saving just fine (even without the fix suggested in the next comment #2317519-46: Blank WYSIWYG with existing multiple Media content.

Pardon me. My head is spinning from all of the inter-related issues.

brockfanning’s picture

othermachines, could you paste in some examples of what you're running into? I'm not sure what you mean be "the token is only encoded in the rich text editor and so there are no adverse effects when saving".

othermachines’s picture

Sorry if that wasn't clear. The token doesn't render as HTML in rich text, but just appears as a token. I guess that doesn't necessarily mean it's encoded (I must be conflating tokens/HTML tags).

brockfanning’s picture

Ok cool, now what are the steps you're taking to get to that point?

othermachines’s picture

Moved my issue over to #2317519-48: Blank WYSIWYG with existing multiple Media content. Sorry for the noise.

brockfanning’s picture

I'm no longer suggesting my patch here be used. Instead I'm investigating solving my problem in the Media Ckeditor module, in: #2720997: Overridden fields not encoded in token. I'll leave this open as I suspect my problem was different from the original issue here.

But FWIW, I haven't run into the original issue. @jlea9378 did you ever resolve this or find a workaround?

brockfanning’s picture

Status: Needs review » Closed (cannot reproduce)

Closing this, as this has been fixed in other issues.