检测CKEditor的焦点

Lov*_*ock 6 html javascript jquery ckeditor

试图解决问题在IOS设备上键盘破坏固定元素.

单击CKEditor文本区域时,我的目标是将该固定元素的样式设置为固定.

但是不确定如何检测CKEditor的焦点.

我没有尝试过任何工作,这里是基本的:

http://jsfiddle.net/B4yGJ/180/

CKEDITOR.replace('editor1');

$('#editor1').focus(function() {
  alert('Focused');
});
Run Code Online (Sandbox Code Playgroud)

Nen*_*lep 12

CKEditor有一个自定义焦点事件,对您有用.请参阅此处的文档:http://docs.ckeditor.com/#!/ api/CKEDITOR.editor-event-focus

您可以像这样使用它,例如:

CKEDITOR.on('instanceReady', function(evt) {
    var editor = evt.editor;
    console.log('The editor named ' + editor.name + ' is now ready');

    editor.on('focus', function(e) {
        console.log('The editor named ' + e.editor.name + ' is now focused');
    });
});

CKEDITOR.replace('editor1');
Run Code Online (Sandbox Code Playgroud)

JSFiddle http://jsfiddle.net/B4yGJ/181/