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.
On a node edit form, whenever I try to upload in image in an image field, the editor dissapears. The only way to get it back is to toggle the textfield to plain text and then back to "full html". Anybody else having this issue?
Comment | File | Size | Author |
---|---|---|---|
#10 | ajax_incident-1911462-10.patch | 996 bytes | Paulmicha |
#3 | 1911462.patch | 671 bytes | swati.karande |
Comments
Comment #1
kingman1016 CreditAttribution: kingman1016 commentedYes, it also disappears when adding multi value field items.
Comment #2
andraek CreditAttribution: andraek commentedI'm guessing then that it must have something to do with the editor not being re-enabled after the form is updated via ajax?
Comment #3
swati.karande CreditAttribution: swati.karande commentedHi,
I have attached a small patch for this issue.
Comment #4
andraek CreditAttribution: andraek commentedYou are awesome! Thank you!
Comment #5
markabur CreditAttribution: markabur commentedHm, so WYSIWYG module itself needs to be patched in order to fix this issue? The patch does work, but it seems like CKEditor for WYSIWYG Module is the one with the problem?
Comment #6
Paulmicha CreditAttribution: Paulmicha commentedPatch in #3 works, thanks a lot !
(Moving this issue in wysiwyg project).
Comment #7
TwoDI'm not seeing this issue, the editor doesn't actually get removed on 'serialize' events because those are supposed to enable syncing of contents back to the original textarea (so AJAX operations can serialize up to date form values etc) when other elements in the same form are about to be replaced as a response to an AJAX operation or other DOM manipulations. Thus, the editor should not get replaced in the first place if '#wrapper' was set correctly on the image upload field so it only targets a wrapper of the image field itself.
When I upload an image using the core Image field, the
detach()
integration method gets called for all instances withtrigger='serialize'
and thus calls theupdateElement()
method on the CKEditor instance.It never calls the
destroy()
method on any CKEditor instance unless one of the fields which are actually about to be replaced have editor instances on them. Then the instance must be destroyed so it can be recreated on the original textarea which has now been replaced, or you'll get errors about the instance already existing.The patch won't apply because there are whitespace errors and it's not been created from inside the Wysiwyg folder.
Specifically mentioning Image module in the comment isn't very helpful since any module can tell Drupal to detach behaviors using the 'serialize' trigger at any time.
How did you come up with the patch? What's the reasoning behind not calling detach() when trigger is 'serialize'?
Comment #8
markabur CreditAttribution: markabur commented@TwoD I've only seen this issue with http://drupal.org/project/wysiwyg_ckeditor -- not the normal ckeditor component that is included with Wysiwyg module.
Comment #9
TwoDOh, that makes sense then since wysiwyg_ckeditor doesn't currently check the reason for the detach call and always destroys the editor instance.
http://drupalcode.org/project/wysiwyg_ckeditor.git/blob/refs/heads/7.x-1...
vs
http://drupalcode.org/project/wysiwyg.git/blob/refs/heads/7.x-2.x:/edito...
Comment #10
Paulmicha CreditAttribution: Paulmicha commentedSo if i'm guessing correctly, the proper fix for this issue should be :
Comment #11
swati.karande CreditAttribution: swati.karande commentedIt looks correct and working for me.
Thanks!
Comment #12
rv0 CreditAttribution: rv0 commentedpatch works for me
Comment #13
Paulmicha CreditAttribution: Paulmicha commentedComment #14
davidneedhamI can also confirm that the patch in #10 worked for me.
Comment #15
quicksketchThanks @Paulmicha! And all testers. Committed.