Skip to content

Commit

Permalink
Add 'paste without formatting' to the context menu on desktop
Browse files Browse the repository at this point in the history
Closes #3018.
  • Loading branch information
rezbyte authored and armhub committed Dec 12, 2024
1 parent 9dc66d0 commit 57f7572
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/desktop/DesktopContextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ContextMenuParams, Menu, WebContents } from "electron"
import { lang } from "../misc/LanguageViewModel"
import { WindowManager } from "./DesktopWindowManager.js"
import { client } from "../misc/ClientDetector.js"

type Electron = typeof Electron.CrossProcessExports

Expand All @@ -16,6 +17,12 @@ export class DesktopContextMenu {
click: (_, bw) => this.getWebContents(bw)?.paste(),
enabled: editFlags.canPaste,
})
const pasteWithoutFormattingItem = new this.electron.MenuItem({
label: lang.get("pasteWithoutFormatting_action"),
accelerator: client.isMacOS ? "Cmd+Option+Shift+V" : "Ctrl+Shift+V",
click: (_, bw) => this.getWebContents(bw)?.pasteAndMatchStyle(),
enabled: editFlags.canPaste,
})
const copyItem = new this.electron.MenuItem({
label: lang.get("copy_action"),
accelerator: "CmdOrCtrl+C",
Expand Down Expand Up @@ -53,6 +60,7 @@ export class DesktopContextMenu {
menu.append(cutItem)
menu.append(copyLinkItem)
menu.append(pasteItem)
menu.append(pasteWithoutFormattingItem)
menu.append(
new this.electron.MenuItem({
type: "separator",
Expand Down
1 change: 1 addition & 0 deletions src/common/misc/TranslationKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ export type TranslationKeyType =
| "passwordWrongInvalid_msg"
| "password_label"
| "paste_action"
| "pasteWithoutFormatting_action"
| "pathAlreadyExists_msg"
| "payCardContactBankError_msg"
| "payCardExpiredError_msg"
Expand Down
1 change: 1 addition & 0 deletions src/mail-app/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ export default {
"passwordWrongInvalid_msg": "Das Passwort ist falsch.",
"password_label": "Passwort",
"paste_action": "Einfügen",
"pasteWithoutFormatting_action": "Einfügen ohne Formatierung",
"pathAlreadyExists_msg": "Dieser Pfad existiert bereits.",
"payCardContactBankError_msg": "Leider wurde die Zahlung von deiner Bank abgelehnt. Bitte prüfe, dass die Kreditkartendaten korrekt sind, oder kontaktiere deine Bank.",
"payCardExpiredError_msg": "Leider ist die Kreditkarte abgelaufen. Bitte aktualisiere deine Zahlungsdaten.",
Expand Down
1 change: 1 addition & 0 deletions src/mail-app/translations/de_sie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ export default {
"passwordWrongInvalid_msg": "Das Passwort ist falsch.",
"password_label": "Passwort",
"paste_action": "Einfügen",
"pasteWithoutFormatting_action": "Einfügen ohne Formatierung",
"pathAlreadyExists_msg": "Dieser Pfad existiert bereits.",
"payCardContactBankError_msg": "Leider wurde die Zahlung von Ihrer Bank abgelehnt. Bitte prüfen Sie, dass die Kreditkartendaten korrekt sind, oder kontaktieren Sie Ihre Bank.",
"payCardExpiredError_msg": "Leider ist die Kreditkarte abgelaufen. Bitte aktualisieren Sie Ihre Zahlungsdaten.",
Expand Down
1 change: 1 addition & 0 deletions src/mail-app/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ export default {
"passwordWrongInvalid_msg": "Your password is wrong.",
"password_label": "Password",
"paste_action": "Paste",
"pasteWithoutFormatting_action": "Paste without formatting",
"pathAlreadyExists_msg": "This path already exists.",
"payCardContactBankError_msg": "Sorry, the payment transaction was rejected by your bank. Please make sure that your credit card details are correct or contact your bank.",
"payCardExpiredError_msg": "Sorry, the credit card has expired. Please update your payment details.",
Expand Down

0 comments on commit 57f7572

Please sign in to comment.