监听CKEditor对话框中的单击事件 [英] Listen to click events inside CKEditor dialog

查看:181
本文介绍了监听CKEditor对话框中的单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ckeditor实例,在其中添加了一个自定义对话框,使用:

I have a ckeditor instance, to which I added a custom dialog box using:

CKEDITOR.dialog.add('quicklinkDialog', function(editor) {
   return {
     title: 'Quick Links',
     minWidth: 400,
     minHeight: 200,

     contents: [
       {
        id: 'tab1',
        label: 'Add a quick link',
        elements: [
        {
         type: 'html',
         html: '<p>This is some text and then: <a href="">Click me!</a></p>'
        }]
   };
 });

我想在对话框内的链接上添加一个 click事件监听器。单击该链接后,内容将插入到我的textrea中(对话框也将关闭)。

I want to add a "click" event listener on the link inside my dialog box. When that link is clicked, content will be inserted into my textrea (the dialog box will also be closed).

谁知道我该怎么做?提前致谢!

Anyone knows how I might do this? Thanks in advance!

推荐答案

在这里:

{
    type: 'html',
    html: '<p>This is some text and then: <a href="">Click me!</a></p>',
    onLoad: function( a ) {
        CKEDITOR.document.getById( this.domId ).on( 'click', function() {
            var dialog = this.getDialog();
            dialog.hide();
            dialog._.editor.insertHtml( this.html );
        }, this );
    }
}

请参见 API 了解更多信息。

这篇关于监听CKEditor对话框中的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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