Env dialog hotkey

This commit is contained in:
Gregory Schier
2023-11-21 22:35:28 -08:00
parent 15aa93f5f9
commit 4f9d1278f7
5 changed files with 45 additions and 7 deletions

View File

@@ -40,7 +40,13 @@ export const UrlBar = memo(function UrlBar({ id: requestId, url, method, classNa
[sendRequest],
);
useHotkey('url.focus', () => inputRef.current?.focus());
useHotkey('urlBar.focus', () => {
const head = inputRef.current?.state.doc.length ?? 0;
inputRef.current?.dispatch({
selection: { anchor: 0, head },
});
inputRef.current?.focus();
});
return (
<form onSubmit={handleSubmit} className={classNames('url-bar', className)}>