From 897f178a5c4244e85f1c33a06355dbbcb788a013 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Sat, 28 Feb 2026 22:18:36 -0500 Subject: [PATCH] feat(site): replace Agent chat textarea with Lexical editor (#22449) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Replaces the plain `` in the Agent chat input (`AgentChatInput`) with a Lexical-based editor component, matching the pattern used in [coder/blink](https://github.com/coder/blink). ## What changed ### New component: `ChatMessageInput` `site/src/components/ChatMessageInput/ChatMessageInput.tsx` A Lexical-powered text input that behaves as a plain-text editor with: - **Enter** submits, **Shift+Enter** inserts newline - Rich-text formatting disabled (Cmd+B/I/U blocked) - Paste sanitization (strips formatting, inserts plain text) - Undo/redo via HistoryPlugin - Imperative ref API: `insertText()`, `clear()`, `focus()`, `getValue()` ### Updated components - **`AgentChatInput.tsx`** — Swapped `` for ``. Moved from controlled `value`/`onChange` to ref-based pattern with `initialValue`/`onContentChange`. - **`AgentDetail.tsx`** — Updated to use `useRef` for input value tracking and `editorInitialValue` state for editor resets (edit/cancel flows). - **`AgentsPage.tsx`** — Updated to use `useRef` + `initialValue` pattern. - **`AgentChatInput.stories.tsx`** — Updated prop names. ### Why Lexical? This lays the groundwork for features that a native `