Fix `openBrowseFileWindow` to also obey `self.options.imageUploadFunction` if specified.

I think this part just got missed in
https://github.com/Ionaru/easy-markdown-editor/pull/106.

I'm not sure if I should be doing anything with the `onSuccess` and
`onError` callbacks here.
pull/109/head
Jeremy Fleischman 5 years ago
parent 02d6653cc5
commit efb840c633
No known key found for this signature in database
GPG Key ID: 19319CD8416A642B

@ -1985,7 +1985,11 @@ EasyMDE.prototype.openBrowseFileWindow = function (onSuccess, onError) {
var imageInput = this.gui.toolbar.getElementsByClassName('imageInput')[0];
imageInput.click(); //dispatchEvent(new MouseEvent('click')); // replaced with click() for IE11 compatibility.
function onChange(event) {
self.uploadImages(event.target.files, onSuccess, onError);
if (self.options.imageUploadFunction) {
self.uploadImagesUsingCustomFunction(self.options.imageUploadFunction, event.target.files);
} else {
self.uploadImages(event.target.files, onSuccess, onError);
}
imageInput.removeEventListener('change', onChange);
}

Loading…
Cancel
Save