浏览代码

change copy/paste styles shortcuts (#1881)

* change copy/paste styles shortcuts

* use keyCode
David Luzar 5 年之前
父节点
当前提交
df5eb3f0d9
共有 3 个文件被更改,包括 10 次插入4 次删除
  1. 6 2
      src/actions/actionStyles.ts
  2. 2 2
      src/components/ShortcutsDialog.tsx
  3. 2 0
      src/keys.ts

+ 6 - 2
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,
 });

+ 2 - 2
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")}

+ 2 - 0
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;