2

以下を使用してカスタム ダイアログ ボックスを追加した 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>'
        }]
   };
 });

ダイアログ ボックス内のリンクに「クリック」イベント リスナーを追加したいと考えています。そのリンクをクリックすると、コンテンツがテキストレアに挿入されます (ダイアログ ボックスも閉じます)。

誰も私がこれを行う方法を知っていますか? 前もって感謝します!

4

1 に答える 1

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

詳細については、APIを参照してください。

于 2013-07-24T12:50:55.997 に答える