Web - Chat - Pasted message not always displays no hyperlink format w…#55932
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: Nativema1.webmAndroid: mWeb Chromema1.webmiOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-02-06.at.11.43.39.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-02-06.at.11.43.39.mp4MacOS: Chrome / SafariScreen.Recording.2025-02-03.at.17.25.03.movMacOS: Desktop |
|
@prakashbask Please merge branch with the latest main and consider checking on this once. |
@Pujan92 I don't have access to Slack as it has not been provided yet. |
|
Ok, let's merge main and if we found those bad commits then follow this slack thread. |
…hen paste as plain text
ab990de to
4886fb1
Compare
|
@Pujan92 Ok. I was able to sync and pull to my main without any issues as my main was behind. Hence, I have rebased my feature branch and pushed it again. |
|
@prakashbask I see an issue with copying from native and pasting it to a web(bcoz it will fall into issue.webm |
@Pujan92 Yes. This is an issue from native -> web pasting. We may have to set a context here to preserve the original text. This preserveOriginal flag will then be used in handlePastePlainText to determine if conversion to plain text is required or fallback to default case. Any other suggestions? |
I am not getting how that context will help here. Bcoz it depends on what paste option the user has selected. |
react-native-clipboard/clipboard supports setting the string in text/plain option. There is no text/html option available. Hence, handlePastePlainText function will be called irrespective of the paste option the user has selected. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
| paste(plainText); | ||
| const markdownText = event.clipboardData?.getData('text/plain'); | ||
| if (markdownText) { | ||
| paste(Parser.htmlToText(Parser.replace(markdownText))); |
There was a problem hiding this comment.
| paste(Parser.htmlToText(Parser.replace(markdownText))); | |
| if(isMobile) { | |
| paste(markdownText); | |
| } else { | |
| paste(Parser.htmlToText(Parser.replace(markdownText))); | |
| } |
One option is to check for isMobile, if it is a mobile then don't convert it to the plainText by considering we don't have an option "Paste as plain text" in mobile.
| import {useCallback, useEffect} from 'react'; | ||
| import Parser from '@libs/Parser'; | ||
| import CONST from '@src/CONST'; | ||
| import isMobile from '@src/utils/isMobile'; |
There was a problem hiding this comment.
| import isMobile from '@src/utils/isMobile'; | |
| import isMobile from '@libs/Browser'; |
We can use isMobile from @libs/browser
| paste(plainText); | ||
| const markdownText = event.clipboardData?.getData('text/plain'); | ||
| if (markdownText) { | ||
| const parsedText = isMobile() ? markdownText : Parser.htmlToText(Parser.replace(markdownText)); |
There was a problem hiding this comment.
Please add a comment about why we need to do this and also provide a link to the issue in the comment
There was a problem hiding this comment.
Added comment and mentioned issue number.
Pujan92
left a comment
There was a problem hiding this comment.
LGTM!
@jasperhuangg plz consider checking the change we need to make to fulfill all platforms.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/jasperhuangg in version: 9.0.95-0 🚀
|
|
Failing in mweb with original bug id #53718 |
[CP Staging] Revert "Merge pull request #55932 from prakashbask/fix/53718"
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.95-6 🚀
|
|
🚀 Deployed to staging by https://github.com/jasperhuangg in version: 9.0.96-0 🚀
|
|
@prakashbask Failing with original bug id #53718 on Web and mWeb |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.96-1 🚀
|
Explanation of Change
Fixed Issues
$ #53718 , #53832
PROPOSAL: #53718 (comment) , #53832 (comment)
Tests
Test Scenario 1
Test Scenario 2
strikeor italic or bold and send messageOffline tests
NA
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
androidHybrid.mov
Android: mWeb Chrome
androidChrome.mp4
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
macOSSafari.mp4
MacOS: Desktop
macOSDesktop.mp4