Reputation: 79
I added 'Enhanced image',image2 plugin to my ckeditor and i have been trying to configure it to when the user chooses one image in file browser to automatically upload to server without the need for the user to click in send to server button. Does anyone know how to achieve that?
Thank you
Upvotes: 1
Views: 1320
Reputation: 79
I finally figure it out, although i`m sure that must exist a better way of doing this.
To upload image without the need of send to server button i had first to override CKEDITOR.ui.dialog.file.prototype.reset
CKEDITOR.ui.dialog.file.prototype.reset = function() {
//code
.$.write(['...',<input onchange="this.form.submit()" .../>, '...'])
//code
}
And then in my config.js dialogDefinition
var dialog = dialogDefinition.dialog;
var uploadButton = uploadTab.get('uploadButton');
if ( dialogName === 'image2') {
var filebrowserSe = dialog.getParentEditor()._.filebrowserSe = uploadButton;
filebrowserSe.getDialog = function() {return dialog};
uploadTab.remove('uploadButton');
//code ...
}
Upvotes: 1