Bail out if there are no files to upload.

Without this change, if you either:
  - Click and drag some text into the markdown editor, or
  - Copy paste some text into the markdown editor

The status bar will get updated to say "Uploading image ...", and will
never stop.
pull/109/head
Jeremy Fleischman 5 years ago
parent efb840c633
commit 8a2283cf27
No known key found for this signature in database
GPG Key ID: 19319CD8416A642B

@ -1669,6 +1669,9 @@ function EasyMDE(options) {
* @param [onError] {function} see EasyMDE.prototype.uploadImage
*/
EasyMDE.prototype.uploadImages = function (files, onSuccess, onError) {
if (files.length === 0) {
return;
}
var names = [];
for (var i = 0; i < files.length; i++) {
names.push(files[i].name);
@ -1688,6 +1691,9 @@ EasyMDE.prototype.uploadImages = function (files, onSuccess, onError) {
* @param {FileList} files The files to upload the the server.
*/
EasyMDE.prototype.uploadImagesUsingCustomFunction = function (imageUploadFunction, files) {
if (files.length === 0) {
return;
}
var names = [];
for (var i = 0; i < files.length; i++) {
names.push(files[i].name);

Loading…
Cancel
Save