Fixed hotkeys not working with shift + number

This commit is contained in:
thepaperpilot 2022-12-21 22:39:05 -06:00
parent 56b1a7a9b4
commit 23ad0680f5

View file

@ -44,6 +44,8 @@ export type GenericHotkey = Replace<
} }
>; >;
const uppercaseNumbers = [")", "!", "@", "#", "$", "5", "^", "&", "*", "("];
export function createHotkey<T extends HotkeyOptions>( export function createHotkey<T extends HotkeyOptions>(
optionsFunc: OptionsFunc<T, BaseHotkey, GenericHotkey> optionsFunc: OptionsFunc<T, BaseHotkey, GenericHotkey>
): Hotkey<T> { ): Hotkey<T> {
@ -79,7 +81,9 @@ document.onkeydown = function (e) {
return; return;
} }
let key = e.key; let key = e.key;
if (e.shiftKey) { if (uppercaseNumbers.includes(key)) {
key = "shift+" + uppercaseNumbers.indexOf(key);
} else if (e.shiftKey) {
key = "shift+" + key; key = "shift+" + key;
} }
if (e.ctrlKey) { if (e.ctrlKey) {