Skip to content

Commit b975c61

Browse files
committed
fix issue where plaintext might also be pasted with error code
1 parent 843b6a2 commit b975c61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,7 @@ var CloudinaryUploader = class extends import_obsidian2.Plugin {
26532653
setupPasteHandler() {
26542654
this.registerEvent(this.app.workspace.on("editor-paste", async (evt, editor) => {
26552655
const {files} = evt.clipboardData;
2656-
if (files.length == 0 || !files[0].type.startsWith("image")) {
2656+
if (files.length == 0 && !files[0].type.startsWith("text")) {
26572657
editor.replaceSelection("Clipboard data is not an image\n");
26582658
} else if (this.settings.cloudName && this.settings.uploadPreset) {
26592659
for (let file of files) {

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class CloudinaryUploader extends Plugin {
3030
setupPasteHandler(): void {
3131
this.registerEvent(this.app.workspace.on('editor-paste',async (evt: ClipboardEvent, editor: Editor)=>{
3232
const { files } = evt.clipboardData;
33-
if (files.length == 0 || !files[0].type.startsWith("image")) {
33+
if (files.length == 0 && !files[0].type.startsWith("text")) {
3434
editor.replaceSelection("Clipboard data is not an image\n");
3535
}
3636
else if (this.settings.cloudName && this.settings.uploadPreset) {

0 commit comments

Comments
 (0)