GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 395 forks source link

ContentTools.EditorApp.get().destroy is insufficient #423

Closed uncaught closed 7 years ago

uncaught commented 7 years ago

After noticing that my save-callback was triggered multiple times after a series of re-initializing the editor app, I've investigated and found that the destroy-method is not cleaning up everything.

The _children array is not cleaned up and none of the children are properly destroyed. Furthermore the _bindings are not cleaned, either.

This solved the problem for me, maybe you can implement this change in the code:

    editor._children.forEach((child) => child.unmount && child.unmount());
    editor._children = [];
    editor._bindings = [];
    editor.destroy();

Thank you

anthonyjb commented 7 years ago

Hi @uncaught - thank for flagging this I'll provide fix this week :+1: