I've been looking at the API and I can not figure out how to open the image dialog with a default url. I use the execCommand
function, as follows:
var editor = CKEDITOR.instances.editor1;
editor.execCommand ('image');
This works fine, but I want to give some value. I tested with:
editor.execCommand ('image', {
url: myrURL,
});
It does not work though. Please, I need help.
oleq
To set default value, you got to use the dialogDefinition
event to modify dialog fields (see this answer: How do I programatically set default table properties for CKEditor?).
To change the value dynamically:
CKEDITOR.replace( 'editor1', {
extraPlugins: 'devtools', // useful for dialog development
on: {
dialogShow: function ( evt ) {
var dialog = evt.data;
if ( dialog.getName() == 'image' )
dialog.setValueOf( 'info', 'txtUrl', 'http://foo.com' );
}
}
});
来源:https://stackoverflow.com/questions/17616605/ckeditor-open-image-properties-window-with-a-default-value