-
Notifications
You must be signed in to change notification settings - Fork 136
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
update htmlToMarkdownRules userMention and reportMention #741
update htmlToMarkdownRules userMention and reportMention #741
Conversation
Bugadd some text after the mention or more than one mention not pasted correctly. video20240704205333017.mp4like the main root cause, it seems browser We write to clipboard here. And get clipboard data here // coping value as text/html
<mention-report reportID="1234" /> text after
// paste value as text/html
<mention-report reportID="1234"> text after</mention-report>
// coping value as text/html
<mention-report reportID="1234" /> <mention-user accountID="1234" />
// paste value as text/html
<mention-report reportID="1234"> <mention-user accountID="1234"></mention-user></mention-report> Solutionconvert self-clothing closing tags to non self-clothing before writing it to clipboard here. const htmlNonClosingTags = html.replace(/<mention-report reportID="(\d+)" *\/>/gi, '<mention-report reportID="$1"></mention-report>')
.replace(/<mention-user accountID="(\d+)" *\/>/gi, '<mention-user accountID="$1"></mention-user>') |
@ahmedGaber93 I'd like to confirm one thing - in report action, we only save self-closing tags, like |
@eh2077 I think we use combine of them. In optimistic data, we use |
So we'll also need to fix in App codebase to convert self-closing tags to paired tags when setting clipboard right? |
Yes, we need that to cover this case #741 (comment) |
@ahmedGaber93 I can't merge this because you have unverified commits. Please resolve that and tag me again when it's ready. |
@marcaaron commits now are verified. |
@marcaaron hope you noticed this comment, plus this PR, I will create a PR in E/App also to fix this. |
All of them need to be verified. Can you squash the initial commit? |
I don't use squash before, what about force push? |
ff7ffcc
to
b0e752c
Compare
@marcaaron I forced push a new verified commit, all commits are verified now. |
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.
Perfect, thanks!
🚀Published to npm in v2.0.39 |
CC @marcaaron @lakchote @eh2077
When We copy
<mention-user accountID="1234" />
astext/html
to clipboard on the web here. The paste value here paste with different format<meta charset='utf-8'><html><head></head><body><mention-user accountid="1234"></mention-user></body></html>
(
<openTag></closeTag>
not<closedTag />
), and this format not match rulereportMention
inExpensiMark
This issue will update htmlToMarkdownRules
userMention
andreportMention
regex to work for both self closing and non self closing tags.Fixed Issues
$ Expensify/App#40477
$ Expensify/App#40403
Tests
npm install & npm run build
dist
folder to E/App tonode_modules/expensify-common/dist
Screenshots/Videos
Android: Native
a.mp4
Android: mWeb Chrome
aw.mp4
iOS: Native
i.mp4
iOS: mWeb Safari
iw.mp4
MacOS: Chrome / Safari
w.mp4
MacOS: Desktop
d.mp4