Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if tinyMCE has been initated?

I initiate the tinyMCE like this in multiple tabs of JQuery:Tab. But I find to init tinyMCE multiple times yields readonly text areas. Thus I wish to check if tinyMCE is already initated. Is there a method like isInitated() or something similarly convenient there?

tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    width : "500",
    height : "300"
});
like image 525
Song Avatar asked Jun 09 '11 02:06

Song


People also ask

How do I know if my TinyMCE is initialized?

You can use tinymce. editors. length to see if there is already an editor instance initalized ( tinymce.

How do you get content on TinyMCE?

The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.

How do I make my TinyMCE editor responsive?

The TinyMCE editor can be made responsive by using css media queries. Simply add css rules that set the width property of table. mceLayout and the tinyMCE textareas. You will need to enforce these css rules using !


2 Answers

You can use tinymce.editors.length to see if there is already an editor instance initalized (tinymce.editors.length > 0).

like image 127
Thariama Avatar answered Sep 21 '22 03:09

Thariama


I know this question is old, but...in case someone is still looking for the holy grail:

in tinymce 4, you can pass a callback to tinyMCE.init like so:

tinyMCE.init({
  //your regular parameters here...
  setup: function(editor) {
    editor.on('init', function() {
      //all your after init logics here.
    });
  }
});
like image 36
Yurui Zhang Avatar answered Sep 19 '22 03:09

Yurui Zhang