I'm dynamically creating and destroying textareas for this purpose. However, when I create a textarea and then an instance of it in tinymce--then come back to the page again, it doesn't work. I've found that the solution is to simply remove any existing instance of that same name, but I was wondering if it's possible to just do it at startup.
Thanks in advance!
Use tinymce. remove() method to remove TinyMCE editor from the HTML element and again call tinymce. init() on the selector to reinitialize.
Initialize TinyMCE 5 on any element (or elements) on the web page by passing an object containing a selector value to tinymce. init() . The selector value can be any valid CSS selector. For example: To replace <textarea id="mytextarea"> with a TinyMCE 5 editor instance, pass the selector '#mytextarea' to tinymce.
In a snapshot, TinyMCE is one of the world's most advanced rich text editors. It's used 'under the hood' on thousands of different kinds of platforms such as email management systems, content management systems, and online word processors.
You need to use the remove() API to detach TinyMCE from the DOM before you close your Modal window. You can then use init() again when the modal is recreated.
TinyMCE V5
Remove all instances with:
tinymce.remove();
More info see this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With