change copy/paste styles shortcuts (#1881)

* change copy/paste styles shortcuts

* use keyCode
This commit is contained in:
David Luzar 2020-07-07 20:22:23 +02:00 committed by GitHub
parent 6f1cff101a
commit df5eb3f0d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -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,
});

View File

@ -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")}

View File

@ -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;