tinyMCE setup callback versus onAddEditor

Posted by Matthew Manela on Stack Overflow See other posts from Stack Overflow or by Matthew Manela
Published on 2011-01-05T17:52:47Z Indexed on 2011/01/05 17:53 UTC
Read the original article Hit count: 519

Filed under:

When you initialize a tinyMCE editor I have noticed two different ways to get called when the editor is created.

One way is using the setup callback that is part of tinyMCE.init:

tinyMCE.init({
   ...
   setup : function(ed) {
      // do things with editor ed
   }
});

The other way is to hook up to the onAddEditor event:

tinyMCE.onAddEditor.add(function(mgr,ed) {
    // do things with editor ed
});

What are the differences between using these two methods?

Is the editor in a different state in one versus the other? For example, are things not yet loaded if I try to access properties on the editor object.

What are reasons to use one over the other?

© Stack Overflow or respective owner

Related posts about tinymce