Skip to content

feat(chat): paste images into the composer - #1043

Merged
bmc08gt merged 1 commit into
mainfrom
feat/chat-paste-images
Oct 11, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
feat/chat-paste-images

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Images pasted into the chat composer now stage as photo chips. Both long-press Paste and the iOS 27 "Paste from Photos" keyboard suggestion work, and they go through the same staging as images dropped on the bar (ChatPhotoStaging.stageProvided, renamed from stageDropped).

Why the field edits attributed text

The keyboard suggestion only offers an image to a text view with allowsEditingTextAttributes on. With it off, tapping the suggestion does nothing and no paste callback fires. It also bypasses the view controller's paste(itemProviders:), so the hook has to be the field's own pasteDelegate.

ComposerImagePasteHandler is that delegate. ChatScreenViewController installs it on the composer's field when editing begins, because SwiftUI can rebuild the field. Image items are taken out of the text and batched to onImagesPasted, and everything else pastes as usual.

The chat still sends plain text, so rich text stays out of sight:

  • ChatScreenViewController.buildMenu(with:) removes Format from the edit menu.
  • Pasted text drops its source font and color and takes the field's style.

Behaviour to know about

  • In a chat that takes no photos, or while editing a message, a pasted image is dropped. Paste is still offered for an image-only clipboard there, matching how a drop is declined.
  • On iOS 27 the suggestion's "Photo" title sometimes renders black in our field. It does the same in the Claude app but not in Notes. The field's text color and typing attributes are white, and neither pinning them nor keyboardAppearance = .dark changed it.

Pasted images stage as photo chips through the same path as images dropped on the bar.
This covers long-press Paste and the iOS 27 "Paste from Photos" keyboard suggestion.

The suggestion only offers an image to a text view that edits attributed text, so the
composer's field now has allowsEditingTextAttributes on. Without it, tapping the
suggestion does nothing. The chat still sends plain text, so the screen removes Format
from the edit menu and pasted text drops its source styling.

When the chat takes no photos, or a message is being edited, a pasted image is
dropped rather than put in the text.
@bmc08gt bmc08gt self-assigned this Oct 11, 2026
@bmc08gt
bmc08gt merged commit a439124 into main Oct 11, 2026
2 of 3 checks passed
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.

1 participant