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

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

View File

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