diff --git a/src/actions/actionSelectAll.ts b/src/actions/actionSelectAll.ts index 8342ed43..86850cd9 100644 --- a/src/actions/actionSelectAll.ts +++ b/src/actions/actionSelectAll.ts @@ -9,5 +9,5 @@ export const actionSelectAll: Action = { }; }, contextItemLabel: "labels.selectAll", - keyTest: event => event[KEYS.META] && event.code === "KeyA", + keyTest: event => event[KEYS.META] && event.key === "a", }; diff --git a/src/actions/actionStyles.ts b/src/actions/actionStyles.ts index a0e79e33..73e40795 100644 --- a/src/actions/actionStyles.ts +++ b/src/actions/actionStyles.ts @@ -14,7 +14,7 @@ export const actionCopyStyles: Action = { return {}; }, contextItemLabel: "labels.copyStyles", - keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyC", + keyTest: event => event[KEYS.META] && event.shiftKey && event.key === "C", contextMenuOrder: 0, }; @@ -46,6 +46,6 @@ export const actionPasteStyles: Action = { }; }, contextItemLabel: "labels.pasteStyles", - keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyV", + keyTest: event => event[KEYS.META] && event.shiftKey && event.key === "V", contextMenuOrder: 1, }; diff --git a/src/actions/actionZindex.tsx b/src/actions/actionZindex.tsx index d877986c..a111e533 100644 --- a/src/actions/actionZindex.tsx +++ b/src/actions/actionZindex.tsx @@ -18,8 +18,7 @@ export const actionSendBackward: Action = { }, contextItemLabel: "labels.sendBackward", keyPriority: 40, - keyTest: event => - event[KEYS.META] && event.shiftKey && event.altKey && event.code === "KeyB", + keyTest: event => event[KEYS.META] && event.altKey && event.key === "B", }; export const actionBringForward: Action = { @@ -32,8 +31,7 @@ export const actionBringForward: Action = { }, contextItemLabel: "labels.bringForward", keyPriority: 40, - keyTest: event => - event[KEYS.META] && event.shiftKey && event.altKey && event.code === "KeyF", + keyTest: event => event[KEYS.META] && event.altKey && event.key === "F", }; export const actionSendToBack: Action = { @@ -45,7 +43,7 @@ export const actionSendToBack: Action = { }; }, contextItemLabel: "labels.sendToBack", - keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyB", + keyTest: event => event[KEYS.META] && event.shiftKey && event.key === "B", }; export const actionBringToFront: Action = { @@ -57,5 +55,5 @@ export const actionBringToFront: Action = { }; }, contextItemLabel: "labels.bringToFront", - keyTest: event => event[KEYS.META] && event.shiftKey && event.code === "KeyF", + keyTest: event => event[KEYS.META] && event.shiftKey && event.key === "F", }; diff --git a/src/index.tsx b/src/index.tsx index 0700ecaf..9d906fe5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -383,7 +383,8 @@ export class App extends React.Component { } elements = clearSelection(elements); this.setState({ elementType: shape }); - } else if (event[KEYS.META] && event.code === "KeyZ") { + // Undo action + } else if (event[KEYS.META] && /z/i.test(event.key)) { event.preventDefault(); if (