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.
Use tinymce. remove() method to remove TinyMCE editor from the HTML element and again call tinymce. init() on the selector to reinitialize.
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.
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.
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.
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');
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