Skip to content

Conversation

@Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Oct 3, 2025

Summary:

Implement onPaste for TextInput. This is fairly heavy as it involves heavily refactoring the DataTransfer object that is created and sent to JS:

Notable changes:

  • Expose a dataTransferPayload method on HostPlatformViewEventEmitter. This means we now have a public method that returns a JSI::Value, which feels a bit odd.
  • Refactor the payload to not just be an array of items, but an object with files/iterms/types. This matches the paper implementation and roughly the DataTransfer Web API
  • Add a pastedTypes prop that matches paper to Fabric TextInput

Test Plan:

Existing example in Drag and drop test page still works, and returns the same object payload as paper.

@Saadnajmi Saadnajmi force-pushed the paste-textinput branch 2 times, most recently from 2476f7a to 35d1f10 Compare October 6, 2025 19:32
@Saadnajmi Saadnajmi changed the title feat(fabric): Implement Drag/Drop/Paste for TextInput feat(fabric): Implement Paste for TextInput Oct 7, 2025
Nick Lefever and others added 5 commits October 8, 2025 13:30
Summary: This diff refactors the data transfer item payload conversion logic to share it with `TextInputEventEmitter` paste event, allowing to implement the onPaste event emitters building the same payload as generated by the drag and drop implementation.

Test Plan: Tested later in this stack.

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53694921
Summary: Implement the file/image pasteboard pasting event for the `TextInput` component in Fabric. The payload for the event is the same as for the drag and drop events.

Test Plan:
* Run Zeratul with Fabric enabled
* Copy an image/file on the pasteboard
* Focus the message composer
* Paste the image/file and send the message

 https://pxl.cl/4lk92

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53694922
@Saadnajmi Saadnajmi marked this pull request as ready for review October 9, 2025 02:33
@Saadnajmi Saadnajmi requested a review from a team as a code owner October 9, 2025 02:33
@Saadnajmi Saadnajmi merged commit 1ae9a89 into microsoft:main Oct 9, 2025
21 checks passed
@Saadnajmi Saadnajmi deleted the paste-textinput branch October 9, 2025 22:14
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.

3 participants