简体   繁体   中英

how to get ckeditor iframe object in javascript

I want to write onkeypress event against ckeditor iframe body. How can I get object of ckeditor object so that I can bind onkeypress event against ckeditor iframe body?

You can try following code before creating ckeditor instances to bind onkeypress event:

CKEDITOR.on('instanceCreated', function(cke) {
cke.editor.on('contentDom', function() {
   if(cke.editor.name == "YourIntanceName") // YourIntanceName = name of teaxtarea
    {
        cke.editor.document.on('keypress', function(e) {
            var charCode = event.data.getKey();
        });
    }
});
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM