From efb840c6332a8137491efce3a813ead070d94d29 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Mon, 29 Jul 2019 02:49:36 -0700 Subject: [PATCH] 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. --- src/js/easymde.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/easymde.js b/src/js/easymde.js index 5e2376c..976328a 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -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); }