I use django and ckeditor to provide wysiwyg taste to TextEdits. I would like to use CKEditor file upload function (in filebrowser / image dialog), but the
I experienced a similar problem when integrating image uploading through CKEditor for Elgg. The least intrusive solution I came up with was to bind to the onClick event for the submit button and modify the form directly from that:
CKEDITOR.on('dialogDefinition', function (ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName === 'image') {
var uploadTab = dialogDefinition.getContents('Upload');
for (var i = 0; i < uploadTab.elements.length; i++) {
var el = uploadTab.elements[i];
if (el.type !== 'fileButton') {
continue;
}
// add onClick for submit button to add inputs or rewrite the URL
var onClick = el.onclick;
el.onClick = function(evt) {
var dialog = this.getDialog();
var fb = dialog.getContentElement(this['for'][0], this['for'][1]);
var action = fb.getAction();
var editor = dialog.getParentEditor();
editor._.filebrowserSe = this;
// if using jQuery
$(fb.getInputElement().getParent().$).append('');
// modifying the URL
fb.getInputElement().getParent().$.action = '/my/new/action?with&query¶ms=1';
if (onClick && onClick.call(evt.sender, evt) === false) {
return false;
}
return true;
};
}
}
});