Repository navigation
feat(chat): paste images into the composer - #1043
Merged
Merged
Conversation
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.
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.
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 fromstageDropped).Why the field edits attributed text
The keyboard suggestion only offers an image to a text view with
allowsEditingTextAttributeson. With it off, tapping the suggestion does nothing and no paste callback fires. It also bypasses the view controller'spaste(itemProviders:), so the hook has to be the field's ownpasteDelegate.ComposerImagePasteHandleris that delegate.ChatScreenViewControllerinstalls 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 toonImagesPasted, 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.Behaviour to know about
keyboardAppearance = .darkchanged it.