在Chrome和IE中-工作!


在Firefox-不工作! (末尾的光标)


我需要将ckediter光标设置在凝视位置,我在chrome和IE中使用startupFocus : true, config正常工作,但在Firefox中无法工作。

我的代码:

CKEDITOR.replace( 'MessageArea',
 {
    filebrowserBrowseUrl : '<?php echo base_url() . APPPATH; ?>views/js/filemanager/index.html',
    filebrowserImageBrowseUrl : '<?php echo base_url() . APPPATH; ?>views/js/filemanager/index.html',
    filebrowserWindowWidth : '800',
    filebrowserWindowHeight : '120',
    height                  : 140,
    toolbar                 : 'Basic',
    startupFocus : true

 }
 );


如何解决这个问题?

提前致谢....

最佳答案

您可以使用:

CKEDITOR.on('instanceReady', function(event) {
    var editor = event.editor;
    if(typeof(editor) !== 'undefined') {
       editor.focus();
       var element = editor.document.getBody()
       var range = editor.createRange();
       if(range) {
          range.moveToElementEditablePosition(element, false);
          range.select();
       }
    }
});



我的jsFiddle:http://fiddle.jshell.net/4WegG/13/
文档:http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-startupFocus

10-05 20:30
查看更多