You already have a practical decision made with remove (), so here is the answer about destroy ().
Destruction methods (sometimes called dispose) are common in many programming languages ββto clear the resources used by an instance of something. Destruction conditionally represents the concept of pure memory (i.e., non-visual). The destroy method often differs from the object-oriented method of the destructor in terms of lifetime in that for destruction it is implied that it can be explicitly called by the programmer to clear the memory and resources before starting the final destructor or before collecting the garbage collector (in any case earlier, that you can release material when you no longer need it, instead of allowing these resources to be used until the end of the program). Sometimes the destructor method naturally contains a call to the destroy method to ensure that all resources are finally cleaned up, so usually the programmer does not have to worry about not calling it because it will eventually be called automatically.
Often the body of the destruction method code is provided by the programmer for the behavior of the application (redefined from the base class / object in some languages). This means that calling destroy without providing an implementation for it often does nothing - the empty body of the code. Of course, for TinyMCE he will implement his own destruction methods accordingly.
The TinyMCE documentation does not promise any visual changes upon destruction, only if the instance is deprived of the possibility of a memory leak. This is consistent with what destruction methods usually do.
Destroys an instance of the editor, deleting all events, link elements, or other resources that may be leaked. This method will be automatically called when the page is unloaded, but you can also call it directly if you know what you are doing.
That's why TinyMCE provides a remove () method to visually change things, because destroy () is not designed to accomplish the same purpose.
To completely destroy TinyMCE, you can perform removal () for visual cleaning, and then dispose () for cleaning memory; however, these methods are implementation specific, and I'm not sure how TinyMCE will react.
John k
source share