I need to add some custom data to upload request in Upload image dialog.
At the moment I've came up with a solution that looks more like a hack:
in plugins/image/dialogs/image.js I extended Upload tab
{
type: 'fileButton',
id: 'uploadButton',
filebrowser: {
target: 'info:txtUrl',
action: 'QuickUpload',
params: { insert_thumbnail: true }
},
label: editor.lang.image.btnUpload,
'for': [ 'Upload', 'upload' ]
},
{
type: 'checkbox',
id: 'insertThumb',
label: 'Insert as thumbnail',
'default': 'checked',
onChange: function() {
var form = this.getDialog().getContentElement( 'Upload', 'upload' ).getInputElement().getParent().$;
form.action = form.action.replace( /insert_thumbnail=[^&]+/, 'insert_thumbnail=' + this.getValue() );
}
}
]
Is there a more elegant way to get this done?