在CKEditor对话框中收听单击事件

Ahm*_*oui 2 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>'
        }]
   };
 });
Run Code Online (Sandbox Code Playgroud)

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

谁知道我怎么做到这一点?提前致谢!

ole*_*leq 8

干得好:

{
    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 );
    }
}
Run Code Online (Sandbox Code Playgroud)

请参阅API以了解更多信息.