怎么样给ckeditor注册键盘事件,并且获得按下的键的 code ?
ckeditor的api中  CKEDITOR.dom.event 到底应该怎么用? 下面是连接,知道的请告诉我!谢谢!!!
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.event.html

解决方案 »

  1.   

    楼主要这种效果吗function ckeidtorHint(editor,maxlength,id,hintId){
    //文本框样式
    function countCharacter(editor,maxlength,id,hintId){
     var html = editor.getData();  
     str=html.replace(/ /g,""); 
        str= str.replace(/<\/?.+?>/g,""); 
        str = str.replace(/\s/g,"");  
        str = jQuery.trim(str);     
     var length = str.length;
     jQuery("#"+id).val(str);
     if(maxlength-length<0)
     document.getElementById(hintId).innerHTML = "已经超过" +(length-500)+"字数,请删除";
      else  document.getElementById(hintId).innerHTML = "还剩余" +(500- length)+"字数";

    }
    editor.on('change',function(evt){   
    countCharacter(editor,maxlength,id,hintId); 
    });   
    editor.on('key',function(evt){   
    countCharacter(editor,maxlength,id,hintId); 
    });
    }function ckeditorReplace(id,hintId,maxLength){
    CKEDITOR.replace(id);
    var editor = CKEDITOR.instances[id];
    ckeidtorHint(editor,500,id,hintId);

    }
      

  2.   

    这是我做的设置ctrl+enter快捷键的代码:
    CKEDITOR.on('instanceReady', function (e){ 
    $(e.editor.document.$).keypress(function(e){
        if(e.ctrlKey &&( e.which == 13 || e.which == 10))
        $("#aa").click();
        }) 
    })