Files
page-assist/src/utils/key-down.tsx

20 lines
475 B
TypeScript

export const handleChatInputKeyDown = ({
e,
sendWhenEnter,
typing,
isSending
}: {
e: React.KeyboardEvent
typing: boolean
sendWhenEnter: boolean
isSending: boolean
}) => {
return import.meta.env.BROWSER === "firefox"
? e.key === "Enter" &&
!e.shiftKey &&
!e.nativeEvent.isComposing &&
!isSending &&
sendWhenEnter
: !typing && e.key === "Enter" && !e.shiftKey && !isSending && sendWhenEnter
}