Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using Drupal 8.1.1 and file_entity HEAD, I'm not able to use ckeditor inside the inline edit form. When clicking ckeditor buttons that have modals (like link button), the file entity form disappears, and the modal stops working.
Steps to reproduce:
- Install Drupal 8.1.8
- Install file_entity HEAD
- Configure the article content type > image field > editable file
- Add a new field with CKEditor to the Image File Type
- Create an article and add an image, then save
- Edit the article > click edit next to the image
- Attempt to use CKEditor to make a link
I've attached a video of the problem.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2787217-6.patch | 1.35 KB | webflo |
#2 | file_entity-ckeditor_broken-2787217-2.patch | 1.68 KB | rocketeerbkw |
#2 | file_entity_ckeditor_fixed.mov | 7.54 MB | rocketeerbkw |
file_entity_ckeditor_broken.mov | 6.48 MB | rocketeerbkw |
Comments
Comment #2
rocketeerbkw CreditAttribution: rocketeerbkw at Amazee Labs commentedThe attached patch switches from using a "Modal Dialog" to using just a "Dialog." It looks like in Drupal, the former is hard coded to only allow one Modal Dialog at a time, hence the ckeditor dialogs forcing the file entity form to close.
There are some styling issues that need to get fixed with this, but I haven't looked at that yet. I want to see if this breaks tests.
I've attached a video of it working, to compare against the broken one.
Comment #5
rocketeerbkw CreditAttribution: rocketeerbkw at Amazee Labs commentedI couldn't duplicate test failures locally, so I re-ran the tests and they're green.
Comment #6
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedDrupals default implementation of the Modal is bound the #drupal-modal ID (OpenModalDialogCommand and CloseModalDialogCommand) and CKEditor plugins use this one already. File Entity could implements own modal with a different id.
Comment #7
rocketeerbkw CreditAttribution: rocketeerbkw at Amazee Labs commentedThe problem is that two modals with the same ID can't co-exist. The latest one open wins. So if your file entity has a file field, then that would require two modals to be open at once. The patch in #6 doesn't allow that. That's why I used unique IDs for each modal in #2.
Comment #8
pminfI'm experiencing a similar problem, but not with ckeditor. I have multiple image fields with widget Editble File. When I open an image to edit it and close it by clicking save or X, I can not edit another one afterwards (even the same image). I get an "error message" on clicking save:
[{"command":"closeDialog","selector":"#file-entity-inline-edit-1440","persist":false}]
.Clicking cancel has no effect at all, even on first click.
Both patch #2 and #6 did not solve this issue for me.
I must admit, that I can't reproduce this in a clean install. Any idea what's going wrong?
Comment #9
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commented+1 for #2
Reviewed in person with 27 other people at Texas Camp
Comment #10
BiigNiick CreditAttribution: BiigNiick as a volunteer commented+1 for #2 for me too
i think the solution of still hard-coding the modal title is not a very 'drupaly' way to fix this...
Comment #11
artis CreditAttribution: artis at Texas Creative commented+1 for patch #2 which solves the bug with ckeditor and accounts for any future issues with file entities that have file fields.
Code reviewed at Texas Camp.
Comment #12
brayfe CreditAttribution: brayfe as a volunteer commented+1 for #2.
Reviewed and confirmed that the patch in #2 is a functional way to have multiple dialogs open for the file entity. I agree that the original modal can be a basic Dialog box (vs modal), avoiding the conflict with CKEditor. Avoiding the hardcoded jquery selector in the OpenDialogCommand call ensures that there will not be future dialog/modal conflicts with other modules, core or contrib.
Comment #14
joseph.olstadFixed by Texas the Lone Star