-
Notifications
You must be signed in to change notification settings - Fork 3k
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
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.
src/hooks/useHtmlPaste/index.ts
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/hooks/useHtmlPaste/index.ts
Outdated
@@ -1,6 +1,7 @@ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment and mentioned issue number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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