From 5a834e6baec39f490329a2383732fb3e4f6d12b8 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Wed, 2 Aug 2023 01:31:35 +0530 Subject: [PATCH 01/13] MacOS: Add 'Paste as Plain Text' to context menu --- desktop/main.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 1d2284dbc58d..beb5692b2d4a 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -1,4 +1,4 @@ -const {app, dialog, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron'); +const {app, dialog,clipboard, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron'); const _ = require('underscore'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); @@ -29,13 +29,22 @@ app.commandLine.appendSwitch('enable-network-information-downlink-max'); // See https://github.com/sindresorhus/electron-context-menu // Add the Paste and Match Style command to the context menu contextMenu({ - append: (defaultActions, parameters) => [ + 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', + visible: parameters.isEditable && parameters.editFlags.canPaste, + click: () => { + // Insert the plain text from the clipboard + const text = clipboard.readText(); + browserWindow.webContents.insertText(text); + }, + }), ], }); From be0f4fed64fa2956d04b69aec27f610d446158e0 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Wed, 2 Aug 2023 01:48:45 +0530 Subject: [PATCH 02/13] MacOS: Update keyboard shortcuts for paste operations in context menu --- desktop/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/main.js b/desktop/main.js index beb5692b2d4a..891b1ed8ba43 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -34,11 +34,12 @@ contextMenu({ // Only enable the menu item for Editable context which supports paste visible: parameters.isEditable && parameters.editFlags.canPaste, role: 'pasteAndMatchStyle', - accelerator: 'CmdOrCtrl+Shift+V', + accelerator: 'Option+Shift+CmdOrCtrl+V', }), new MenuItem({ label: 'Paste as Plain Text', visible: parameters.isEditable && parameters.editFlags.canPaste, + accelerator:'CmdOrCtrl+Shift+V', click: () => { // Insert the plain text from the clipboard const text = clipboard.readText(); From 17edf601b99f2b393aed63e504e1cd0d2d8c641c Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Wed, 2 Aug 2023 01:52:44 +0530 Subject: [PATCH 03/13] MacOS: Add accelerator for 'Paste and Match Style' in app menu --- desktop/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/desktop/main.js b/desktop/main.js index 891b1ed8ba43..3b457936ce75 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -333,7 +333,11 @@ const mainWindow = () => { {id: 'cut', role: 'cut'}, {id: 'copy', role: 'copy'}, {id: 'paste', role: 'paste'}, - {id: 'pasteAndMatchStyle', role: 'pasteAndMatchStyle'}, + { + id: 'pasteAndMatchStyle', + role: 'pasteAndMatchStyle', + accelerator: 'Option+Shift+CmdOrCtrl+V', + }, {id: 'delete', role: 'delete'}, {id: 'selectAll', role: 'selectAll'}, {type: 'separator'}, From 72fd957e7397115a800dc48f1d32bf6faf791f48 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Wed, 2 Aug 2023 04:17:08 +0530 Subject: [PATCH 04/13] Desktop: Add 'Paste as Plain Text' to macOS Edit menu with translations --- desktop/main.js | 13 +++++++++++-- src/languages/en.js | 1 + src/languages/es.js | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 3b457936ce75..360c1f3595a3 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -37,7 +37,7 @@ contextMenu({ accelerator: 'Option+Shift+CmdOrCtrl+V', }), new MenuItem({ - label: 'Paste as Plain Text', + label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), visible: parameters.isEditable && parameters.editFlags.canPaste, accelerator:'CmdOrCtrl+Shift+V', click: () => { @@ -337,7 +337,16 @@ const mainWindow = () => { id: 'pasteAndMatchStyle', role: 'pasteAndMatchStyle', accelerator: 'Option+Shift+CmdOrCtrl+V', - }, + }, + { + id: 'pasteAsPlainText', + accelerator:'CmdOrCtrl+Shift+V', + click: () => { + // Insert the plain text from the clipboard + const text = clipboard.readText(); + browserWindow.webContents.insertText(text); + }, + }, {id: 'delete', role: 'delete'}, {id: 'selectAll', role: 'selectAll'}, {type: 'separator'}, diff --git a/src/languages/en.js b/src/languages/en.js index 4e3e938e5818..dafb8e1de7b1 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1402,6 +1402,7 @@ export default { copy: 'Copy', paste: 'Paste', pasteAndMatchStyle: 'Paste and Match Style', + pasteAsPlainText:'Paste As Plain Text', delete: 'Delete', selectAll: 'Select All', speechSubmenu: 'Speech', diff --git a/src/languages/es.js b/src/languages/es.js index 4810df39c3a4..a90f985f8375 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -1413,6 +1413,7 @@ export default { copy: 'Copiar', paste: 'Pegar', pasteAndMatchStyle: 'Pegar adaptando el estilo', + pasteAsPlainText:'Pegar como texto sin formato', delete: 'Eliminar', selectAll: 'Seleccionar todo', speechSubmenu: 'Voz', From 3788766180f46c323e9d04f16335b27a8e75947d Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Wed, 2 Aug 2023 05:26:55 +0530 Subject: [PATCH 05/13] Desktop: Change hardcoded accelerator for pasteAsPlainText to a constant --- desktop/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 360c1f3595a3..48c6de441850 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -12,6 +12,7 @@ const CONST = require('../src/CONST').default; const Localize = require('../src/libs/Localize'); const port = process.env.PORT || 8080; +const PASTE_AS_PLAIN_TEXT_ACCELERATOR = 'CmdOrCtrl+Shift+V'; app.setName('New Expensify'); @@ -39,7 +40,7 @@ contextMenu({ new MenuItem({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), visible: parameters.isEditable && parameters.editFlags.canPaste, - accelerator:'CmdOrCtrl+Shift+V', + accelerator:PASTE_AS_PLAIN_TEXT_ACCELERATOR, click: () => { // Insert the plain text from the clipboard const text = clipboard.readText(); @@ -340,7 +341,7 @@ const mainWindow = () => { }, { id: 'pasteAsPlainText', - accelerator:'CmdOrCtrl+Shift+V', + accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, click: () => { // Insert the plain text from the clipboard const text = clipboard.readText(); From fa44ec2e806065844f5f0e93e76dbaca470360d6 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt <65986357+ygshbht@users.noreply.github.com> Date: Thu, 3 Aug 2023 02:48:20 +0530 Subject: [PATCH 06/13] Lint code: Apply suggestions from code review Co-authored-by: Manan --- desktop/main.js | 2 +- src/languages/en.js | 2 +- src/languages/es.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 48c6de441850..afd2ce114d35 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -40,7 +40,7 @@ contextMenu({ new MenuItem({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), visible: parameters.isEditable && parameters.editFlags.canPaste, - accelerator:PASTE_AS_PLAIN_TEXT_ACCELERATOR, + accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, click: () => { // Insert the plain text from the clipboard const text = clipboard.readText(); diff --git a/src/languages/en.js b/src/languages/en.js index dafb8e1de7b1..df2ec569e933 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1402,7 +1402,7 @@ export default { copy: 'Copy', paste: 'Paste', pasteAndMatchStyle: 'Paste and Match Style', - pasteAsPlainText:'Paste As Plain Text', + pasteAsPlainText:'Paste as Plain Text', delete: 'Delete', selectAll: 'Select All', speechSubmenu: 'Speech', diff --git a/src/languages/es.js b/src/languages/es.js index a90f985f8375..1404889f6a07 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -1413,7 +1413,7 @@ export default { copy: 'Copiar', paste: 'Pegar', pasteAndMatchStyle: 'Pegar adaptando el estilo', - pasteAsPlainText:'Pegar como texto sin formato', + pasteAsPlainText: 'Pegar como texto sin formato', delete: 'Eliminar', selectAll: 'Seleccionar todo', speechSubmenu: 'Voz', From e90afa78a0314ded541699c062a8e51489e5153f Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 02:52:00 +0530 Subject: [PATCH 07/13] More code linting --- desktop/main.js | 4 ++-- src/languages/en.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index afd2ce114d35..d33cedb8d1d3 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -1,4 +1,4 @@ -const {app, dialog,clipboard, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron'); +const {app, dialog, clipboard, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron'); const _ = require('underscore'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); @@ -347,7 +347,7 @@ const mainWindow = () => { const text = clipboard.readText(); browserWindow.webContents.insertText(text); }, - }, + }, {id: 'delete', role: 'delete'}, {id: 'selectAll', role: 'selectAll'}, {type: 'separator'}, diff --git a/src/languages/en.js b/src/languages/en.js index df2ec569e933..257d1336ba9f 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1402,7 +1402,7 @@ export default { copy: 'Copy', paste: 'Paste', pasteAndMatchStyle: 'Paste and Match Style', - pasteAsPlainText:'Paste as Plain Text', + pasteAsPlainText: 'Paste as Plain Text', delete: 'Delete', selectAll: 'Select All', speechSubmenu: 'Speech', From b3e1f4aa06bb7eaf70e0f8bddce8c1057f97cee8 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 02:55:21 +0530 Subject: [PATCH 08/13] Desktop: Update accelerator for 'Paste and Match Style' to use constant --- desktop/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index d33cedb8d1d3..e34e77f964d8 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -13,6 +13,7 @@ const Localize = require('../src/libs/Localize'); const port = process.env.PORT || 8080; const PASTE_AS_PLAIN_TEXT_ACCELERATOR = 'CmdOrCtrl+Shift+V'; +const PASTE_AND_MATCH_STYLE_ACCELERATOR = 'Option+Shift+CmdOrCtrl+V'; app.setName('New Expensify'); @@ -35,7 +36,7 @@ contextMenu({ // Only enable the menu item for Editable context which supports paste visible: parameters.isEditable && parameters.editFlags.canPaste, role: 'pasteAndMatchStyle', - accelerator: 'Option+Shift+CmdOrCtrl+V', + accelerator: PASTE_AND_MATCH_STYLE_ACCELERATOR, }), new MenuItem({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), @@ -337,7 +338,7 @@ const mainWindow = () => { { id: 'pasteAndMatchStyle', role: 'pasteAndMatchStyle', - accelerator: 'Option+Shift+CmdOrCtrl+V', + accelerator: PASTE_AND_MATCH_STYLE_ACCELERATOR, }, { id: 'pasteAsPlainText', From ff5c901fdb913fb7fe978aeb4107127add17f71e Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 03:01:00 +0530 Subject: [PATCH 09/13] Desktop: Refactor - Extract 'paste as plain text' logic to separate function --- desktop/main.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index e34e77f964d8..4164090efbd7 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -27,6 +27,16 @@ app.setName('New Expensify'); // See: https://github.com/electron/electron/issues/22597 app.commandLine.appendSwitch('enable-network-information-downlink-max'); +/** + * Inserts the plain text from the clipboard into the provided browser window's web contents. + * + * @param {BrowserWindow} browserWindow - The Electron BrowserWindow instance where the text should be inserted. + */ +function pasteAsPlainText(browserWindow) { + const text = clipboard.readText(); + browserWindow.webContents.insertText(text); +} + // Initialize the right click menu // See https://github.com/sindresorhus/electron-context-menu // Add the Paste and Match Style command to the context menu @@ -42,11 +52,7 @@ contextMenu({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), visible: parameters.isEditable && parameters.editFlags.canPaste, accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, - click: () => { - // Insert the plain text from the clipboard - const text = clipboard.readText(); - browserWindow.webContents.insertText(text); - }, + click: () => pasteAsPlainText(browserWindow), }), ], }); @@ -343,11 +349,7 @@ const mainWindow = () => { { id: 'pasteAsPlainText', accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, - click: () => { - // Insert the plain text from the clipboard - const text = clipboard.readText(); - browserWindow.webContents.insertText(text); - }, + click: pasteAsPlainText(browserWindow), }, {id: 'delete', role: 'delete'}, {id: 'selectAll', role: 'selectAll'}, From c9f48fad0169da72eec9cd6ebc6d930fbeeb497d Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 03:27:25 +0530 Subject: [PATCH 10/13] Update 'Paste as Plain Text' menu item visibility and action --- desktop/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index 4164090efbd7..7709f51b4df4 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -37,6 +37,16 @@ function pasteAsPlainText(browserWindow) { browserWindow.webContents.insertText(text); } +/** + * Checks if the clipboard contains text. + * + * @returns {boolean} - Returns `true` if the clipboard contains text, otherwise returns `false`. + */ +function clipboardHasText() { + const clipboardText = clipboard.readText(); + return clipboardText.length > 0; +} + // Initialize the right click menu // See https://github.com/sindresorhus/electron-context-menu // Add the Paste and Match Style command to the context menu @@ -50,7 +60,7 @@ contextMenu({ }), new MenuItem({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), - visible: parameters.isEditable && parameters.editFlags.canPaste, + visible: parameters.isEditable && parameters.editFlags.canPaste && clipboardHasText(), accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, click: () => pasteAsPlainText(browserWindow), }), @@ -349,7 +359,7 @@ const mainWindow = () => { { id: 'pasteAsPlainText', accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, - click: pasteAsPlainText(browserWindow), + click: () => pasteAsPlainText(browserWindow), }, {id: 'delete', role: 'delete'}, {id: 'selectAll', role: 'selectAll'}, From b51c796d66a329d8d8525961100c564a70c6ac32 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 04:08:31 +0530 Subject: [PATCH 11/13] Desktop: Add constant for 'Paste as Plain Text' menu item ID --- desktop/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop/main.js b/desktop/main.js index 7709f51b4df4..d02aded594f5 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -310,6 +310,8 @@ const mainWindow = () => { browserWindow.setTitle('New Expensify'); } + const PASTE_AS_PLAIN_TEXT_EDIT_MENU_ID = 'pasteAsPlainText'; + const initialMenuTemplate = [ { id: 'mainMenu', @@ -357,7 +359,7 @@ const mainWindow = () => { accelerator: PASTE_AND_MATCH_STYLE_ACCELERATOR, }, { - id: 'pasteAsPlainText', + id: PASTE_AS_PLAIN_TEXT_EDIT_MENU_ID, accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, click: () => pasteAsPlainText(browserWindow), }, From 23614162553f601e8cd656569c4e89410081e0bc Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 15:40:37 +0530 Subject: [PATCH 12/13] Desktop: Refactoring --- desktop/main.js | 27 +++++++-------------------- src/CONST.js | 5 +++++ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index d02aded594f5..3a153b4d13c5 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -12,8 +12,7 @@ const CONST = require('../src/CONST').default; const Localize = require('../src/libs/Localize'); const port = process.env.PORT || 8080; -const PASTE_AS_PLAIN_TEXT_ACCELERATOR = 'CmdOrCtrl+Shift+V'; -const PASTE_AND_MATCH_STYLE_ACCELERATOR = 'Option+Shift+CmdOrCtrl+V'; +const {DESKTOP_SHORTCUT_ACCELERATOR} = CONST; app.setName('New Expensify'); @@ -37,16 +36,6 @@ function pasteAsPlainText(browserWindow) { browserWindow.webContents.insertText(text); } -/** - * Checks if the clipboard contains text. - * - * @returns {boolean} - Returns `true` if the clipboard contains text, otherwise returns `false`. - */ -function clipboardHasText() { - const clipboardText = clipboard.readText(); - return clipboardText.length > 0; -} - // Initialize the right click menu // See https://github.com/sindresorhus/electron-context-menu // Add the Paste and Match Style command to the context menu @@ -56,12 +45,12 @@ contextMenu({ // Only enable the menu item for Editable context which supports paste visible: parameters.isEditable && parameters.editFlags.canPaste, role: 'pasteAndMatchStyle', - accelerator: PASTE_AND_MATCH_STYLE_ACCELERATOR, + accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE, }), new MenuItem({ label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'), - visible: parameters.isEditable && parameters.editFlags.canPaste && clipboardHasText(), - accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, + visible: parameters.isEditable && parameters.editFlags.canPaste && clipboard.readText().length > 0, + accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT, click: () => pasteAsPlainText(browserWindow), }), ], @@ -310,8 +299,6 @@ const mainWindow = () => { browserWindow.setTitle('New Expensify'); } - const PASTE_AS_PLAIN_TEXT_EDIT_MENU_ID = 'pasteAsPlainText'; - const initialMenuTemplate = [ { id: 'mainMenu', @@ -356,11 +343,11 @@ const mainWindow = () => { { id: 'pasteAndMatchStyle', role: 'pasteAndMatchStyle', - accelerator: PASTE_AND_MATCH_STYLE_ACCELERATOR, + accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE, }, { - id: PASTE_AS_PLAIN_TEXT_EDIT_MENU_ID, - accelerator: PASTE_AS_PLAIN_TEXT_ACCELERATOR, + id: 'pasteAsPlainText', + accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT, click: () => pasteAsPlainText(browserWindow), }, {id: 'delete', role: 'delete'}, diff --git a/src/CONST.js b/src/CONST.js index 06bc1873431f..ec19f8066326 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -141,6 +141,11 @@ const CONST = { MAX_AGE: 150, }, + DESKTOP_SHORTCUT_ACCELERATOR: { + PASTE_AND_MATCH_STYLE: `Option+Shift+CmdOrCtrl+V`, + PASTE_AS_PLAIN_TEXT: `CmdOrCtrl+Shift+V`, + }, + // This is used to enable a rotation/transform style to any component. DIRECTION: { LEFT: 'left', From aeb0d0c02ff61e95d25f789ef6e03defde019924 Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt Date: Thu, 3 Aug 2023 15:42:42 +0530 Subject: [PATCH 13/13] Desktop: Formatting --- src/CONST.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index ec19f8066326..8c363af3db11 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -142,8 +142,8 @@ const CONST = { }, DESKTOP_SHORTCUT_ACCELERATOR: { - PASTE_AND_MATCH_STYLE: `Option+Shift+CmdOrCtrl+V`, - PASTE_AS_PLAIN_TEXT: `CmdOrCtrl+Shift+V`, + PASTE_AND_MATCH_STYLE: 'Option+Shift+CmdOrCtrl+V', + PASTE_AS_PLAIN_TEXT: 'CmdOrCtrl+Shift+V', }, // This is used to enable a rotation/transform style to any component.