Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
@@ -351,7 +351,9 @@ export default class DataController {
/**
* Removes all event listeners set by the DataController.
*/
- destroy() {}
+ destroy() {
+ this.stopListening();
+ }
* Checks if all provided root names are existing editor roots.
@@ -122,6 +122,14 @@ export default class Document {
}
+ * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
+ */
+ this.roots.map( root => root.destroy() );
+
+ /**
* Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.
*
* @protected
@@ -77,6 +77,10 @@ export default class EditableElement extends ContainerElement {
* Returns document associated with the editable.
@@ -398,6 +398,8 @@ export default class View {
observer.destroy();
+ this.document.destroy();
this.stopListening();