Skip to content

[HOLD for payment 2023-08-16] [$1000] Desktop - Chat - “Paste as plain text” isn't present on command in the context menu #23567

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

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

Comments

@kbecciv
Copy link

kbecciv commented Jul 25, 2023

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


Action Performed:

  1. Navigate to staging
  2. Open any chat and Copy the text with markdown
  3. Paste this text without any markdown by right clicking and selecting "Paste as plain text"

Expected Result:

“Paste as plain text” should present on command in the context menu.

Actual Result:

“Paste as plain text” isn't present on command in the context menu

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.45-3
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/3549733

Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Bug6141165_desktop.mp4

Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0134ff08ce327769dc
  • Upwork Job ID: 1684993452633849856
  • Last Price Increase: 2023-07-28
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ygshbht
Copy link
Contributor

ygshbht commented Jul 27, 2023

Proposal

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

Currently, when using the desktop chat, there is no option in the context menu to "Paste as plain text".

What is the root cause of that problem?

The existing code enables the context menu, but it lacks the feature to paste as plain text.

App/desktop/main.js

Lines 28 to 40 in 96c765d

// Initialize the right click menu
// See https://github.com/sindresorhus/electron-context-menu
// Add the Paste and Match Style command to the context menu
contextMenu({
append: (defaultActions, parameters) => [
new MenuItem({
// Only enable the menu item for Editable context which supports paste
visible: parameters.isEditable && parameters.editFlags.canPaste,
role: 'pasteAndMatchStyle',
accelerator: 'CmdOrCtrl+Shift+V',
}),
],
});

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

To introduce this functionality, we can modify the existing code to include a new menu item that enables the "Paste as plain text" feature. This feature will only be visible and enabled in an editable context where paste is supported.

Here is the updated code:

contextMenu({
    append: (defaultActions, parameters, browserWindow) => [
        new MenuItem({
            // Only enable the menu item for Editable context which supports paste
            visible: parameters.isEditable && parameters.editFlags.canPaste,
            role: 'pasteAndMatchStyle',
            // accelerator: 'CmdOrCtrl+Shift+V',
        }),
        new MenuItem({
            label: 'Paste as Plain Text',
            // Only enable the menu item for Editable context which supports paste
            visible: parameters.isEditable && parameters.editFlags.canPaste,
            click: () => {
                // Insert the plain text from the clipboard
                const text = clipboard.readText();
                browserWindow.webContents.insertText(text);
            },
            accelerator: 'CmdOrCtrl+Shift+V',
        }),
    ],
});

Please note that the shortcut (accelerator) can be changed as per preference. This solution is straightforward and simple but open to any adjustments as per feedback or testing outcomes.

2023-07-27.20-32-24.mp4

@melvin-bot melvin-bot bot added the Overdue label Jul 27, 2023
@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Jul 28, 2023
@melvin-bot melvin-bot bot changed the title Desktop - Chat - “Paste as plain text” isn't present on command in the context menu [$1000] Desktop - Chat - “Paste as plain text” isn't present on command in the context menu Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Current assignee @kevinksullivan is eligible for the External assigner, not assigning anyone new.

@kevinksullivan
Copy link
Contributor

Moving forward 👍

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jul 28, 2023

@ygshbht's proposal looks good. But I have a few questions @ygshbht.

  1. browserWindow is not available as a global var, how do you plan to pass it to the context menu

  2. I am assuming clipboard you meant importing const { clipboard } = require('electron')

  3. Question for @kevinksullivan, @mountiny, what should be the keyboard shortcut for this ?

🎀 👀 🎀 C+ Reviewed.

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

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

@mountiny
Copy link
Contributor

@mananjadhav isnt this related to the fact that the "paste without formatting" has not worked well recently?

@mananjadhav
Copy link
Collaborator

Yes @mountiny. I checked few of the previous versions and it seems to be broken for quite sometime? I had gone through the threads, do you have the info on when was it last working?

@mountiny
Copy link
Contributor

No i dont unfortunately

@mananjadhav
Copy link
Collaborator

No i dont unfortunately

do we have any videos, etc. from the previous versions that we can refer to?

@ygshbht
Copy link
Contributor

ygshbht commented Jul 28, 2023

@ygshbht's proposal looks good. But I have a few questions @ygshbht.

  1. browserWindow is not available as a global var, how do you plan to pass it to the context menu
  2. I am assuming clipboard you meant importing const { clipboard } = require('electron')
  3. Question for @kevinksullivan, @mountiny, what should be the keyboard shortcut for this ?

🎀 👀 🎀 C+ Reviewed.

Thanks @mananjadhav

  1. This is provided by append method of contextMenu function
  2. Yes.

If I may add a bit about shortcuts, CmdShiftV is generally used for Pasting as Plain text and Command + Option + Shift + V for Paste and Match style

@bernhardoj
Copy link
Contributor

bernhardoj commented Jul 29, 2023

Sharing my thought:

I think Paste as Plain Text never exists in our code and instead, we have Paste and Match style. This menu by default is only available on MacOS and looks like it's the same as Paste as Plain Text. We can compare it with other apps, such as browsers, mail, etc. where only Paste and Match style is available (except the app has a custom name, see quote below). On Windows, Paste as Plain Text will be available instead of Paste and Match style.

Apple has long acknowledged this need with a command in the Edit menu: Paste and Match Style. Many other apps mimic the naming of Apple’s command, although you may also see variants like Paste and Match Formatting (Microsoft Word), Paste Text Only (Nisus Writer Pro), Paste without Formatting (Adobe InDesign), and Paste Without Format (Affinity Publisher).

For something as commonplace as pasting, a keyboard shortcut is welcome, and Apple’s default is Command-Shift-Option-V. That works in many apps, although the slightly simpler Command-Shift-V is also frequently used—it’s what you’ll find in Adobe InDesign, Nisus Writer Pro, and even the Web interface of Google Docs.

From https://tidbits.com/2022/04/18/five-solutions-for-pasting-plain-text-on-a-mac/

On Windows, while it's not universal, many apps support the shortcut Ctrl + Shift + V to paste without formatting. These include Chrome, Firefox, and Evernote.

To paste as plain text on a Mac, you can use the somewhat cumbersome shortcut Option + Cmd + Shift + V to paste without formatting. This is a system-wide shortcut, so unlike Windows, it should work everywhere. Technically, this shortcut pastes and matches the formatting, but this has the same effect of removing the original formatting.

From https://www.makeuseof.com/tag/5-ways-strip-formatting-copy-paste-text/

Windows: Paste as Plain Text
Mac: Paste and Match Style (Option + Cmd + Shift + V, but some apps (browsers) support a shorter shortcut that is Cmd + Shift + V)

However, the Expensify desktop app uses Electron which does not have a default context menu, so we use https://github.com/sindresorhus/electron-context-menu and append Paste and Match Style. If we use Mac, it makes sense to see Paste and Match Style menu, but maybe not in case we use Windows/Linux? If so, maybe we should rename it conditionally?

@mananjadhav
Copy link
Collaborator

I don't have any Windows machine to check, but I do think we could have Paste as Plain text. While Paste and Match style exists on a lot of apps, I wouldn't call it a standard. It is just available for few editors, while each of the apps design their own context menu, when you consider other categories of the apps - Spotify, VS Code, Loom, TablePlus, etc. Apps from Microsoft have their completely custom menu to be standard across all platforms.

Some of default apps from MacOS Notes, TextEdit, also doesn't have Paste and Match styles for me.

@bernhardoj
Copy link
Contributor

I'm not against having a custom context menu, but I feel it's redundant to have both Paste and Match Style & Paste as Plain Text if they do the same thing.

I wouldn't call it a standard

I believe it's the default menu for a desktop (Mac) app.

This is a system-wide shortcut, so unlike Windows, it should work everywhere.

From my previous comment quote.

Some of default apps from MacOS Notes, TextEdit, also doesn't have Paste and Match styles for me.

They have it at the top menu
Screenshot 2023-07-30 at 15 27 32
image

Anyway, it's all your decision. Thanks for reading 😄!

@mananjadhav
Copy link
Collaborator

Agreed @bernhardoj. My bad all default apps in the MacOS have the Paste and Match Style, but not the ones like VSCode, Compass, Spotify, etc.

@mananjadhav
Copy link
Collaborator

@mountiny Thoughts on the above discussion? Are we looking to keep this to platform specific defaults? or enable Plain and text for macOS?

@melvin-bot
Copy link

melvin-bot bot commented Aug 4, 2023

Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 4, 2023
@Expensify Expensify deleted a comment from melvin-bot bot Aug 4, 2023
@kevinksullivan kevinksullivan self-assigned this Aug 4, 2023
@kevinksullivan
Copy link
Contributor

Hi @isabelastisser I am going OOO for a week, so tapping you in to help out in the interim. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Aug 6, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @ygshbht got assigned: 2023-08-01 11:56:39 Z
  • when the PR got merged: 2023-08-06 17:20:44 UTC
  • days elapsed: 3

On to the next one 🚀

@mountiny
Copy link
Contributor

mountiny commented Aug 6, 2023

The bonus should apply here, it took me long to merge because I am ooo now

@isabelastisser
Copy link
Contributor

@kevinksullivan @mountiny Is the issue due for payment, can I process it now? I'm confused because we're missing the payment title and deadline.

@mananjadhav
Copy link
Collaborator

@isabelastisser this is still pending to be deployed on staging and production. Hence the title isn't updated.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Aug 9, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Desktop - Chat - “Paste as plain text” isn't present on command in the context menu [HOLD for payment 2023-08-16] [$1000] Desktop - Chat - “Paste as plain text” isn't present on command in the context menu Aug 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 9, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.51-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-08-16. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 9, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@mananjadhav] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kevinksullivan / @isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mananjadhav
Copy link
Collaborator

This is more of a feature request than a bug. I am not sure how regression test works for feature request. But if we're adding a new test for this, we can add from the Test steps.

cc - @mountiny @isabelastisser

@mountiny
Copy link
Contributor

@mananjadhav Lets add a test for this, notmally lets use the steps from the QA

@mananjadhav
Copy link
Collaborator

mananjadhav commented Aug 16, 2023

@isabelastisser @kevinksullivan Can you please add the QA steps as a test for this feature? and also help with the payment summary here?

@JmillsExpensify
Copy link

Can I get a payment summary from the BZ member on this one? We have a payment outstanding in NewDot that I'd like to process.

@isabelastisser
Copy link
Contributor

Payment summary:

  • Issue reported by: Applause - Internal Team. No payment is required.
  • C+ review: @mananjadhav. $1000, urgency bonus $500.
  • Approved proposal: @ygshbht $1000, urgency bonus $500

cc @JmillsExpensify

@isabelastisser
Copy link
Contributor

Payment made in Upwork to @ygshbht

[@kevinksullivan / @isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

https://github.com/Expensify/Expensify/issues/308932

@mananjadhav please complete the checklist and I will close the issue, thanks!

@mananjadhav
Copy link
Collaborator

@isabelastisser as I mentioned here, this is a feature request hence it doesn’t have an regression PR, but we do need to add test steps as mentioned here.

@isabelastisser
Copy link
Contributor

Thanks @mananjadhav ! I talked to Vit too and fixed it.

We should be all set here!

@JmillsExpensify
Copy link

Reviewed the details for @mananjadhav. this $1,500 payment is approved via NewDot based on the BZ summary above.

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants