-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[HOLD for payment 2023-04-05] [$2000] Web - Chat- Line breaks are removed after special copy/paste scenario #15925
Comments
Triggered auto assignment to @davidcardoza ( |
Bug0 Triage Checklist (Main S/O)
|
reproducible on web, getting this assigned out. |
Job added to Upwork: https://www.upwork.com/jobs/~01728b823abb3cdacb |
Current assignee @davidcardoza is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
Triggered auto assignment to @grgia ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Line break is removed when we copy the selected text from context menu "Copy to clipboard". What is the root cause of that problem?When we copy a message from mouse selection, remove all \n with an empty string here. App/src/pages/home/report/ReportActionItem.js Lines 126 to 129 in 8baeab7
If we look at the comment, the reason behind it because the HTML may contain
In this case, the html when we select it will be
If we don't include markdown, the So, the What changes do you think we should make in order to solve the problem?Instead of replacing the new line with empty string, we should replace the Note: we can replace the |
ProposalPlease re-state the problem that we are trying to solve in this issue.When we use the "Copy to clipboard" function from the context menu to copy selected text, the line break is not included in the copied text. What is the root cause of that problem?What we are currently expecting is that every intentional line breaks are represented by a The HTML representation is then used to parse the HTML content. The thing is, for cases with markdown text, it is rendering correctly if a new line comes after the markdown, since the result of this function ... Copied text:
Result of
Notice they have elements between the lines. This is becase the app is rendering these tags within the content of the selected element. Meanwhile, for simple text case, the current logic of Copied text:
Result of
Notice the new line is not represeted with What changes do you think we should make in order to solve the problem?We should check that if the selected element is a simple text, then we will replace the text // This means "range.commonAncestorContainer" is a text node. We simply get its parent node.
if (!node) {
node = range.commonAncestorContainer.parentNode;
+ newFragment = document.createRange().createContextualFragment(clonedSelection.textContent.replace(/\n/g, '<br/>'))
} then, we can add the node with - node.appendChild(clonedSelection);
+ if (newFragment)
+ node.appendChild(newFragment);
+ else
+ node.appendChild(clonedSelection);
AlternativeAlternatively, instead of replacing ResultWorking well after the fix Screen.Recording.2023-03-14.at.11.53.38.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.Line break is removed when we copy the selected text from the context menu "Copy to clipboard". What is the root cause of that problem?As other people mentioned above, the root cause is from this line App/src/pages/home/report/ReportActionItem.js Lines 126 to 129 in 8baeab7
According to the code comment, I think the current code is wrong. The author concerned about Example: a
b the function getCurrentSelection() will return:
What changes do you think we should make in order to solve the problem?- const selection = SelectionScraper.getCurrentSelection().replace(/\n/g, '');
+ const selection = SelectionScraper.getCurrentSelection().replace(/<br>\n/g, '<br>'); |
📣 @hoangzinh! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Format:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
Thanks for the proposal @bernhardoj . Please go through the issue for which the line you are pointing out is introduced. Your proposed change will recreate #12769. |
Thanks for the proposal @tienifr and @hoangzinh . Looks like both the proposal will solve the issue. Proposal from @hoangzinh looks interesting. This line was introduced to remove double lines when Proposal from @hoangzinh looks good to me. @hoangzinh Please make sure that your changes will not reproduce #12769 and #14243 issue. Also please make sure to test your PR on test steps in #13739 PR. cc: @grgia 🎀👀🎀 C+ reviewed |
@sobitneupane I can't reproduce the issue you mentioned. Here is my reproduction attempt video Screen.Recording.2023-03-17.at.01.22.39.mov |
I think my proposal has more consistency, and will not only address the root cause but also prevent similar unexpected errors in the future. In my solution, all expected new line will be treated as |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.91-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-04-05. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
will the payment be issued today/this week? |
@sobitneupane would you mind filling out the BZ checklist? Otherwise ping me if you need to offload it |
@davidcardoza mind checking on the payments for this one? |
I don't think any other changes are required in reviewer checklist. It was missed case while reviewing the issue. It should have been caught by reviewer(me) in the PR. |
@hoangzinh Contract sent via Upwork |
Not overdue, awaiting payment (?) |
Payment was sent, we can close. |
@davidcardoza I don't think I have received the payment yet. |
@davidcardoza am I not eligible for reporting issue? |
@sobitneupane @mdneyazahmad Contracts sent |
Accepted. |
Accepted |
1 similar comment
Accepted |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The user should be able to use copy/paste without any issues
Actual Result:
Line breaks are removed from the copied text
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.83.1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug5976486_select_cursor.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team and @mdneyazahmad
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: