I have a website that has a lot of images added to the text fields with Media Ckeditor. Suddenly I got a message from the customer that the images doesn't show up anymore in the edit form, instead it's showing only the media tags ([[{type:media... ]]). So I thought that maybe something was broken after upgrading to the latest versions of Media and Media Ckeditor (everything seemed fine after upgrading, but we propably just didn't check any pages that had these images in the text field, there is 1200+ nodes in the site). Oddly enough, whenever an image is first added, it shows it properly, but after saving the entity and going back to edit the field, it only shows the media tag. In the dev environment I reverted back to the old versions of Media (version 7.x-2.0-beta2, no patches) and Media Ckeditor (version 7.x-2.0-alpha1, patches https://www.drupal.org/files/issues/cannot_put_link_on_an-2707107-29.patch, https://www.drupal.org/files/issues/ckeditor_converting-2707177-2.patch, https://www.drupal.org/files/issues/media-ckeditor4-media-plugin-2177893..., https://www.drupal.org/files/issues/open_media_popup_on-2713757-2.patch, https://www.drupal.org/files/issues/the_toolbar_button_does-2710841-8.patch) and everything was fine again (after several times of clearing the cache and pulling some hair meanwhile as well...). I have now tried 3 times to upgrade and then downgrade again, and the new versions just don't work.

Is there anyone having a similar problem? There are *a lot* of other modules in this site, so I don't know if something is messing up the js or something.

Comments

LauraRocks created an issue. See original summary.

joseph.olstad’s picture

Status: Active » Needs review

this is likely configuration related..

to fix this you should review brock fannings recipe

Co-incidentally I'd like to make a new recipe using
//cdn.ckeditor.com/4.5.4/full-all or //cdn.ckeditor.com/4.5.11/full-all which I've tried out and seem to work well so far.

the ckeditor specified by recipe 8 is 4.6.0 , the rest of the config should be similar.

https://www.drupal.org/node/1399492

the important thing is, make sure that the plugins can be found and that you configure everything .

see step 4, 5 and 6 specifically, (provided you've configured ckeditor to the right library and whatnot.

# 4. Configure a text format so that this checkbox is checked:
#    - "Convert Media tags to markup"
# 5. Configure the Ckeditor configuration for that text format so that these
#    checkboxes are checked under the "Editor Appearance" section:
#    - "Plugin for embedding files using Media CKEditor"
#    - "Plugin file: lineutils"
#    - "Plugin file: widget"
# 6. Disable the ACF in the "Advanced Content Filter" section
LauraRocks’s picture

Thank you for your time on the matter. I have followed the recipe manually, and there is both of these plugins checked (and of course the plugin for Media Ckeditor):

Plugin file: widget
Plugin file: lineutils

BUT, during the debugging I realized that the problem is with text fields that are not visible at first at the edit form. So if a ckeditor field is under a tab (field group) or in a paragraph, that are both shown with ajax, then the plugin doesn't work (?). This wasn't a problem with the old version, so I don't know what has changed with that.

joseph.olstad’s picture

double check which jQuery version your admin theme is using.
its possible to adjust jQuery version on a theme by theme basis using the jquery update module.
This might be affecting something, otherwise, please review the order and the weights of the plugin operations. Those are important.

joseph.olstad’s picture

@LauraRocks , I'm working on a new recipe , not sure if that'll help or not. I'd start by looking at your version of jQuery . I believe that @brockfanning developed and tested most of the recent changes on jQuery 1.7 , you might want to try that version for your admin theme. Perhaps that should be part of the recipe as well.

joseph.olstad’s picture

@LauraRocks , @brockfanning published a new recipe you might want to try: https://www.drupal.org/node/2730285#comment-11860904

brockfanning’s picture

I don't think I've ever tried this out when the textarea is inside a field group that is loaded by ajax (didn't even know fieldgroup did that), so I'll have to give that a shot. I wouldn't be surprised at all if that did result in some javascript file or Drupal.settings variable not getting loaded properly.

joseph.olstad’s picture

@LauraRocks , what is the ajax error ? or any errors show up in the javascript console ?

joseph.olstad’s picture

Status: Needs review » Needs work
LauraRocks’s picture

Sorry, my mistake, no ajax, got confused with the Quicktab module in the site.

So the field group is used to present the fields in vertical tabs, and the fields that are hidden behind the tabs, are the ones that are broken. But I think the issue might be with the plugins, somehow I got it to work when I tried many times, finally I uploaded the ckeditor module and the libraries again, and the plugins, and followed the new recipe, then reverted back to the old modules, and then again updated. And now in the dev environment it seems to work. If I only knew what made it work... I have to manually do the same in the prod site, so maybe that will give me something to report back.

No js error and we use the jquery 1.7 in the admin pages.

LauraRocks’s picture

And now when I thought more about what I wrote earlier, it doesn't make any sense that it would behave differently, because the fields are only hidden. So I went back to the prod site (which is still broken) and made some tests there. And the images that are working, are the ones that have link around them. I didn't do enough testing at first, sorry about that, and all the images that seem to work were actually images with links (all just happened to be on the visible tab) . So I guess that makes it a plugin problem.

joseph.olstad’s picture

For others seeing this issue:
Try the new improved recipe and also with some additional troubleshooting tips
https://www.drupal.org/node/2843391

joseph.olstad’s picture

Status: Needs work » Needs review
LauraRocks’s picture

Ok, I finally got this. there were too many things going on to debug this really. So I guess my problem was in the end (when everything else was fixed and new plugins downloaded) the use of enhanced image plugin (image2). The customer wants to center images, so this plugin was added at that point. Now I only need to figure out how to get centering without breaking this one, but that's another story. Thank you for all your help!

BTW, should I now change the status of this issue to fixed or closed (works as designed)?

joseph.olstad’s picture

Ya I also tried the image2 plugin, let us know if you ever get that working correctly, I ended up disabling image2 and going back to the regular image plugin which works well with imce . For media browser media entities there's a patch by @brockfanning in the 'media' issue queue for left and right alignment using a file entity field that stores the css selected by a dropdown box according to config that he describes.
#2842391: better support for float media left and float media right

joseph.olstad’s picture

@LauraRocks

Your customer wants to center images.

This is possible now with patch 30 for the 'media' module.
Please note, that before you can use the new functionality you have to apply the patch AND THEN enable the option variable media_wysiwyg_alignment , set it to TRUE , there is a GUI form for enabling this new functionality: /admin/config/media/browser , scroll to the bottom and look for "Provide alignment option when embedding media" , put a checkbox there.

It works great. This means you will not need the image2 plugin.

#2842391: better support for float media left and float media right

joseph.olstad’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.