From 7149b08d725de34c32f07c4649237d4f5166ba52 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sun, 22 May 2022 17:02:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/configs/hotkey.ts | 3 +++ src/hooks/useGlobalHotkey.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/configs/hotkey.ts b/src/configs/hotkey.ts index ebf14941..634b5ab1 100644 --- a/src/configs/hotkey.ts +++ b/src/configs/hotkey.ts @@ -9,6 +9,7 @@ export const enum KEYS { F = 'F', D = 'D', B = 'B', + P = 'P', MINUS = '-', EQUAL = '=', DIGIT_0 = '0', @@ -40,6 +41,8 @@ export const HOTKEY_DOC = [ { label: '恢复', value: 'Ctrl + Y' }, { label: '删除', value: 'Delete / Backspace' }, { label: '多选', value: '按住 Ctrl 或 Shift' }, + { label: '打印', value: 'Ctrl + P' }, + { label: '关闭弹窗', value: 'ESC' }, ], }, { diff --git a/src/hooks/useGlobalHotkey.ts b/src/hooks/useGlobalHotkey.ts index 9a6b97ce..e0214755 100644 --- a/src/hooks/useGlobalHotkey.ts +++ b/src/hooks/useGlobalHotkey.ts @@ -134,6 +134,12 @@ export default () => { if (shiftKey && !shiftKeyState.value) keyboardStore.setShiftKeyState(true) if (!disableHotkeys.value && key === KEYS.SPACE) keyboardStore.setSpaceKeyState(true) + + if (ctrlOrMetaKeyActive && key === KEYS.P) { + e.preventDefault() + mainStore.setDialogForExport('pdf') + return + } if (shiftKey && key === KEYS.F5) { e.preventDefault() enterScreening()