From 480a68db47453c99b86d9f93daa00fdebe0347d0 Mon Sep 17 00:00:00 2001 From: jat Date: Fri, 15 Nov 2024 16:46:01 +0100 Subject: [PATCH] Add 'paste without formatting' to the context menu on desktop Closes #3018. --- src/common/desktop/DesktopContextMenu.ts | 8 ++++++++ src/common/misc/TranslationKey.ts | 1 + src/mail-app/translations/de.ts | 1 + src/mail-app/translations/de_sie.ts | 1 + src/mail-app/translations/en.ts | 1 + 5 files changed, 12 insertions(+) diff --git a/src/common/desktop/DesktopContextMenu.ts b/src/common/desktop/DesktopContextMenu.ts index a5b9820d4452..51cf161f28ed 100644 --- a/src/common/desktop/DesktopContextMenu.ts +++ b/src/common/desktop/DesktopContextMenu.ts @@ -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 @@ -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", @@ -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", diff --git a/src/common/misc/TranslationKey.ts b/src/common/misc/TranslationKey.ts index aaa1f39e2b76..15c5e5d5c486 100644 --- a/src/common/misc/TranslationKey.ts +++ b/src/common/misc/TranslationKey.ts @@ -1125,6 +1125,7 @@ export type TranslationKeyType = | "passwordWrongInvalid_msg" | "password_label" | "paste_action" + | "pasteWithoutFormatting_action" | "pathAlreadyExists_msg" | "payCardContactBankError_msg" | "payCardExpiredError_msg" diff --git a/src/mail-app/translations/de.ts b/src/mail-app/translations/de.ts index 30adf0202d04..d6a1920c306c 100644 --- a/src/mail-app/translations/de.ts +++ b/src/mail-app/translations/de.ts @@ -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.", diff --git a/src/mail-app/translations/de_sie.ts b/src/mail-app/translations/de_sie.ts index b7ff7d53e59a..0b9a20c73fb8 100644 --- a/src/mail-app/translations/de_sie.ts +++ b/src/mail-app/translations/de_sie.ts @@ -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.", diff --git a/src/mail-app/translations/en.ts b/src/mail-app/translations/en.ts index 365f397be484..3463c78f8cc2 100644 --- a/src/mail-app/translations/en.ts +++ b/src/mail-app/translations/en.ts @@ -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.",