-
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
fix: unify word breaking in ContextMenuItem for Android mweb and Android native #31116
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
56ca0a0
fix: unify word breaking in ContextMenuItem for Android mweb and Andr…
artus9033 81a5065
refactor: extracted trimMailTo and prefixMailSeparatorsWithBreakOppor…
artus9033 4435513
Moved trimMailTo and prefixMailSeparatorsWithBreakOpportunities to sr…
artus9033 5226d6a
Merge branch 'main' of github.com:Expensify/App into proposal/30985
artus9033 1b49dec
Refactored src/libs/EmailUtils.ts - added additional explanation for …
artus9033 1af318e
Fixed lint problems in EmailUtils
artus9033 3a73628
Merge branch 'main' of github.com:Expensify/App into proposal/30985
artus9033 85889eb
Merge branch 'main' of github.com:Expensify/App into proposal/30985
artus9033 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Trims the `mailto:` part from mail link. | ||
* @param mailLink - The `mailto:` link to be trimmed | ||
* @returns The email address | ||
*/ | ||
function trimMailTo(mailLink: string) { | ||
return mailLink.replace('mailto:', ''); | ||
} | ||
|
||
/** | ||
* Prepends a zero-width space (U+200B) character before all `.` and `@` characters | ||
* in the email address to provide explicit line break opportunities for consistent | ||
* breaking across platforms. | ||
* | ||
* Note: as explained [here](https://github.com/Expensify/App/issues/30985#issuecomment-1815379835), | ||
* this only provides opportunities for line breaking (rather than forcing line breaks) that shall | ||
* be used by the platform implementation when there are no other customary rules applicable | ||
* and the text would otherwise overflow. | ||
* @param email - The email address to be sanitized | ||
* @returns The email with inserted line break opportunities | ||
*/ | ||
function prefixMailSeparatorsWithBreakOpportunities(email: string) { | ||
return email.replace( | ||
/([.@])/g, | ||
// below: zero-width space (U+200B) character | ||
'$1', | ||
); | ||
} | ||
|
||
export default {trimMailTo, prefixMailSeparatorsWithBreakOpportunities}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Adding a zero-width space to email caused it issue when email is copied by user and pasted in other places, especially login page - #34437