ckeditor jquery插件和模糊事件 [英] ckeditor jquery plugin and the blur event

查看:79
本文介绍了ckeditor jquery插件和模糊事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ckeditor,我正在使用此编辑器的jquery插件在文档准备好时实例化所有内容。我需要做的是为正在创建的ckeditor实例设置一个模糊事件。下面的代码是我用来实例化ckeditor的。

I'm currently working with ckeditor and i'm using the jquery plugin for this editor for instantiating everything when the document is ready. What I need to do is setup a blur event for the instance of ckeditor that is being created. The below code is what I'm using to instantiate ckeditor.

$(textarea.editor)。ckeditor();

$("textarea.editor").ckeditor();

我想做的是:

$(textarea.editor)。blur();

$("textarea.editor").blur();

有没有办法用ckeditor使用jquery插件来做到这一点?

Is there a way to do this with ckeditor using the jquery plugin for it?

推荐答案

您需要将处理程序绑定到编辑器实例而不是textarea本身。这会将on-blur-handler绑定到您的编辑器实例:

You need to bind your handler to the editor instance not to the textarea itself. This binds an on-blur-handler to your editor instance:

var editor = CKEDITOR.instances['your_textarea_id'];

if (editor) {
    editor.on('blur', function(event) {
        // Do something, Example: disable toolbar:
        $("#cke_top_" + event.editor.name).css("display", "none");
    });
}   

(灵感来自skunkwerk @ cksource-forum。)

这篇关于ckeditor jquery插件和模糊事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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