From 8ed7b309e9bda8dec55d6546ecb61c6f41faa0f4 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Sun, 6 Nov 2022 20:50:22 +0800 Subject: [PATCH] feat:add page scale shortcut key --- src/editor/dataset/enum/KeyMap.ts | 3 +++ src/main.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/editor/dataset/enum/KeyMap.ts b/src/editor/dataset/enum/KeyMap.ts index 857e57c..3ea9eef 100644 --- a/src/editor/dataset/enum/KeyMap.ts +++ b/src/editor/dataset/enum/KeyMap.ts @@ -14,6 +14,9 @@ export enum KeyMap { PERIOD = '.', LEFT_ANGLE_BRACKET = '<', RIGHT_ANGLE_BRACKET = '>', + EQUAL = '=', + MINUS = '-', + PLUS = '+', A = 'a', B = 'b', C = 'c', diff --git a/src/main.ts b/src/main.ts index db975d9..900d31e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -639,6 +639,7 @@ window.onload = function () { } else { searchCollapseDom.style.right = 'unset' } + searchInputDom.focus() } searchCollapseDom.querySelector('span')!.onclick = function () { searchCollapseDom.style.display = 'none' @@ -989,6 +990,22 @@ window.onload = function () { callback: () => { searchDom.click() } + }, + { + key: KeyMap.MINUS, + ctrl: true, + isGlobal: true, + callback: (command: Command) => { + command.executePageScaleMinus() + } + }, + { + key: KeyMap.EQUAL, + ctrl: true, + isGlobal: true, + callback: (command: Command) => { + command.executePageScaleAdd() + } } ])