From 3b628ec3c464951a47896dca550ae1da66c05ec5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 18 Sep 2018 15:02:15 +0900 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=9D=A5=E7=9A=84=E3=81=AB=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=81=AB=E7=B9=8B=E3=81=8C=E3=82=8A=E3=81=8B=E3=81=AD?= =?UTF-8?q?=E3=81=AA=E3=81=84=E6=8C=99=E5=8B=95=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/hotkey.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/app/common/hotkey.ts b/src/client/app/common/hotkey.ts index 03806fb18..e63fcc9f9 100644 --- a/src/client/app/common/hotkey.ts +++ b/src/client/app/common/hotkey.ts @@ -22,7 +22,10 @@ const getKeyMap = keymap => Object.entries(keymap).map(([patterns, callback]): a result.patterns = patterns.split('|').map(part => { const pattern = { - which: [] + which: [], + ctrl: false, + alt: false, + shift: false } as pattern; part.trim().split('+').forEach(key => { @@ -66,10 +69,10 @@ export default { if (el._hotkey_global && targetReservedKeys.includes(`'${key}'`)) break; const matched = action.patterns.some(pattern => { - let matched = pattern.which.includes(key); - if (pattern.ctrl && !e.ctrlKey) matched = false; - if (pattern.shift && !e.shiftKey) matched = false; - if (pattern.alt && !e.altKey) matched = false; + const matched = pattern.which.includes(key) && + pattern.ctrl == e.ctrlKey && + pattern.shift == e.shiftKey && + pattern.alt == e.altKey; if (matched) { e.preventDefault();