diff --git a/frontend/src/app/pages/AgentChat/ChatInput.tsx b/frontend/src/app/pages/AgentChat/ChatInput.tsx index c0fb6eec..1dea3b31 100644 --- a/frontend/src/app/pages/AgentChat/ChatInput.tsx +++ b/frontend/src/app/pages/AgentChat/ChatInput.tsx @@ -178,7 +178,7 @@ const ChatInput = forwardRef(({ onSend, disabled, mode, sendSkills, browserIds.length > 0 ? browserIds : undefined, ); - editor.innerHTML = ''; + if (editor.tagName === 'TEXTAREA') (editor as unknown as HTMLTextAreaElement).value = ''; else editor.innerHTML = ''; deleteDraft(ownerId); for (const img of images) { if (img.preview?.startsWith('blob:')) { diff --git a/frontend/src/app/pages/AgentChat/ChatInput/hooks/draftStore.ts b/frontend/src/app/pages/AgentChat/ChatInput/hooks/draftStore.ts index 9186b787..15dbe594 100644 --- a/frontend/src/app/pages/AgentChat/ChatInput/hooks/draftStore.ts +++ b/frontend/src/app/pages/AgentChat/ChatInput/hooks/draftStore.ts @@ -29,7 +29,16 @@ export function useDraftLoad(editorRef: RefObject, ownerId: stri useEffect(() => { const saved = _draftStore.get(ownerId); const editor = editorRef.current; - if (saved && editor && !editor.textContent?.trim()) { + if (!saved || !editor) return; + // Textarea path (Windows ablation): drafts were saved as plain text in .value, so just restore as text. The div path below is for contentEditable on Mac where drafts are HTML with skill pills. + if (editor.tagName === 'TEXTAREA') { + const ta = editor as unknown as HTMLTextAreaElement; + if (ta.value.trim()) return; + ta.value = saved; + try { ta.selectionStart = ta.selectionEnd = ta.value.length; } catch (_) {} + return; + } + if (!editor.textContent?.trim()) { editor.innerHTML = saved; const range = document.createRange(); range.selectNodeContents(editor); diff --git a/frontend/src/app/pages/AgentChat/ChatInput/toolbar/ToolbarActions.tsx b/frontend/src/app/pages/AgentChat/ChatInput/toolbar/ToolbarActions.tsx index 3c7c3899..5fb8fc8e 100644 --- a/frontend/src/app/pages/AgentChat/ChatInput/toolbar/ToolbarActions.tsx +++ b/frontend/src/app/pages/AgentChat/ChatInput/toolbar/ToolbarActions.tsx @@ -3,8 +3,9 @@ import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; -// Windows-only ablation: mounting a hidden on Windows initializes the IFileDialog COM shim which is implicated in the Chromium 144 + Electron 40 commit-phase segfault. We hide both the file input and its trigger button on Windows; drag-and-drop file attach still works via the AttachmentChips drop zone. Mac unchanged. +// File input was ablated in v1.1.54 as a suspected crasher, but the actual crasher turned out to be contentEditable's TSF init (now replaced with textarea in EditorSurface). Restored on both platforms in v1.1.57. Keeping IS_WIN reference removal would require touching call sites; harmless left here as a constant. const IS_WIN = typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows'); +void IS_WIN; import MicNoneOutlinedIcon from '@mui/icons-material/MicNoneOutlined'; import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'; import StopIcon from '@mui/icons-material/Stop'; @@ -92,7 +93,7 @@ export const ToolbarActions: React.FC = ({ })()} {/* Windows-only ablation: hidden + attach button skipped on Windows to test whether IFileDialog COM init is the trigger for the Chromium 144 commit-phase segfault. Mac still renders both (drag/paste/click attach all work). On Windows, drag-and-drop attach still works via AttachmentChips drop zone. */} - {!IS_WIN && ( + {true && ( = ({ }} /> )} - {!IS_WIN && ( + {true && (