How to determine if CKEditor is loaded?

前端 未结 7 1500
野性不改
野性不改 2021-02-18 16:16

How do I find out if CKEditor is loaded? I\'ve looked through the API docs, but could only find the loaded event. I want to check if CKEditor is loaded, because if I load it a s

7条回答
  •  长情又很酷
    2021-02-18 16:46

    I've looked through the API docs, but could only find the loaded event.

    I don't know whether there exists a specific property for this - there might! - but you could use the loaded event to set a global flag. It's not really nice but would do the job.

    // At the top of the script
    CKEDitor_loaded = false;
    
    // then later
    CKEDITOR.on('loaded', function(){ CKEditor_loaded = true; });
    

    Instead of a global variable, you could also consider setting something inside CKEDITOR:

    CKEDITOR.flag_loaded = true;
    

    This would be a bit cleaner.

提交回复
热议问题