From df5eb3f0d971e6172ced6ae7d8835179be131ca7 Mon Sep 17 00:00:00 2001 From: David Luzar <luzar.david@gmail.com> Date: Tue, 7 Jul 2020 20:22:23 +0200 Subject: [PATCH] change copy/paste styles shortcuts (#1881) * change copy/paste styles shortcuts * use keyCode --- src/actions/actionStyles.ts | 8 ++++++-- src/components/ShortcutsDialog.tsx | 4 ++-- src/keys.ts | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/actions/actionStyles.ts b/src/actions/actionStyles.ts index 2e1e72ee..2cd6936c 100644 --- a/src/actions/actionStyles.ts +++ b/src/actions/actionStyles.ts @@ -27,7 +27,9 @@ export const actionCopyStyles = register({ }, contextItemLabel: "labels.copyStyles", keyTest: (event) => - event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === "C", + event[KEYS.CTRL_OR_CMD] && + event.altKey && + event.keyCode === KEYS.C_KEY_CODE, contextMenuOrder: 0, }); @@ -67,6 +69,8 @@ export const actionPasteStyles = register({ }, contextItemLabel: "labels.pasteStyles", keyTest: (event) => - event[KEYS.CTRL_OR_CMD] && event.shiftKey && event.key === "V", + event[KEYS.CTRL_OR_CMD] && + event.altKey && + event.keyCode === KEYS.V_KEY_CODE, contextMenuOrder: 1, }); diff --git a/src/components/ShortcutsDialog.tsx b/src/components/ShortcutsDialog.tsx index 4f12ce79..2f90eddc 100644 --- a/src/components/ShortcutsDialog.tsx +++ b/src/components/ShortcutsDialog.tsx @@ -287,11 +287,11 @@ export const ShortcutsDialog = ({ onClose }: { onClose?: () => void }) => { /> <Shortcut label={t("labels.copyStyles")} - shortcuts={[getShortcutKey("CtrlOrCmd+Shift+C")]} + shortcuts={[getShortcutKey("CtrlOrCmd+Alt+C")]} /> <Shortcut label={t("labels.pasteStyles")} - shortcuts={[getShortcutKey("CtrlOrCmd+Shift+V")]} + shortcuts={[getShortcutKey("CtrlOrCmd+Alt+V")]} /> <Shortcut label={t("labels.delete")} diff --git a/src/keys.ts b/src/keys.ts index 10e82bcb..07cce39e 100644 --- a/src/keys.ts +++ b/src/keys.ts @@ -18,6 +18,8 @@ export const KEYS = { Z_KEY_CODE: 90, GRID_KEY_CODE: 222, G_KEY_CODE: 71, + C_KEY_CODE: 67, + V_KEY_CODE: 86, } as const; export type Key = keyof typeof KEYS;