diff --git a/web/src/App.css b/web/src/App.css index af519bd..3ab77c3 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -645,14 +645,18 @@ border-top: 1px solid var(--border-soft); } -.ts-chat-input-row input { +.ts-chat-input-row textarea { flex: 1; border: 1px solid var(--border); border-radius: 2px; padding: 0.3rem 0.5rem; font-size: 12px; + font-family: inherit; background: var(--input-bg); color: var(--input-text); + resize: none; + max-height: 8.5em; + overflow-y: auto; } .ts-chat-input-row button { diff --git a/web/src/App.tsx b/web/src/App.tsx index cb1683d..c645262 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1399,6 +1399,7 @@ function AppInner() { const [chat, setChat] = useState([]); const [serverChat, setServerChat] = useState([]); const [chatInput, setChatInput] = useState(""); + const chatInputRef = useRef(null); const [pmThreads, setPmThreads] = useState>({}); const [pokes, setPokes] = useState([]); const [pokeTarget, setPokeTarget] = useState<{ id: number; name: string } | null>(null); @@ -2092,6 +2093,13 @@ function AppInner() { const handleSelectItem = (item: SelectedItem) => setSelected(item); + useEffect(() => { + const el = chatInputRef.current; + if (!el) return; + el.style.height = "auto"; + el.style.height = `${el.scrollHeight}px`; + }, [chatInput]); + const handleSendChat = () => { const message = chatInput.trim(); if (!message) return; @@ -2695,10 +2703,17 @@ function AppInner() { ))}
- setChatInput(e.target.value)} - onKeyDown={(e) => e.key === "Enter" && handleSendChat()} + onKeyDown={(e) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); + handleSendChat(); + } + }} disabled={!connected} placeholder={ !connected