CKeditor Colorbox Integration

2019-07-17 09:55发布

问题:

I want to use colorbox inline image, which can be done using http://website-design.operationenterprise.com/articles/website-development/colorbox-ckeditor-drupal-7, but I want to automate the the process for it to be user friendly.

The code I used

    CKEDITOR.on( 'dialogDefinition', function( ev )
{

var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;


if ( dialogName == 'image' )
{
var linkTab = dialogDefinition.getContents( 'info' );
var link = linkTab.get( 'txtUrl' );

link['onChange'] = function(evt){
var dialog = CKEDITOR.dialog.getCurrent();
dialog.getContentElement('Link', 'txtUrl').setValue(dialog.getContentElement('info', 'txtUrl').getValue());
  }

if ( dialogName == 'link' )
    {

        var infoTab = dialogDefinition.getContents( 'advanced' );


        var cssField = infoTab.get( 'advCSSClasses' );
        cssField['default'] = 'colorbox-load';
    }
}
});

Copying url in image-link tab tab worked fine but setting default css in Link dialog didnot.

I am no Java developer, so What am i doing wrong

PLease HELP