mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix(keyHelper): handle control key & format in uppercase
This commit is contained in:
parent
16de00272c
commit
3525de1dd4
2 changed files with 8 additions and 6 deletions
|
|
@ -33,6 +33,7 @@ function friendlyFormatShortcut(shortcut) {
|
|||
.replace(/ctrl/, '⌃')
|
||||
.replace(/shift/, '⇧')
|
||||
.replace(/alt/, '⌥')
|
||||
.toUpperCase()
|
||||
} else {
|
||||
return shortcut
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const keyCodeArray = [
|
|||
...'`[]\\;\',./'.split(''),
|
||||
'alt',
|
||||
'shift',
|
||||
'control',
|
||||
'ctrl',
|
||||
'meta',
|
||||
]
|
||||
const validKeyCodes = new Set(keyCodeArray)
|
||||
|
|
@ -33,11 +33,12 @@ function parse(keysString) {
|
|||
}
|
||||
|
||||
function parseKeyCode(code) {
|
||||
let c = code.toLowerCase()
|
||||
c = c.replace(/(left|right)$/, '')
|
||||
c = c.replace(/^digit/, '')
|
||||
c = c.replace(/^key/, '')
|
||||
return c
|
||||
return code
|
||||
.toLowerCase()
|
||||
.replace(/(left|right)$/, '')
|
||||
.replace(/^control$/, 'ctrl')
|
||||
.replace(/^digit/, '')
|
||||
.replace(/^key/, '')
|
||||
}
|
||||
|
||||
function parseEvent(e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue