Download client/modules/keyboard.ts from abhijeetsarkargis/MiniSearch: direct link, hf CLI and curl.
- Browser
- Download file 412 Bytes
-
https://huggingface.co/spaces/abhijeetsarkargis/MiniSearch/resolve/main/client/modules/keyboard.ts
- Command line
-
hf download hf://spaces/abhijeetsarkargis/MiniSearch/client/modules/keyboard.ts
-
curl -L -o keyboard.ts https://huggingface.co/spaces/abhijeetsarkargis/MiniSearch/resolve/main/client/modules/keyboard.ts
412 Bytes
| import type { KeyboardEvent } from "react"; | |
| export const handleEnterKeyDown = ( | |
| event: KeyboardEvent<HTMLTextAreaElement>, | |
| settings: { enterToSubmit: boolean }, | |
| onSubmit: () => void, | |
| ) => { | |
| if ( | |
| (event.code === "Enter" && !event.shiftKey && settings.enterToSubmit) || | |
| (event.code === "Enter" && event.shiftKey && !settings.enterToSubmit) | |
| ) { | |
| event.preventDefault(); | |
| onSubmit(); | |
| } | |
| }; | |