Ran in to an issue where I was getting a JavaScript error stating the CKEditor instance already exists. This patch fixes the issue by destroying the instance if it already exists before trying to replace it.


Thank you for your patch. We will check this as soon as possible.
Please be patient.

Status:Needs review» Postponed (maintainer needs more info)

@greenSkin, could u write how to reproduce this?


Status:Postponed (maintainer needs more info)» Needs review

The steps to reproduce can be a little tricky as it is AJAX related. Basically you load the page either with the textarea loaded on page load or via an AJAX callback; no problems, everything works fine. The issue comes when you remove that textarea and replace it with the same one. The CKEditor doesn't know it was replaced so when the behaviors tries to initialize the new editor it errors that it already exists.

The simplest of fix is what the patch attempts, to destroy any pre-existing editor before trying to initialize it again.

Hope that helps. :)

@greenSkin, could u try review my patch? It will be better to destroy CKEditor by textarea_id - if it will be more CKEditor instances in one page u will destroy last one replaced - not selected in that moment...


Status:Needs review» Reviewed & tested by the community

@dczepierga: Yes, that works wonderfully. Thank you!

Title:Destroy existing instance when trying to replace it[D6] Destroy existing instance when trying to replace it
Status:Reviewed & tested by the community» Fixed

Changes commited to GIT (diff)

Thx for help and review patch.


Status:Fixed» Closed (fixed)

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

Title:[D6] Destroy existing instance when trying to replace it[D6] Destroys existing instance when trying to replace it