TinyMCE configuration callback versus onAddEditor

When you initialize the tinyMCE editor, I noticed two different ways to get a call when creating the editor.

One way is to use the installation callback, which is part of tinyMCE.init :

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

Another way is to hook into the onAddEditor event :

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

What is the difference between using these two methods?

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

What are the reasons for using one over the other?

+5
source share
2 answers

, tinyMCE.onAddEditor , AddEditor, , tinymce setup . .

, setup tinymce ( ), onAddEditor tinymce ( ).

+4

onAddEditor.add TinyMCE 4:

Deprecated TinyMCE API call: <target>.onAddEditor.add(..)

.on(nameofevent, function(){...} ) - MCE4, .

+3

All Articles