I am using the enhanced image plugin on ckeditor 4.4.4 and cannot seem to set default values for align, caption, and/or width. I have successfully set defaults on the table dialog but the same syntax doesn't seem to work for image2. What am I doing wrong?
CKEDITOR.on('dialogDefinition', function (e) {
var dialogName = e.data.name;
var dialog = e.data.definition.dialog;
var dialogDefinition = e.data.definition;
//mod image2 dialog, hide URL source, set default align and width
if (dialogName == "image2") {
dialog.on('show', function() {
this.getContentElement('info', 'src').disable(); //<-- works
});
var infoTab = dialogDefinition.getContents('info');
var imageAlign = infoTab.get('align');
imageAlign['default'] = 'center';
var imageWidth = infoTab.get('width');
imageWidth['default'] = '300';
var imageCaption = infoTab.get('hasCaption');
imageCaption['default'] = 'checked';
}

Figured it out. I needed to
Figured it out. I needed to set the values in the upload response, like how it's done in the File Browser API documentation.
<script>window.parent.CKEDITOR.tools.callFunction('MyEditor', 'imageurl', function() { var element, dialog = this.getDialog(); if (dialog.getName() == 'image2') { //set the alt text element = dialog.getContentElement('info','alt'); if (element) element.setValue('world.jpg'); //add caption element = dialog.getContentElement('info','hasCaption'); if (element) element.setValue('checked'); //center the image element = dialog.getContentElement('info','align'); if (element) element.setValue('center'); } });</script>