mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-22 15:18:27 -04:00
move keyboard shortcuts to global listener in url-bar (#5030)
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com> Co-authored-by: Mark Kim <103070941+marckong@users.noreply.github.com> Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com> Co-authored-by: Mark Kim <103070941+marckong@users.noreply.github.com>
This commit is contained in:
@@ -281,25 +281,27 @@ export const RequestUrlBar = forwardRef<RequestUrlBarHandle, Props>(({
|
||||
send();
|
||||
return;
|
||||
}
|
||||
if (!inputRef.current) {
|
||||
return;
|
||||
}
|
||||
executeHotKey(event.nativeEvent, hotKeyRefs.REQUEST_FOCUS_URL, () => {
|
||||
inputRef.current?.focus();
|
||||
inputRef.current?.selectAll();
|
||||
});
|
||||
executeHotKey(event.nativeEvent, hotKeyRefs.REQUEST_TOGGLE_HTTP_METHOD_MENU, () => {
|
||||
methodDropdownRef.current?.toggle();
|
||||
});
|
||||
executeHotKey(event.nativeEvent, hotKeyRefs.REQUEST_SHOW_OPTIONS, () => {
|
||||
dropdownRef.current?.toggle(true);
|
||||
});
|
||||
}, [request.url, send]);
|
||||
|
||||
const handleGlobalKeyDown = useCallback(async (event: KeyboardEvent) => {
|
||||
if (!inputRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
executeHotKey(event, hotKeyRefs.REQUEST_SEND, () => {
|
||||
send();
|
||||
});
|
||||
|
||||
executeHotKey(event, hotKeyRefs.REQUEST_FOCUS_URL, () => {
|
||||
inputRef.current?.focus();
|
||||
inputRef.current?.selectAll();
|
||||
});
|
||||
executeHotKey(event, hotKeyRefs.REQUEST_TOGGLE_HTTP_METHOD_MENU, () => {
|
||||
methodDropdownRef.current?.toggle();
|
||||
});
|
||||
executeHotKey(event, hotKeyRefs.REQUEST_SHOW_OPTIONS, () => {
|
||||
dropdownRef.current?.toggle(true);
|
||||
});
|
||||
}, [send]);
|
||||
|
||||
const [lastPastedText, setLastPastedText] = useState<string>();
|
||||
|
||||
Reference in New Issue
Block a user