Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove all tinymce instances at startup?

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!

like image 554
Le Havre Avatar asked Sep 11 '10 21:09

Le Havre


People also ask

How do you destroy TinyMCE?

Use tinymce. remove() method to remove TinyMCE editor from the HTML element and again call tinymce. init() on the selector to reinitialize.

How do I initialize TinyMCE editor?

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.

What does TinyMCE do?

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.

How do you reload TinyMCE?

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.


1 Answers

TinyMCE V5

Remove all instances with:

tinymce.remove();

More info see this.

like image 117
Bjorn Avatar answered Oct 03 '22 23:10

Bjorn