Skip to content

Commit

Permalink
error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanhandy committed Nov 21, 2021
1 parent 7ccb783 commit 6582b36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ var CloudinaryUploader = class extends import_obsidian2.Plugin {
const {files} = evt.clipboardData;
if (files.length == 0 && !files[0].type.startsWith("text")) {
editor.replaceSelection("Clipboard data is not an image\n");
} else if (this.settings.cloudName && this.settings.uploadPreset) {
} else if (this.settings.cloudName && this.settings.uploadPreset && files[0].type.startsWith("image")) {
for (let file of files) {
evt.preventDefault();
const randomString = (Math.random() * 10086).toString(36).substr(0, 8);
Expand All @@ -2681,7 +2681,7 @@ var CloudinaryUploader = class extends import_obsidian2.Plugin {
}
} else {
new import_obsidian2.Notice("Cloudinary Image Uploader: Please check the image hosting settings.");
editor.replaceSelection("Please check settings for upload");
editor.replaceSelection("Please check settings for upload\n This will also appear if file is not of image type");
}
}));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class CloudinaryUploader extends Plugin {
if (files.length == 0 && !files[0].type.startsWith("text")) {
editor.replaceSelection("Clipboard data is not an image\n");
}
else if (this.settings.cloudName && this.settings.uploadPreset) {
else if (this.settings.cloudName && this.settings.uploadPreset && files[0].type.startsWith("image")) {
for (let file of files) {
evt.preventDefault();

Expand Down Expand Up @@ -62,7 +62,7 @@ export default class CloudinaryUploader extends Plugin {
}
else {
new Notice("Cloudinary Image Uploader: Please check the image hosting settings.");
editor.replaceSelection("Please check settings for upload");
editor.replaceSelection("Please check settings for upload\n This will also appear if file is not of image type");
}

}))
Expand Down

0 comments on commit 6582b36

Please sign in to comment.