mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-21 23:03:11 -05:00
Fix Shift-number shortcuts don't work on windows
The perennial issue of should keyboard shortcuts be about the character or the key!
This commit is contained in:
parent
43799dc57d
commit
46bc36861e
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,12 @@ const _onKey = function (this: Squire, event: KeyboardEvent): void {
|
|||
// control key modifiers.
|
||||
let key = event.key;
|
||||
let modifiers = '';
|
||||
const code = event.code;
|
||||
// If pressing a number key + Shift, make sure we handle it as the number
|
||||
// key and not whatever different character the shift might turn it into.
|
||||
if (/^Digit\d$/.test(code)) {
|
||||
key = code.slice(-1);
|
||||
}
|
||||
if (key !== 'Backspace' && key !== 'Delete') {
|
||||
if (event.altKey) {
|
||||
modifiers += 'Alt-';
|
||||
|
|
Loading…
Reference in a new issue