How to retrieve the CKEDITOR.status “ready”?

与世无争的帅哥 提交于 2019-11-28 06:53:05

If you want to execute your code when the API is fully loaded, use CKEDITOR.loaded event:

CKEDITOR.on( 'loaded', function( evt ) {
    // your stuff here
} );

If you want to execute your code when any new instance is ready, use CKEDITOR.instanceReady event:

CKEDITOR.on( 'instanceReady', function( evt ) {
    // your stuff here
} );

If you want to execute your code when a particular instance is ready, then use CKEDITOR.editor.instanceReady event:

CKEDITOR.replace( 'editor', {
    on: {
        instanceReady: function( evt ) {
            // your stuff here
        }
    }
} );

there's no ready status in CKEDITOR, you can use loaded like:

if ( CKEDITOR.status == 'loaded' ) {
    // The API can now be fully used.
    doSomething();
}

or use instanceReady, like:

CKEDITOR.on('instanceReady', function(evt){ 
   //ready
  //do something
});

As @Sudhir pointed out, there is a slight difference between the direct attribute value and the instanceReady method.

  • Use the event listener if you demand to be notified when CKEDITOR has not only completed its loading process, but also has completed the entire after-processing. In particular the HTML replacement and injection.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!