I'm not sure if this is possible with the event file.beforeUpload? Thoughts on how you would handle this for Froala? It's pretty critical for our current use.
If a function is passed to the imageUploadURL or fileUploadURL then call that function to dynamically return the url each time.
only accepts a string
N/A
N/A
N/A
Here's my "solution". I'd be interested to hear your thoughts on it.
opts = {
fileUploadURLFunc = function (return '/api/' + this.container().id + '/files';),
...
};
this.element.on('froalaEditor.file.beforeUpload', function(e, editor, files) {
editor.opts.fileUploadURL = editor.opts.fileUploadURLFunc();
}).froalaEditor(opts);
This seems to do the trick, but it feels odd to have to set an internal option before each upload. What are your thoughts on accepting a function as the value for fileUploadURL and imageUploadURL and then at runtime doing something like:
var uploadURL = typeof editor.opts.fileUploadURL === 'function' ? editor.opts.fileUploadURL() : editor.opts.fileUploadURL;
....
We are working on a feature to allow premises for image upload options and that will be available shortly. We use this repo mainly for bug tracking, therefore please contact us via our website for any feature request or tech question. 馃槃
Will do. I really appreciate your feedback. It's been invaluable to us over the last few weeks! Keep up the good work! 馃憤
Really looking forward to this feature, because I'd like to use clientside code to resize, compress and get Exif datas of images before uploading.
For now I'm trying to use this event:
$('.selector').on('froalaEditor.image.beforeUpload', function (e, editor, images) {
// Do something here.
});
But I don't know if I can return _modified_ files? The docs only say we can return false to abort upload.
We've just put together a public roadmap with the most popular features. 馃槏 There you can vote your favorite one, provide feedback or make new suggestions: https://wysiwyg-editor-roadmap.froala.com/public.
Most helpful comment
Really looking forward to this feature, because I'd like to use clientside code to resize, compress and get Exif datas of images before uploading.
For now I'm trying to use this event:
But I don't know if I can return _modified_ files? The docs only say we can return false to abort upload.