Skip to content
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

Use new logic to check bold text #710

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

ShridharGoel
Copy link
Contributor

@ShridharGoel ShridharGoel commented May 30, 2024

Use new logic to check bold text: Expensify/App#41109 (comment)

Fixed Issues

$ Expensify/App#41109

Tests and QA steps:

  1. Type anything on a Google document.
  2. Copy it.
  3. Paste it in Expensify.
  4. Check if the font is still normal (it shouldn't be bold).
  5. Now, type something in bold text on a Google document.
  6. Copy/paste to Expensify.
  7. It should show in bold.
Screen.Recording.2024-06-28.at.1.56.15.PM.mov
Screen.Recording.2024-06-28.at.8.06.32.PM.mov

@ShridharGoel ShridharGoel requested a review from a team as a code owner May 30, 2024 12:08
Copy link

github-actions bot commented May 30, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ShridharGoel
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

Copy link
Contributor

@jasperhuangg jasperhuangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please show testing steps and screenshots of this change working with the App PR you're going to submit.

Please also link the App PR in the description.

JS Linter is also failing, try running npm run prettier

@jasperhuangg
Copy link
Contributor

Hey @ShridharGoel any updates on this?

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Jun 3, 2024 via email

@ShridharGoel ShridharGoel requested a review from jasperhuangg June 5, 2024 07:18
@jasperhuangg
Copy link
Contributor

@ShridharGoel Please prioritize this when you can

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Jun 7, 2024 via email

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Jun 7, 2024

Testing steps and videos were added.

jasperhuangg
jasperhuangg previously approved these changes Jun 10, 2024
@jasperhuangg
Copy link
Contributor

@ShridharGoel the tests are failing, please fix them.

For the linter tests, just run npm run prettier and commit the changes.

Please find the failing JS tests here: https://github.com/Expensify/expensify-common/actions/runs/9379944077/job/25851454328?pr=710

@jasperhuangg
Copy link
Contributor

Bump @ShridharGoel

@jasperhuangg
Copy link
Contributor

@ShridharGoel Did you run npm run prettier locally? I just ran it and there's still a diff, all you need to do is run it and commit the difference. I can't do so because I'm a reviewer.

╰─ git diff
diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js
index 2c51e80..917606f 100644
--- a/lib/ExpensiMark.js
+++ b/lib/ExpensiMark.js
@@ -411,9 +411,8 @@ export default class ExpensiMark {
                 replacement: (match, tagContent, innerContent) => {
                     const fontWeightMatch = innerContent.match(/style="(.*?)"/);
                     const isFontWeightBold = fontWeightMatch
-                    ? fontWeightMatch[1].replaceAll(/\s/g, "").includes("font-weight:bold;") ||
-                      fontWeightMatch[1].replaceAll(/\s/g, "").includes("font-weight:700;")
-                    : false;
+                        ? fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:700;')
+                        : false;
                     const isBold = fontWeightMatch ? isFontWeightBold : true;
                     return isBold ? `*${innerContent}*` : innerContent;
                 },

@ShridharGoel
Copy link
Contributor Author

@jasperhuangg Should be fixed now, thanks.

@jasperhuangg
Copy link
Contributor

@ShridharGoel Still have linter errors, why aren't you running npm run prettier? Either do that or just correctly apply the diff that I'm showing you 😆

╰─ git diff
diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js
index fd54708..917606f 100644
--- a/lib/ExpensiMark.js
+++ b/lib/ExpensiMark.js
@@ -411,7 +411,7 @@ export default class ExpensiMark {
                 replacement: (match, tagContent, innerContent) => {
                     const fontWeightMatch = innerContent.match(/style="(.*?)"/);
                     const isFontWeightBold = fontWeightMatch
-                        ? fontWeightMatch[1].replaceAll(/\s/g, "").includes("font-weight:bold;") || fontWeightMatch[1].replaceAll(/\s/g, "").includes("font-weight:700;")
+                        ? fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:700;')
                         : false;
                     const isBold = fontWeightMatch ? isFontWeightBold : true;
                     return isBold ? `*${innerContent}*` : innerContent

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Jun 14, 2024

I had used it locally, not sure what went wrong (some changes were applied but double quotes didn't change to single quotes). But it should work now.

jasperhuangg
jasperhuangg previously approved these changes Jun 17, 2024
@jasperhuangg
Copy link
Contributor

@ShridharGoel it looks like your commits aren't signed, can you look into this?

The base branch requires all commits to be signed

Comment on lines 412 to 416
const fontWeightMatch = innerContent.match(/style="(.*?)"/);
const isFontWeightBold = fontWeightMatch
? fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:bold;') || fontWeightMatch[1].replaceAll(/\s/g, '').includes('font-weight:700;')
: false;
const isBold = fontWeightMatch ? isFontWeightBold : true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comments to explain what's happening it became pretty unclear what's going on.

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Jun 18, 2024

I think we also need unit tests to cover this cases. @ShridharGoel Can you work on that

@jasperhuangg
Copy link
Contributor

@ShridharGoel bump!

@jasperhuangg
Copy link
Contributor

Gonna go ahead and stick this back on draft while the unit tests are worked out.

@jasperhuangg jasperhuangg marked this pull request as draft June 20, 2024 18:34
@ShridharGoel
Copy link
Contributor Author

Will update this soon.

@alitoshmatov
Copy link
Contributor

Thank you @jasperhuangg looks like we need to revisit our solution on this one. @ShridharGoel Can have a look at this Expensify/App#41109 (comment)

@ShridharGoel
Copy link
Contributor Author

Testing the mentioned scenarios now.

@ShridharGoel ShridharGoel marked this pull request as ready for review June 24, 2024 16:08
@ShridharGoel ShridharGoel force-pushed the patch-1 branch 3 times, most recently from 98add94 to eb40af6 Compare June 26, 2024 13:48
@jasperhuangg
Copy link
Contributor

@ShridharGoel Do you mind also updating your screenshots to handle the new cases outlined in Expensify/App#41109 (comment)

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Jun 27, 2024

@jasperhuangg Will update. Also, just to note: Expensify/App#41109 (comment)

Edit: Updated the videos in OP.

Copy link
Contributor

@jasperhuangg jasperhuangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @alitoshmatov all yours

Copy link
Contributor

@alitoshmatov alitoshmatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me to, I think we can merge this.

@jasperhuangg jasperhuangg merged commit 002c5e1 into Expensify:main Jul 8, 2024
6 checks passed
Copy link

github-actions bot commented Jul 8, 2024

🚀Published to npm in v2.0.40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants