Fixed hotkeys not working with shift + number
This commit is contained in:
parent
56b1a7a9b4
commit
23ad0680f5
1 changed files with 5 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue