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

Allow copying only a selection of text #2753

Merged
merged 5 commits into from
May 11, 2021

Conversation

Viacheslav80
Copy link
Contributor

Details

we get selection when the event of contextmenu is triggered. window.getSelection().toString();

Fixed Issues

Fixes #2665

Tests

  1. Some part of the chat text is selected with the mouse
  2. The selected text is right clicked over
  3. "copy to clipboard" is chosen
  4. Only the selected text is copied to the clipboard

QA Steps

Same as above

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

https://drive.google.com/uc?export=view&id=1WFtc-t6NuaLDZ1xM016ggYxfCUhxjJUb

Mobile Web

Desktop

https://drive.google.com/uc?export=view&id=1EJUC7rZFNFFCraIcqLDCIJzBGObdMfeN

iOS

Android

@Viacheslav80 Viacheslav80 requested a review from a team as a code owner May 8, 2021 11:31
@MelvinBot MelvinBot requested review from francoisl and removed request for a team May 8, 2021 11:31
@francoisl francoisl changed the title Viacheslav select text Allow copying only a selection of text May 10, 2021
@@ -90,9 +91,10 @@ class ReportActionItem extends Component {
*
* @param {Object} [event] - A press event.
*/
showPopover(event) {
showPopover(event, selection) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a @param JSDoc for selection please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@@ -54,7 +54,7 @@ class ReportActionContextMenu extends React.Component {
onPress: () => {
const message = _.last(lodashGet(this.props.reportAction, 'message', null));
const html = lodashGet(message, 'html', '');
const text = lodashGet(message, 'text', '');
const text = props.selection || lodashGet(message, 'text', '');
Copy link
Contributor

Choose a reason for hiding this comment

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

selection needs to be defined in the propTypes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Viacheslav80
Copy link
Contributor Author

Viacheslav80 commented May 11, 2021

Updated

@francoisl francoisl merged commit 20b0791 into Expensify:main May 11, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.42-1🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.44-0🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

[HOLD for payment on May 18th] Allow copying only a selection of text
3 participants