mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(hotkeys): shortcuts with number keys not working
This commit is contained in:
parent
030178cad2
commit
5289d41b12
@ -155,7 +155,18 @@ function keyMatches(e: KeyboardEvent, key: string): boolean {
|
|||||||
return mappedKeys.includes(e.key) || mappedKeys.includes(e.code);
|
return mappedKeys.includes(e.key) || mappedKeys.includes(e.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For regular keys, check both key and code
|
// For number keys, use the physical key code regardless of modifiers
|
||||||
|
// This works across all keyboard layouts
|
||||||
|
if (key >= '0' && key <= '9') {
|
||||||
|
return e.code === `Digit${key}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For letter keys, use the physical key code for consistency
|
||||||
|
if (key.length === 1 && key >= 'a' && key <= 'z') {
|
||||||
|
return e.code === `Key${key.toUpperCase()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For regular keys, check both key and code as fallback
|
||||||
return e.key.toLowerCase() === key.toLowerCase() ||
|
return e.key.toLowerCase() === key.toLowerCase() ||
|
||||||
e.code.toLowerCase() === key.toLowerCase();
|
e.code.toLowerCase() === key.toLowerCase();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user