mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 00:46:43 -06:00
将来的にバグに繋がりかねない挙動を修正
This commit is contained in:
parent
0ed704d173
commit
3b628ec3c4
1 changed files with 8 additions and 5 deletions
|
@ -22,7 +22,10 @@ const getKeyMap = keymap => Object.entries(keymap).map(([patterns, callback]): a
|
||||||
|
|
||||||
result.patterns = patterns.split('|').map(part => {
|
result.patterns = patterns.split('|').map(part => {
|
||||||
const pattern = {
|
const pattern = {
|
||||||
which: []
|
which: [],
|
||||||
|
ctrl: false,
|
||||||
|
alt: false,
|
||||||
|
shift: false
|
||||||
} as pattern;
|
} as pattern;
|
||||||
|
|
||||||
part.trim().split('+').forEach(key => {
|
part.trim().split('+').forEach(key => {
|
||||||
|
@ -66,10 +69,10 @@ export default {
|
||||||
if (el._hotkey_global && targetReservedKeys.includes(`'${key}'`)) break;
|
if (el._hotkey_global && targetReservedKeys.includes(`'${key}'`)) break;
|
||||||
|
|
||||||
const matched = action.patterns.some(pattern => {
|
const matched = action.patterns.some(pattern => {
|
||||||
let matched = pattern.which.includes(key);
|
const matched = pattern.which.includes(key) &&
|
||||||
if (pattern.ctrl && !e.ctrlKey) matched = false;
|
pattern.ctrl == e.ctrlKey &&
|
||||||
if (pattern.shift && !e.shiftKey) matched = false;
|
pattern.shift == e.shiftKey &&
|
||||||
if (pattern.alt && !e.altKey) matched = false;
|
pattern.alt == e.altKey;
|
||||||
|
|
||||||
if (matched) {
|
if (matched) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Loading…
Reference in a new issue