Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to enforce pasting plain text #1429

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

christophpurrer
Copy link

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

There are use cases in which we want to ignore the base class [NSTextView readablePasteboardTypes] return values, which mostly, include RTF and formatted URL types.
We want to ignore them in favor of plain text (NSPasteboardTypeString).

This change allows to opt into a custom list of supported paste types.

This is a follow-up to #1350

Changelog

[macOS] [Added] - Add option to enforce pasting plain text

Test Plan

No rich text formatting anymore

Screen.Recording.2022-09-08.at.3.30.01.PM.mov

Test case from #1350 still work

Screen.Recording.2022-09-08.at.3.30.29.PM.mov

@christophpurrer christophpurrer force-pushed the pasteBoardTypes branch 2 times, most recently from ffab1c5 to d53b633 Compare September 12, 2022 18:22
React/Base/RCTConvert.m Outdated Show resolved Hide resolved
@christophpurrer
Copy link
Author

Updated test case based on recent comments

720.mov

Copy link
Collaborator

@Saadnajmi Saadnajmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Would reverse the order of the TextInputs in the example so that the one that can take images is closer to the image preview. Otherwise should be good after merge conflicts are resolved :)

@christophpurrer
Copy link
Author

Nit: Would reverse the order of the TextInputs in the example so that the one that can take images is closer to the image preview. Otherwise should be good after merge conflicts are resolved :)

Sure. Let's do this

There are use cases in which we want to ignore the base class [NSTextView readablePasteboardTypes] return values, which mostly, include RTF and formatted URL types
We want to ignore them in favor of plain text (NSPasteboardTypeString).

This change allows to opt into a custom list of supported paste types.

This is a follow-up to microsoft#1350
@Saadnajmi Saadnajmi enabled auto-merge (squash) September 21, 2022 15:49
@Saadnajmi Saadnajmi merged commit d8612d0 into microsoft:main Sep 21, 2022
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 13, 2022
…edType property is used

In microsoft#1429 I had naively assumed that `NSPasteboardTypeFileURL` is 1:1 replacement for the deprecated `NSFilenamesPboardType` property. It is not. It causes drag and drop of files from Finder to stop working.
Saadnajmi pushed a commit that referenced this pull request Oct 18, 2022
…edType property is used (#1452)

In #1429 I had naively assumed that `NSPasteboardTypeFileURL` is 1:1 replacement for the deprecated `NSFilenamesPboardType` property. It is not. It causes drag and drop of files from Finder to stop working.
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Feb 13, 2023
There are use cases in which we want to ignore the base class [NSTextView readablePasteboardTypes] return values, which mostly, include RTF and formatted URL types
We want to ignore them in favor of plain text (NSPasteboardTypeString).

This change allows to opt into a custom list of supported paste types.

This is a follow-up to microsoft#1350
# Conflicts:
#	Libraries/Components/TextInput/TextInput.js
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Feb 13, 2023
…dTypes property is used

In microsoft#1429 I had naively assumed that `NSPasteboardTypeFileURL` is 1:1 replacement for the deprecated `NSFilenamesPboardType` property. It is not. It causes drag and drop of files from Finder to stop working when a pastedTypes property is set.
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Feb 13, 2023
There are use cases in which we want to ignore the base class [NSTextView readablePasteboardTypes] return values, which mostly, include RTF and formatted URL types
We want to ignore them in favor of plain text (NSPasteboardTypeString).

This change allows to opt into a custom list of supported paste types.

This is a follow-up to microsoft#1350
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Mar 10, 2023
There are use cases in which we want to ignore the base class [NSTextView readablePasteboardTypes] return values, which mostly, include RTF and formatted URL types
We want to ignore them in favor of plain text (NSPasteboardTypeString).

This change allows to opt into a custom list of supported paste types.

This is a follow-up to microsoft#1350
# Conflicts:
#	Libraries/Components/TextInput/TextInput.js
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Mar 10, 2023
…dTypes property is used

In microsoft#1429 I had naively assumed that `NSPasteboardTypeFileURL` is 1:1 replacement for the deprecated `NSFilenamesPboardType` property. It is not. It causes drag and drop of files from Finder to stop working when a pastedTypes property is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants