diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-18 15:02:15 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-18 15:02:15 +0900 |
| commit | 3b628ec3c464951a47896dca550ae1da66c05ec5 (patch) | |
| tree | 8e6037482467223df352e9062b2c8f1ecc4593b0 /src | |
| parent | 8.52.0 (diff) | |
| download | misskey-3b628ec3c464951a47896dca550ae1da66c05ec5.tar.gz misskey-3b628ec3c464951a47896dca550ae1da66c05ec5.tar.bz2 misskey-3b628ec3c464951a47896dca550ae1da66c05ec5.zip | |
将来的にバグに繋がりかねない挙動を修正
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/hotkey.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/app/common/hotkey.ts b/src/client/app/common/hotkey.ts index 03806fb184..e63fcc9f97 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(); |