summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components/prompt-input
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/components/prompt-input')
-rw-r--r--packages/app/src/components/prompt-input/attachments.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/app/src/components/prompt-input/attachments.ts b/packages/app/src/components/prompt-input/attachments.ts
index 48eda3742..b384bf7d8 100644
--- a/packages/app/src/components/prompt-input/attachments.ts
+++ b/packages/app/src/components/prompt-input/attachments.ts
@@ -14,6 +14,7 @@ type PromptAttachmentsInput = {
setDraggingType: (type: "image" | "@mention" | null) => void
focusEditor: () => void
addPart: (part: ContentPart) => void
+ readClipboardImage?: () => Promise<File | null>
}
export function createPromptAttachments(input: PromptAttachmentsInput) {
@@ -76,6 +77,16 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
}
const plainText = clipboardData.getData("text/plain") ?? ""
+
+ // Desktop: Browser clipboard has no images and no text, try platform's native clipboard for images
+ if (input.readClipboardImage && !plainText) {
+ const file = await input.readClipboardImage()
+ if (file) {
+ await addImageAttachment(file)
+ return
+ }
+ }
+
if (!plainText) return
input.addPart({ type: "text", content: plainText, start: 0, end: 0 })
}