diff --git a/web/src/components/MessageComposer.tsx b/web/src/components/MessageComposer.tsx index 320c145..3604977 100644 --- a/web/src/components/MessageComposer.tsx +++ b/web/src/components/MessageComposer.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, type KeyboardEvent } from "react"; import { attachFile, requestUploadUrl, sendMessageWithClientId, uploadToPresignedUrl } from "../api/chats"; import { useAuthStore } from "../store/authStore"; import { useChatStore } from "../store/chatStore"; @@ -104,6 +104,13 @@ export function MessageComposer() { } } + function onComposerKeyDown(event: KeyboardEvent) { + if (event.key === "Enter" && !event.shiftKey) { + event.preventDefault(); + void handleSend(); + } + } + async function handleUpload(file: File, messageType: "file" | "image" | "video" | "audio" | "voice" = "file") { if (!activeChatId || !me) { return; @@ -314,10 +321,12 @@ export function MessageComposer() { }} /> - { const next = e.target.value; setText(next);