如何检索CKEDITOR.status“ready”? [英] How to retrieve the CKEDITOR.status "ready"?
问题描述
在我的脚本中,我想等待CKEDITOR处于状态准备
之前,让我自己的指令去他们的方式。因此,我查阅了 CKEDITOR API ,并写了以下条件:
In my script, I wanted to wait for the CKEDITOR to be in state ready
before I let my own instructions go their way. So I consulted the CKEDITOR API and wrote the following condition:
if(CKEDITOR.status == "ready"){
//execute my code when ready
}
但是,从加载
到 status
。显然我甚至看不到任何其他国家。
However, the status never ever changes to from loaded
to status
. Apparently I didn even see any other state.
更多任务特定,我想抓住时间CKEDITOR已经完成修改contenteditable =true的内联替换。
More task specific, I wanted to catch the moment when CKEDITOR has completed modifying the inline replacing of contenteditable="true". That's when I want to go ahead with my JS code.
任何线索?
推荐答案
如果要在API完全加载时执行代码,请使用 CKEDITOR.loaded
事件:
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
} );
如果要在任何新实例准备就绪时执行代码,使用 CKEDITOR.instanceReady
事件:
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
} );
如果要在特定实例准备就绪时执行代码,然后使用 CKEDITOR.editor.instanceReady
event:
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
}
}
} );
这篇关于如何检索CKEDITOR.status“ready”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!