Skip to content

fix(prompt-input): paste a spreadsheet selection as text, not an image - #510

Open
HardMax71 wants to merge 1 commit into
vercel:mainfrom
HardMax71:fix/prompt-input-paste-text-with-image
Open

HardMax71 wants to merge 1 commit into
vercel:mainfrom
HardMax71:fix/prompt-input-paste-text-with-image

Conversation

@HardMax71

Copy link
Copy Markdown

handlePaste now returns before collecting files when the clipboard has both text/plain and text/html, which is what a spreadsheet or document selection looks like, so the textarea's default paste inserts the text. Screenshots and copied images keep attaching: for "Copy Image", Chrome, Firefox and Safari put the image and HTML on the clipboard but no text/plain (Chromium, Firefox, WebKit). A file copied in Finder brings its name as text/plain but no HTML, so it attaches too. I updated the feature list and added a changeset.

Two new tests in __tests__/prompt-input.test.tsx build the clipboard with a real DataTransfer. "pastes the text of a spreadsheet selection instead of its image" (text, HTML table and a PNG: nothing attached, default not prevented) fails on main and passes here. "attaches a copied file whose name is also on the clipboard as text" passes on both. The existing paste test's mock gets a getData. The full @repo/elements suite passes (960 tests).

Closes #509

@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@HardMax71 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PromptInput: pasting cells from Excel attaches an image instead of the text

1 participant