检测CKEditor的焦点 [英] Detect focus of CKEditor

查看:95
本文介绍了检测CKEditor的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图解决问题在IOS设备上键盘中断固定元素的问题。

trying to fix the issue where on an IOS device the keyboard disrupts fixed elements.

点击CKEditor文本区域时,我的目的是设置固定元素返回固定。

When clicking on a CKEditor text area, my aim is to set the style of that fixed element back to fixed.

不知道如何检测CKEditor的聚焦情况。

Not sure how to detect the CKEditor being focused however.

没有我已经尝试过,这里是基本的:

Nothing I have tried has worked, here is the basic though:

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

CKEDITOR.replace('editor1');

$('#editor1').focus(function() {
  alert('Focused');
});


推荐答案

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

CKEditor has a custom focus event, that will be useful to you. See the docs here: 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');

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

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

这篇关于检测CKEditor的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆