Hello, ufku and Thalles Ferreira (thalles) !

Thank you for a great and useful module!
I use it for one of my projects and found a bug. How to reproduce:

  1. Install IMCE
  2. Edit any text format which uses CKEditor
  3. Replace default Drupal 8 image upload button with IMCE one
  4. Add new node, for body use previously edited text format, upload and add some image with IMCE
  5. Doubleclick on added image (or right button click -> image properties): Appears default Drupal 8 image upload dialog which allow to replace image. New image will be uploaded to the public:/inline-images/ folder instead of folder configured in IMCE and IMCE files restrictions will be omitted for current user.

On my side I currently solved this issue with replacing EditorImageDialog form with custom one which extends EditorImageDialog and makes image field disabled.

Is there some more correct way how to solve this issue?
Or if my solution is good I can provide it as a patch.

Comments

Antonnavi created an issue. See original summary.

thalles’s picture

Thanks @Antonnavi!
This really happen, please, send us your solution to we analyze.

antonnavi’s picture

Thank you for a very fast response, Thalles Ferreira (thalles) !

Attached patch replaces EditorImageDialog form with ImceEditorImageDialog form which checks if current editor uses ImceImage button, if Yes - file upload element will be disabled and hidden by adding "visually-hidden" CSS class to the element wrapper.

antonnavi’s picture

Version: 8.x-2.2 » 8.x-2.x-dev
Status: Active » Needs review
thalles’s picture

Status: Needs review » Needs work

Thanks for your patch @Antonnavi!
But did not work to me!

antonnavi’s picture

Could you plz describe:

  • Step by step how did you test it
  • What was expected
  • What was as a result
thalles’s picture

Maybe I don't understand:

  1. Apply your patch;
  2. Add a new image by CKEditor;
  3. Double click in this image (or right button click >> image properties);

See:

paulocs’s picture

StatusFileSize
new236.57 KB

Hello @antonnavi,
I tested your patch and I had the same error as Thalles.
I applied your patch, created a new content and added an image using the IMCE in the ckeditor. After that, I doubleclicked on the image and it is still using the default Drupal 8 image uploader at the EditorImageDialog.

antonnavi’s picture

Status: Needs work » Needs review
StatusFileSize
new304.69 KB

Thank you for help @thalles and @paulocs !

Just tested my patch again:

  1. Installed latest Drupal core 8.8.5
  2. Installed latest IMCE 8.x-2.x-dev
  3. Edited "Full HTML" text format (default image button replaced with IMCE one)
  4. Tried to add new "Basic page" node:
    • "Full HTML" text format selected
    • Added new image with IMCE
    • Double click -> Image can be replaced (default behavior)
  5. Applied my patch
  6. Tried to add new "Basic page" node again:
    • "Full HTML" text format selected
    • Added new image with IMCE
    • Double click -> Image can be replaced (as you described above)
  7. Flushed all caches (on /admin/config/development/performance page with "Clear all caches" button)
  8. Tried to add new "Basic page" node again:
    • "Full HTML" text format selected
    • Added new image with IMCE
    • Double click -> Image selection element isn't available

Screenshot

Means: I forgot to add notice that flushing all caches is required (because I altering route of image settings form).
Could you test it again plz.

paulocs’s picture

Hello antonnavi,

I tried the new steps you wrote, but it doesn't work.
Steps I followed:

  • Installed IMCE 8.x-2.x-dev
  • Edited Full HTML and replaced image button with IMCE button
  • Applied the patch
  • Flushed all caches
  • Created new basic page
  • Added new image with IMCE
  • Double click on the image

What I could see is that the function alters the route properly, but it is not calling the class ImceEditorImageDialog when doubleclicking on the image. The created form is still the one from core/modules/editor/src/Form/EditorImageDialog.php

paulocs’s picture

Status: Needs review » Needs work
antonnavi’s picture

StatusFileSize
new2.34 KB
new1.16 KB

Hello, paulocs !

Thank you for help!
Patch was updated. Could you test it again plz.

antonnavi’s picture

Status: Needs work » Needs review
ilgnerfagundes’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new91.32 KB

It seems to be working, I double-clicked the image and she just selected it, I clicked it with the right button and there is no option to edit.

thalles’s picture

Works to me!

Thanks @all!

  • thalles committed 54653ab on 8.x-2.x authored by Antonnavi
    Issue #3128289 by Antonnavi, thalles, paulocs, ilgnerfagundes: CKEditor...
thalles’s picture

Status: Reviewed & tested by the community » Fixed

  • thalles committed d9197f2 on 8.x-2.x authored by Antonnavi
    Issue #3128289 by Antonnavi, thalles, paulocs, ilgnerfagundes: Block...

Status: Fixed » Closed (fixed)

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