Details
Description
When an edited document is discarded, the CKEditor instances used in the document are not destroyed.
Steps to reproduce:
1. login to the archetype CMS
2. edit a news document
3. discard the document by clicking the red cross in the document's tab
4. open the JavaScript console (F12 in Chrome)
5. type "CKEDITOR.instances" and hit <enter>
Expected: an empty JavaScript object is logged
Actual: a JavaScript object with one element is logged
Background: the global JavaScript variable CKEDITOR.instances contains a map (editor ID -> editor instance) of all open CKEditor instances. Each instance should be destroyed when the associated <textarea> element is removed from the DOM (see CKEditorPanel.js#destroyEditorWhenElementIsDestroyed). This works fine when a document is "saved & closed", but not when a document is discarded.