Skip to content

Commit 6582b36

Browse files
committed
error messages
1 parent 7ccb783 commit 6582b36

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ var CloudinaryUploader = class extends import_obsidian2.Plugin {
26552655
const {files} = evt.clipboardData;
26562656
if (files.length == 0 && !files[0].type.startsWith("text")) {
26572657
editor.replaceSelection("Clipboard data is not an image\n");
2658-
} else if (this.settings.cloudName && this.settings.uploadPreset) {
2658+
} else if (this.settings.cloudName && this.settings.uploadPreset && files[0].type.startsWith("image")) {
26592659
for (let file of files) {
26602660
evt.preventDefault();
26612661
const randomString = (Math.random() * 10086).toString(36).substr(0, 8);
@@ -2681,7 +2681,7 @@ var CloudinaryUploader = class extends import_obsidian2.Plugin {
26812681
}
26822682
} else {
26832683
new import_obsidian2.Notice("Cloudinary Image Uploader: Please check the image hosting settings.");
2684-
editor.replaceSelection("Please check settings for upload");
2684+
editor.replaceSelection("Please check settings for upload\n This will also appear if file is not of image type");
26852685
}
26862686
}));
26872687
}

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class CloudinaryUploader extends Plugin {
3333
if (files.length == 0 && !files[0].type.startsWith("text")) {
3434
editor.replaceSelection("Clipboard data is not an image\n");
3535
}
36-
else if (this.settings.cloudName && this.settings.uploadPreset) {
36+
else if (this.settings.cloudName && this.settings.uploadPreset && files[0].type.startsWith("image")) {
3737
for (let file of files) {
3838
evt.preventDefault();
3939

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

6868
}))

0 commit comments

Comments
 (0)