Opened 15 years ago
Closed 14 years ago
#5441 closed Bug (fixed)
Fix for #3812 breaks CKEditor in IE when editor instance is no longer in DOM
Reported by: | Marcos Wright Kuhns | Owned by: | Alfonso Martínez de Lizarrondo |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.4 |
Component: | General | Version: | 3.2 |
Keywords: | Confirmed Review+ | Cc: |
Description
The IE-specific fix for #3812 causes another bug if the CKEditor container isn't a descendant of document.body. This bug only occurs in IE (because we use the moveToElementText function).
Attached is a test HTML file as well as a potential patch. The main shortcoming of the patch is that it does scroll to the top of the page. If someone has a better fix that would be great!
Attachments (5)
Change History (14)
Changed 15 years ago by
Attachment: | ie_destroy_bug.html added |
---|
Changed 15 years ago by
Attachment: | ie_destroy_bug.patch added |
---|
Changed 15 years ago by
Attachment: | ie_destroy_bug.2.patch added |
---|
A better patch for this bug that also stops unexpected window scrolling.
comment:1 Changed 15 years ago by
Keywords: | Pending added |
---|
What's the use case for allowing CKEditor to be moved out of the document DOM?
Whenever it's moved in the DOM the inner iframe will reload in Firefox, Safari and I think also Opera, so it's just better to destroy the editor and then recreate a new instance at the new location because that's in fact the only option that works.
comment:2 Changed 15 years ago by
The test case I attached is completely contrived. The actual use-case where we're encountering the bug is this:
1) We load the CKEditor into a modal dialog box using AJAX. So the editorInstance.container.ancestors() == [form#dialog_form, div#modal_dialog, body, html]
2) When the user clicks the "Save" button in the dialog box, we save the CKEditor data via an AJAX POST, then remove the modal dialog from the DOM using the removeChild function. Now the editorInstance.container.ancestors() == [form#dialog_form, div#modal_dialog]
3) Finally, we have a cleanup function that removes old CKEditor instances. This function calls editor.destroy() on all CKEDITOR.instances that don't have document.body as an ancestor. This is where we encounter the error.
I realize that we could work around this error by calling the editor.destroy() function before we remove the modal dialog from the DOM, but because we use this pattern many different places in app, that would be a fairly significant change & require us to touch many points in our codebase. Also, beyond our specific case, I don't think it's a safe to assume that the CKEditor will always belong to the DOM when the destroy function is called.
Does this make sense?
comment:3 Changed 15 years ago by
Keywords: | Confirmed added; Pending removed |
---|---|
Milestone: | → CKEditor 3.4 |
It makes sense.
Changed 15 years ago by
Attachment: | 5441.patch added |
---|
comment:4 Changed 15 years ago by
Keywords: | Review? added |
---|---|
Owner: | set to Garry Yao |
Status: | new → assigned |
comment:6 Changed 15 years ago by
That solution is very good and fixes the original problem, but the patch was outdated and more important: now the elementsPath gives an error for all the browsers, the revised patch fixes also that issue.
comment:7 Changed 14 years ago by
Owner: | changed from Garry Yao to Alfonso Martínez de Lizarrondo |
---|---|
Status: | assigned → new |
comment:8 Changed 14 years ago by
Keywords: | Review+ added; Review? removed |
---|
An html file that can be used to reproduce the error in IE