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] mWeb - Compose box- Selected text isn't applied format #53145

Open
1 of 8 tasks
lanitochka17 opened this issue Nov 26, 2024 · 35 comments
Open
1 of 8 tasks

[$250] mWeb - Compose box- Selected text isn't applied format #53145

lanitochka17 opened this issue Nov 26, 2024 · 35 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Design External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 26, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.67-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
**If this was caught during regression testing, add the test name, ID and link from TestRail:**N/A
Email or phone of affected tester (no customers): [email protected]

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. At compose box of any conversation, type 1 line
  3. Select all text, choose Format: Bold and send message
  4. Type another line
  5. Select all text, choose Format: Italic and send message
  6. Type another line
  7. Select all text, choose Format: Underline and send message

Expected Result:

Selected texts should apply choosing format

Actual Result:

Selected texts isn't applied choosing format

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6658637_1731058296145.Qotm2966_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861616540479439769
  • Upwork Job ID: 1861616540479439769
  • Last Price Increase: 2024-11-27
Issue OwnerCurrent Issue Owner: @mananjadhav
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 26, 2024
Copy link

melvin-bot bot commented Nov 26, 2024

Triggered auto assignment to @kadiealexander (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.

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Nov 27, 2024
Copy link

melvin-bot bot commented Nov 27, 2024

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

@melvin-bot melvin-bot bot changed the title mWeb - Compose box- Selected text isn't applied format [$250] mWeb - Compose box- Selected text isn't applied format Nov 27, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 27, 2024
Copy link

melvin-bot bot commented Nov 27, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

Selected text isn't formatted when selecting format option from the context menu.

What is the root cause of that problem?

When we have an element with contenteditable, the context menu will show the "Format" option. However, the live markdown currently doesn't handle the format command.

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

There are 3 "Format" options, Bold, Italic, and Underline. Currently, we don't have a markdown for Underline. To handle the Bold and Italic format, we need to add new cases for bold and italic format command here.
https://github.com/Expensify/react-native-live-markdown/blob/cec2feae7463398b8d377a231be8671e1698e4a0/src/MarkdownTextInput.web.tsx#L349-L358

case 'formatBold':
  newInputUpdate = parseText(
    divRef.current,
    `${parsedText.slice(0, contentSelection.current.start)}*${parsedText.slice(contentSelection.current.start, contentSelection.current.end)}*${parsedText.slice(contentSelection.current.end)}`,
    processedMarkdownStyle,
    newCursorPosition + 2,
    true
  );
  break
case 'formatItalic':
  newInputUpdate = parseText(
    divRef.current,
    `${parsedText.slice(0, contentSelection.current.start)}_${parsedText.slice(contentSelection.current.start, contentSelection.current.end)}_${parsedText.slice(contentSelection.current.end)}`,
    processedMarkdownStyle,
    newCursorPosition + 2,
    true
  );
  break

The way the format logic work is by "wrapping" the selected text with the markdown (* for bold, _ for italic). The new selection will be added by 2 because we add 2 * or _.

But the Underline format still won't do anything because we don't have a markdown for that, and because the live markdown also handles the styling manually, so the alternative is to disable the "Format" option. We can do that by setting the contenteditable to "plaintext-only"
https://github.com/Expensify/react-native-live-markdown/blob/cec2feae7463398b8d377a231be8671e1698e4a0/src/MarkdownTextInput.web.tsx#L724

contentEditable: disabled ? 'false' : 'plaintext-only',

Based on the doc, "plaintext-only" is available on most browsers except Firefox, but this Format context menu is only available on Safari, so I think it's not a problem.
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable#browser_compatibility

@mananjadhav
Copy link
Collaborator

Reviewing.

Copy link

melvin-bot bot commented Dec 2, 2024

@mananjadhav, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2024
@maddylewis maddylewis moved this to Product (CRITICAL) in [#whatsnext] #retain Dec 2, 2024
@kadiealexander
Copy link
Contributor

Bumped @mananjadhav for review here.

@mananjadhav
Copy link
Collaborator

I checked @bernhardoj's proposal. I think we can go ahead with this. But before we finalize I want to understand if we could remove the Underline option from the Format menu? (Atleast on Whatsapp I don't see it), whereas Slack removes the format option for me.

Nevertheless we can use @bernhardoj's proposal as they've mentioned the alternative for removing the Format menu as well.

Tagging @Expensify/design for the input as well.

🎀 👀 🎀 C+ reviewed.

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

Copy link

melvin-bot bot commented Dec 2, 2024

Triggered auto assignment to @dubielzyk-expensify (Design), see these Stack Overflow questions for more details.

@shawnborton
Copy link
Contributor

Oh interesting, I didn't even know you could do this from iOS. I suppose we could make it so that whatever style you picked from the native menu (bold, italic, etc) was applied via our markdown styles, as in we'd prepend and append a * if you picked bold. Is something like that possible?

@dubielzyk-expensify
Copy link
Contributor

That'd be great if that's possible. If not, I wonder if we could hide or turn off that formatting menu altogether.

@bernhardoj
Copy link
Contributor

I suppose we could make it so that whatever style you picked from the native menu (bold, italic, etc) was applied via our markdown styles, as in we'd prepend and append a * if you picked bold. Is something like that possible?

It's possible which is my main solution, however, the Format option includes Underline, but we don't have an underline markdown. I don't see a way to select which format to show, but we can hide entirely with my alternative solution.

@shawnborton
Copy link
Contributor

I think it's fine if we don't have an underline markdown for now, at least we'll get the benefit of bold and italic working.

@dannymcclain
Copy link
Contributor

I'm fine with making just bold and italic work or hiding that format menu item altogether. I also didn't even realize it was there haha.

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

Thanks for the confirmation. Opened the PR on live markdown repo here: Expensify/react-native-live-markdown#556

Waiting for the review from the live markdown team.

@mananjadhav
Copy link
Collaborator

However, this PR only implements Format menu on web. I believe the same feature is missing on native iOS. Are there any plans to implement this missing feature also in native iOS?

@bernhardoj That's a good question raised here. Do we not need it for native?

@bernhardoj
Copy link
Contributor

Replied on the PR

@mananjadhav
Copy link
Collaborator

Keeping the conversation here to understand the scope. @bernhardoj I can see Format option in the native iOS Whatsapp. When clicked these are the options I see. This is what I also meant if we could hide just the underline. This translates to markdown btw.

format-native-whatsapp

@bernhardoj
Copy link
Contributor

But it's not available on our app, so I'm not sure how we can handle it.

Copy link

melvin-bot bot commented Dec 9, 2024

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

@mananjadhav @blimpich @bernhardoj @kadiealexander @dubielzyk-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!

@blimpich
Copy link
Contributor

Issue is assigned, automation didn't work quite right for some reason. Conversation is active in the PR.

@mananjadhav
Copy link
Collaborator

The conversation is the in Expensify/react-native-live-markdown repo. May be that's why.

@melvin-bot melvin-bot bot removed the Overdue label Dec 10, 2024
Copy link

melvin-bot bot commented Dec 16, 2024

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
@blimpich
Copy link
Contributor

Looks like we're waiting on reviews on the PR @bernhardoj @mananjadhav?

@bernhardoj
Copy link
Contributor

Yes, I bumped on the PR

Copy link

melvin-bot bot commented Dec 18, 2024

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@dubielzyk-expensify
Copy link
Contributor

Not overdue

Copy link

melvin-bot bot commented Dec 20, 2024

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@blimpich
Copy link
Contributor

Waiting on reviews, bumped the agency reviewers in the PR.

Copy link

melvin-bot bot commented Dec 24, 2024

@mananjadhav @blimpich @bernhardoj @kadiealexander @dubielzyk-expensify this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

Copy link

melvin-bot bot commented Dec 24, 2024

@mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify 12 days overdue. Walking. Toward. The. Light...

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

This issue has not been updated in over 14 days. @mananjadhav, @blimpich, @bernhardoj, @kadiealexander, @dubielzyk-expensify eroding to Weekly issue.

@melvin-bot melvin-bot bot removed the Overdue label Dec 27, 2024
@blimpich
Copy link
Contributor

Still waiting on reviews. Holidays are slowing down the review process for this one I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Design External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Product (CRITICAL)
Development

No branches or pull requests

8 participants