Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to destroy tinyMce?

Tags:

jquery

tinymce

I am using the latest version 3.4.b3. I have it in a dialog and it's contents are created dynamically.

So this means the textarea that tiny should bind itself to gets created every single time. So when I load up the dialog for the first time tiny shows up. If I load up the dialog a second time the dialog does not show up again.

So I think I need to destroy tiny on close of the dialog and then recreate it on load again.

I tried to use remove but I get this error

ReferenceError: t is not defined
http://localhost:3000/Site
Line 0

So not sure what that is all about.

like image 467
chobo2 Avatar asked Mar 02 '11 03:03

chobo2


People also ask

How do I uninstall TinyMCE?

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

Is TinyMCE a plugin?

Contents. TinyMCE is an incredibly powerful, flexible and customizable rich text editor. This section will help configure and extend the editor by using TinyMCE plugins.

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.

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.


1 Answers

You should shut down tinymce correctly in order to be able to reinitialize a tinymce editor with the same id as the first one.

To shut down an edtor instance use:

tinymce.execCommand('mceRemoveControl',true,'editor_id');

To reinitialize use

tinymce.execCommand('mceAddControl',true,'editor_id');
like image 175
Thariama Avatar answered Sep 30 '22 13:09

Thariama