2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-18 15:34:28 -06:00

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.
This commit is contained in:
Jeremy Fleischman 2019-07-29 02:49:36 -07:00
parent 02d6653cc5
commit efb840c633
No known key found for this signature in database
GPG Key ID: 19319CD8416A642B

View File

@ -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);
}