When I try to edit the alternative text for an embedded image, the previously saved value is missing from the input field. This field and the URL field should be prepopulated with the data used when embedding the image.

Steps to reproduce:

  1. Embed an image in a CKEditor wysiwyg field using IMCE
  2. Publish the node
  3. Edit the same node
  4. Click the image you embedded
  5. Click the IMCE "Image" toolbar button
  6. You'll see that the URL and Alternative text fields will be empty

Comments

medinasod created an issue. See original summary.

medinasod’s picture

Issue summary: View changes
steveash’s picture

Can verify this is a huge issue.

bernardopaulino’s picture

+1

bitcookie’s picture

StatusFileSize
new1.42 KB

This might be a core issue. The same behavior takes place using the image dialog without IMCE/uploads, just providing a path to an image. Switching back/fourth to source within CKEditor without saving also causes the bug.

This is related to the injected image tag's "data-entity-type" and "data-entity-uuid" attributes being empty. The plugin doesn't bind to these elements.

Example, an image that works, uploaded using core modules.

<img alt="test" data-caption="Hey waddup earph" data-entity-type="file" data-entity-uuid="c70cca1e-15c6-4e4b-8fb1-ac28c0498d85" src="/sites/default/files/small_bear.jpg" />

Example, an image provided by IMCE as a path, does not work.

<img alt="test" data-caption="Hey waddup earph" data-entity-type="" data-entity-uuid="" src="/sites/default/files/small_bear.jpg" />

Attached is an attempted core patch for this. It just ensures these properties are filled in (not empty).

It may be better to patch this wherever the image manipulation plugin binds. This way the plugin is tolerant of empty type/uuid attributes, which seems like a proper expression of the data. This approach provides values to trick the system into processing the image, which might cause other issues.

thalles’s picture

A similar problem and with a closer solution in: #2850277: IMCE image caption support

thalles’s picture

Status: Active » Closed (duplicate)
medinasod’s picture

Status: Closed (duplicate) » Active

This is not a duplicate issue.

thalles’s picture

Status: Active » Needs review

Thanks!

thalles’s picture

@medinasod, I believe that the issue solved this problem correctly without the use of a false uuid

medinasod’s picture

@thalles I'll try out the patch. Thank you.

thalles’s picture

@medinasod, there a problem security on the patch of the issue #2850277: IMCE image caption support

medinasod’s picture

@thalles, what about the patch listed above (comment #5)? Has that been tested? Thank you.

thalles’s picture

+++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js
@@ -90,6 +90,21 @@
+            if(typeof element.attributes['data-entity-uuid'] == 'undefined'){
+              element.attributes['data-entity-uuid'] = '0';
+            }

@see, it does not generate uuid, only add 0

thalles’s picture

@medinasod, can you test the last patch in the #2850277: IMCE image caption support?

thalles’s picture

Category: Bug report » Support request
Status: Needs review » Fixed
medinasod’s picture

@thalles, I installed the dev version of IMCE, which has the fix from the issue you referenced, but it didn't fix the issue I'm reporting in this issue. The alternative text field is still empty when I open the dialog popup window when editing an embedded image. Thanks.

medinasod’s picture

Status: Fixed » Active
thalles’s picture

Did you uninstall and reinstall IMCE?

medinasod’s picture

Yes, I also updated the database, cleared cache, and double checked that the patch code is located in the module. Thanks.

medinasod’s picture

Just to be clear, I didn't use the patch that's linked to in comment #5, which is a patch for the core ckeditor module.

thalles’s picture

StatusFileSize
new3.5 MB

@medinasod, would are this?



medinasod’s picture

@thalles thank you for your help. Upon further testing, I noticed that the patch does work, but the alt text needs to be added the first time for existing images, then published. For example, when editing an existing page with an embedded image, the alternative text field in the popup is still empty. But after adding the text and publishing the page, the alternative text will appear in the popup subsequently. So in short, it seems the fix doesn't work retroactively for existing embedded images (which probably warrants a different issue). Thank you!

thalles’s picture

Status: Active » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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