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

Added useRawValueOnCopy prop #723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bruno-campos
Copy link

Added useRawValueOnCopy prop

What did you change (functionally and technically)?

Added a new prop: useRawValueOnCopy

The default value is false and it won't change any behavior.

When that is set to true, when performing a copy/cut, instead of copying the content without tags to the clipboard, it will copy the raw content with tags. So for example, if I have the following:

Hi %{name}, how are you?

That is displayed like:

Hi Name, how are you?

The copied content in the clipboard with the prop on will be: Hi %{name}, how are you?. The default behavior is to copy Hi Name, how are you? to the clipboard.

This is a real use case need, where users might copy the text content and send to others for review, or paste into translation tools. When having the tags around the content, translation tools will ignore it and also, people reviewing or changing the content outside the app will be aware of the tags.

Any feedback is appreciated :) Thanks for the awesome repo. If this goes live, I can update the DefinitelyTyped repo as well.

Copy link

changeset-bot bot commented Dec 21, 2023

🦋 Changeset detected

Latest commit: 7849646

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-mentions Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-mentions ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 21, 2023 2:07am

@mrdjohnson
Copy link

👋 I am not related to this project, was just reading some PRs and had some thoughts

Starting a variable with "use" gives off the impression of it being a hook, based on other props in this project, could we consider a name like "shouldCopyRawValue"?

This could definitely be my own shortcomings but: "rawValue" is not clear at all. I see now it's about the preInterpolated text but, was not clear to me and I had to read the code (not the docs) to understand. (Could just be me of course)

Curious: what happens if someone copies half of a name? There is a "shouldAllowSpaces" prop, if that's on, and this is on, and we have the text: "@john Doe is not here today" and I copy "Doe is not here today" ..what would the result be?

Feel free to ignore, just dropping in, good luck on the PR!

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.

2 participants