Problem/Motivation
CKEditor breaks when you are uploading an image but try to save image upload dialog before the image has finished uploading. This happened in both 8.9.x and 9.1.x as well.
Steps to reproduce
- Install fresh new Drupal
- Go to new article creation page
- Click the "image upload icon"
- When the image upload dialog box appears, upload a large sized image that takes many seconds to upload
- While the image is still being uploaded, hit "save" on the dialog box
- Wait until the ajax request for the image upload is completed
- After the image upload xhr request has finished, it should break the underlying CKEditor
- Demo: https://www.loom.com/share/2c8559820a274f11a4bd31cbfbb9625f
What behavior were you expecting?
- CKEditor should keep working
- Error should be visible as now
What happened instead?
- CKEditor disappeared once image upload xhr was completed
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 3174290-15.patch | 3.72 KB | leeomara |
| #12 | interdiff_9-10.txt | 755 bytes | ranjith_kumar_k_u |
| #12 | 3174290-10.patch | 3.7 KB | ranjith_kumar_k_u |
| #11 | interfiff-3174290-8_9.txt | 861 bytes | gauravvvv |
| #11 | 3174290-9.patch | 3.69 KB | gauravvvv |
Comments
Comment #2
lihsus commentedComment #3
codersukanta commentedI have gone through the issue and found that the code snipped from
function detach(context, settings, trigger)in core/modules/editor/js/editor.js is causing the issue.Where I can see the whole #documents value is passed as a
contextargument.Basically the argument context is replaced by #document if the context value passed to
Drupal.detachBehaviorsis empty in drupal.js.I have tried to fix it but I am bit doubtful whether removing
context = context || document;will break anything else or not.Please review and suggest.
Comment #4
codersukanta commentedComment #6
abhijith s commentedPatch #3 failed to apply in 9.2.x
Comment #7
abhijith s commentedComment #8
anmolgoyal74 commentedRe-rolled #3 for 9.2.x
Comment #11
gauravvvv commentedRe-rolled patch #8, for drupal9.4. Attached interdiff for same.
Comment #12
ranjith_kumar_k_u commentedFixed CS error.
Comment #14
quietone commentedCKEditor has been removed from core, CKEditor 4 is removed from Drupal Core in 10.0.0
Comment #15
leeomaraI wasn't able to get the patch from #12 to apply on Drupal 9.5 (would fail to patch core/misc/active-link.js). I suspect the whitespace changes from https://git.drupalcode.org/project/drupal/-/commit/77e12397f5dd5e0a49ed1... are the issue.
I've attempted to re-roll the patch from #12 against the Drupal core 9.5.x branch. This patch does apply for me on 9.5.9, though I'm a novice at this, so please check my work.