Skip to content

feat(fabric): Implement Paste for TextInput - #2715

Merged
Saad Najmi (Saadnajmi) merged 17 commits into
microsoft:mainfrom
Saadnajmi:paste-textinput
Oct 9, 2025
Merged

feat(fabric): Implement Paste for TextInput#2715
Saad Najmi (Saadnajmi) merged 17 commits into
microsoft:mainfrom
Saadnajmi:paste-textinput

Conversation

@Saadnajmi

@SaadnajmiSaad Najmi (Saadnajmi) commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

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
Saad Najmi (Saadnajmi)force-pushed the paste-textinput branch 2 times, most recently from 2476f7a to 35d1f10CompareOctober 6, 2025 19:32
@SaadnajmiSaad Najmi (Saadnajmi) changed the title feat(fabric): Implement Drag/Drop/Paste for TextInputfeat(fabric): Implement Paste for TextInputOct 7, 2025
Nick Lefeverand 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
Saad Najmi (Saadnajmi) marked this pull request as ready for review October 9, 2025 02:33
@Saadnajmi
Saad Najmi (Saadnajmi) requested a review from a team as a code ownerOctober 9, 2025 02:33
…w/RCTViewComponentView.mm
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
@Saadnajmi
Saad Najmi (Saadnajmi) merged commit 1ae9a89 into microsoft:mainOct 9, 2025
21 checks passed
@Saadnajmi
Saad Najmi (Saadnajmi) deleted the paste-textinput branch October 9, 2025 22:14
Sign up for freeto 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

@Saadnajmi@tido64@shwanton