diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-03-21 13:36:41 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-03-21 13:36:41 +0900 |
| commit | 6fb7721798657cf842556fb63f116316365efa74 (patch) | |
| tree | 6917342553156b6483b899eafc66ef8f040b8352 /src/client/scripts | |
| parent | Update CHANGELOG.md (diff) | |
| parent | 12.22.0 (diff) | |
| download | misskey-6fb7721798657cf842556fb63f116316365efa74.tar.gz misskey-6fb7721798657cf842556fb63f116316365efa74.tar.bz2 misskey-6fb7721798657cf842556fb63f116316365efa74.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/client/scripts')
| -rw-r--r-- | src/client/scripts/hotkey.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/scripts/hotkey.ts b/src/client/scripts/hotkey.ts index ec627ab15b..672dbedde1 100644 --- a/src/client/scripts/hotkey.ts +++ b/src/client/scripts/hotkey.ts @@ -12,14 +12,22 @@ type action = { patterns: pattern[]; callback: Function; + + allowRepeat: boolean; }; const getKeyMap = keymap => Object.entries(keymap).map(([patterns, callback]): action => { const result = { patterns: [], - callback: callback + callback: callback, + allowRepeat: true } as action; + if (patterns.match(/^\(.*\)$/) !== null) { + result.allowRepeat = false; + patterns = patterns.slice(1, -1); + } + result.patterns = patterns.split('|').map(part => { const pattern = { which: [], @@ -77,6 +85,7 @@ export default { const matched = match(e, action.patterns); if (matched) { + if (!action.allowRepeat && e.repeat) return; if (el._hotkey_global && match(e, targetReservedKeys)) return; e.preventDefault(); |