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

[$250] Markdown- Bold markdown is not rendered when copied from another app #46891

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 6, 2024 · 29 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 6, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.17-0
Reproducible in staging?: Y
Reproducible in production?: Y
Issue reported by: Applause - Internal Team

Action Performed:

An account signed in to newdot

  1. Navigate to a chat app that supports Markdown (Example: Slack)
  2. Send a message containing the bold markdown
  3. Copy the text (CTRL + C) with markdown and navigate back to NewDot
  4. Open any conversation and paste the copied text with CTRL + V into the compose box

Expected Result:

The text is displayed with the bold markdown icon in the compose box and is rendered as bold when the text is sent

Actual Result:

The text is not displayed with the bold markdown icon in the compose box and is not rendered as bold when the text is sent

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6563272_1722942138525.2024-08-06_13_59_36.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e87ca27ee2372740
  • Upwork Job ID: 1821228929551530763
  • Last Price Increase: 2024-08-14
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

We think that this bug might be related to #Live Markdown.

@lanitochka17
Copy link
Author

@sakluger FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Copying bold text from another app (such as Slack) isn't pasted as a bold markdown which is inconsistent with other markdowns.

What is the root cause of that problem?

The regex for bold and italic for example is pretty similar.
https://github.com/Expensify/expensify-common/blob/7351ac7e19f5cc8e694f8eb40768b9c6d6302852/lib/ExpensiMark.ts#L558-L564

The difference in bold markdown replacement is that it checks the <strong> or <b> HTML style attribute and doesn't render it as bold if the style doesn't have a font-weight of bold or 700.

https://github.com/Expensify/expensify-common/blob/7351ac7e19f5cc8e694f8eb40768b9c6d6302852/lib/ExpensiMark.ts#L565-L592

It's to fix #41109 where copying text from gdocs is rendered as bold because gdocs text HTML is b but with a style of font-weight: 400.

The problem with the current bold replacement logic is that if a style attribute is found on the HTML tag, then the decision to render it as bold or not relies on the style attribute even though there is no font-weight style found. This causes any bold HTML tag that has a style but no font-weight to be rendered as not bold, for example:

<b>example</b> rendered as bold
<b style="font-size:10px">example</b> not rendered as bold
<b style="font-size:10px; font-weight:bold">example</b> rendered as bold

What changes do you think we should make in order to solve the problem?

We must decide whether to render it as bold or not based on the style attribute only if the style has font-weight value, otherwise, we will render it as bold. To do that, update the regex [1] [2] to:

/style="([^"]*?\bfont-weight:\s*(\d+|bold|normal)[^"]*?)"/

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01e87ca27ee2372740

@melvin-bot melvin-bot bot changed the title Markdown- Bold markdown is not rendered when copied from another app [$250] Markdown- Bold markdown is not rendered when copied from another app Aug 7, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

Copy link

melvin-bot bot commented Aug 12, 2024

@sakluger, @rushatgabhane Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
@sakluger
Copy link
Contributor

@rushatgabhane thoughts on the proposal above?

@rushatgabhane
Copy link
Member

@bernhardoj font weight can be a number too right?

@melvin-bot melvin-bot bot removed the Overdue label Aug 12, 2024
@bernhardoj
Copy link
Contributor

@rushatgabhane Yes it can. The regex in the proposal can handle that (\d+)

Copy link

melvin-bot bot commented Aug 14, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@sakluger
Copy link
Contributor

@rushatgabhane friendly bump.

@rushatgabhane
Copy link
Member

rushatgabhane commented Aug 16, 2024

@bernhardoj's proposal LGTM #46891 (comment)

🎀 👀 🎀

Copy link

melvin-bot bot commented Aug 16, 2024

Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 16, 2024
@bernhardoj
Copy link
Contributor

The expensify-common PR is ready

cc: @rushatgabhane

@melvin-bot melvin-bot bot added the Overdue label Aug 18, 2024
@sakluger
Copy link
Contributor

@rushatgabhane is OOO today - commenting to clear the Overdue label.

@melvin-bot melvin-bot bot removed the Overdue label Aug 19, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

@sakluger @rushatgabhane @bernhardoj @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 21, 2024
@bernhardoj
Copy link
Contributor

Opened the App PR, but I hold it.

@sakluger
Copy link
Contributor

Commenting for Melvin since I will be OOO until Aug 30. @bernhardoj let us know if you make any progress in the meantime.

@bernhardoj
Copy link
Contributor

PR is merged

@sakluger
Copy link
Contributor

The automation didn't work. The PR was deployed on Aug 30, so payment was due on Sept 6.

@sakluger sakluger added Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 and removed Reviewing Has a PR in review Weekly KSv2 labels Sep 10, 2024
@sakluger
Copy link
Contributor

Summarizing payment on this issue:

Contributor: @bernhardoj $250, please request on Newdot
Contributor+: @rushatgabhane $250, please request on Newdot

@sakluger
Copy link
Contributor

@rushatgabhane can you please propose regression test steps if you think they are needed?

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@rushatgabhane
Copy link
Member

no regression steps needed here. it's covered by Expensify markdown tests

@garrettmknight
Copy link
Contributor

$250 approved @rushatgabhane

@melvin-bot melvin-bot bot added the Overdue label Sep 13, 2024
Copy link

melvin-bot bot commented Sep 16, 2024

@sakluger, @rushatgabhane, @bernhardoj, @aldo-expensify Eep! 4 days overdue now. Issues have feelings too...

@sakluger
Copy link
Contributor

No regression steps needed and all payments approved. We're good to close 👍

@melvin-bot melvin-bot bot removed the Overdue label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

7 participants