javascript - 监听 CKEditor 对话框中的点击事件

标签 javascript dialog ckeditor

我有一个 ckeditor 实例,我使用以下方法向其添加了一个自定义对话框:

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>'
        }]
   };
 });

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

有人知道我该怎么做吗?提前致谢!

最佳答案

给你:

{
    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了解更多。

关于javascript - 监听 CKEditor 对话框中的点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17833291/

相关文章:

javascript - 如何在用户身份验证后打开新窗口并提取参数

java - 如何获取另一个fragment中EditText中TimePickerDialog的时间?

java - 单击按钮后显示小窗口

javascript - 如何在 React Redux 应用程序中打开和关闭内联对话框

javascript - jQuery 移动/Flot/resize.js

javascript - Meteor:在页面加载时获取路由参数

javascript - 您可以使用 Jquery 来模拟选择列表中某个项目的点击事件吗?

java - 在ZK中如何在标签中显示html内容?

javascript - CKEDITOR 意外地剥离了我在 HTML 表格中的自定义标签

javascript - CKEditor 在服务器上返回错误的图像路径