Showing posts with label ckeditor. Show all posts
Showing posts with label ckeditor. Show all posts

Wednesday, 22 August 2018

Ckeditor add force download option in dialog

CKEDITOR.on( 'dialogDefinition', function( evt ) {
   var dialog = evt.data;

   if ( dialog.name == 'link' ) {
       // Get dialog definition.
       var def = evt.data.definition;         
       // Add some stuff to definition.
       
       
       
       var infoTab = def.getContents( 'info' );
       
       infoTab.add( {
type: 'checkbox',
id: 'download',
requiredContent: 'a[download]',
label: "Force Download",
setup: function( data ) {
if ( data.download !== undefined )
this.setValue( 'checked', 'checked' );
},
commit: function( data ) {
if ( this.getValue() ) {
data.download = this.getValue();
}
}
});

   }
} );

CKEDITOR.replace( 'editor' );