Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE 4 - remove() or destroy()

Tags:

jquery

tinymce

I am using TinyMCE editor. I want to remove or destroy tinymce editors (Page contain more then one editor). Also remove classes and IDs added by tinyMCE.

But leave editable contents

I tried :

tinymce.remove() tinymce.destroy() tinymce.execCommand('mceRemoveControl',true,'.editable'); 

Please note:

my editor class is .editable, And I have more then one editors in my page.

like image 737
user007 Avatar asked Jul 20 '13 05:07

user007


People also ask

How do you destroy TinyMCE?

tinymce. remove() tinymce. destroy() tinymce. execCommand('mceRemoveControl',true,'.

How do I remove TinyMCE status bar?

statusbar. This option allows you to specify whether or not TinyMCE should display the status bar at the bottom of the editor. To disable the status bar, the statusbar option should be provided with a boolean false value.

How do I reinitialize TinyMCE editor?

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

How do you refresh TinyMCE editor?

Re: How refresh editor after setContent Well, both exec mceInsertContent and your workaround (do a selection. setContent then another editor. setContent) basically do the same thing. tinymce.


1 Answers

I had the same problem. In v4 all suggestions above did not work for me, but this did:

tinymce.remove("div.editable");  ... regenerated HTML dynamicaly ...  tinymce.init(...); 

I use inline editor:

tinymce.init({     selector: "div.editable",     inline: true,     plugins: [     "advlist autolink lists link image charmap print preview anchor",     "searchreplace visualblocks code fullscreen",     "insertdatetime media table contextmenu paste"     ],     menubar: false,     toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"}); 

Hope this helped

like image 55
assassinatorr Avatar answered Sep 22 '22 06:09

assassinatorr