Log in or register to post comments
How to set custom attribute on link save
Hi,

I've extended the Link dialog by adding a custom text input:

CKEDITOR.on( "dialogDefinition", function( ev )   {
      var dialogName = ev.data.name;
      var dialogDefinition = ev.data.definition;
        var dialog     = ev.data.definition.dialog;
        
        if ( dialogName == "link" ) {
            dialogDefinition.addContents({
               id : 'myTab',
               label : 'MyTabLabel',
               accessKey : 'M',
               elements: [{
                                type: 'hbox',
                                widths : [ '100%'],
                                children : [
                                        {
                                            id : 'myField',
                                            type : 'text',
                                            label : 'My Field',
                                            setup: function (data) {
                                                this.setValue('initial value');
                                            },
                                            commit: function(data) {
                                                data['my_field'] = this.getValue();
                                            }               
                                        }
                                      ]
               }               
               ]
               });        
        }
});


I am wondering how to set a custom attribute to the <a> tag generated when the "OK" button of the dialog is pressed.

i.e.

the resulting <a> tag should be something like

<a .other.attrs.set.by.the.dialog data-custom="my_value_from_the_myField_input">....


thanks for any help