feat: make shortcuts easier to add across the app
This commit is contained in:
@@ -107,13 +107,20 @@ const handleKeyDown = async (event: KeyboardEvent) => {
|
||||
};
|
||||
|
||||
const handleWindowKeyDown = async (event: KeyboardEvent) => {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
return;
|
||||
}
|
||||
if (event.defaultPrevented) return;
|
||||
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
||||
|
||||
if (document.activeElement === document.body) {
|
||||
// redirect all standard keyboard input to the input field
|
||||
inputRef.value?.focus();
|
||||
const isPrintable = event.key.length === 1;
|
||||
|
||||
if (isPrintable) {
|
||||
inputRef.value?.focus();
|
||||
} else if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
handleSubmit();
|
||||
inputRef.value?.focus();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user