fix: support pasting images from clipboard in chat (#209) - #214
Open
kaixinbaba wants to merge 1 commit into
Open
fix: support pasting images from clipboard in chat (#209)#214kaixinbaba wants to merge 1 commit into
kaixinbaba wants to merge 1 commit into
Conversation
kaixinbaba
force-pushed
the
fix/issue-209-clipboard-paste
branch
2 times, most recently
from
March 13, 2026 16:44
6a19a88 to
920b567
Compare
Author
|
paste image screen record paste_test.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #209 — Copy and Pasting Images from Clipboard Does Not Work
Problem
When a user copies an image (e.g. a screenshot via Cmd+Shift+4 or Ctrl+PrtSc) and presses Ctrl+V / Cmd+V in the chat textarea, nothing happened. The chat input had no
onPastehandler to intercept clipboard image data.Solution
Added a
handlePastecallback tolib/chat/components/chat-input.jsxthat:e.clipboardData.itemsfor any items with animage/*MIME typee.preventDefault()to suppress default browser paste behaviorFileobject viaitem.getAsFile()handleFileshelper — the same path used by the file picker and drag-and-drop — so images appear in the attachment preview strip before sendingNo new dependencies. The fix is minimal and consistent with the existing file attachment flow.
Testing