mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-10 03:37:44 +02:00
[eric] windows 1.1.57: four fixes — (a) textarea Enter-to-send now actually clears the input (missed editor.innerHTML='' at ChatInput.tsx:181 in the post-send path); (b) textarea draft restore (useDraftLoad) routes through .value instead of innerHTML on Windows so a saved draft repopulates the input on remount; (c) restore the <input type="file"> + attach button on Windows since the original 1.1.54 crash root cause was the contentEditable TSF init not the file input — replacing contentEditable with textarea was the actual fix, file input was over-ablated; (d) relax CSP frame-src to allow http:/https: so BrowserCard iframe can render external sites; (e) gate AgenticCursor's portaled Framer Motion infinite-loop animation on Windows so onboarding panel commit no longer 0xC0000005 segfaults; Mac path untouched
This commit is contained in:
@@ -178,7 +178,7 @@ const ChatInput = forwardRef<ChatInputHandle, Props>(({ 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:')) {
|
||||
|
||||
@@ -29,7 +29,16 @@ export function useDraftLoad(editorRef: RefObject<HTMLDivElement>, 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);
|
||||
|
||||
@@ -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 <input type="file"> 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<Props> = ({
|
||||
})()}
|
||||
|
||||
{/* Windows-only ablation: hidden <input type="file"> + 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 && (
|
||||
<input
|
||||
ref={generalFileInputRef}
|
||||
type="file"
|
||||
@@ -109,7 +110,7 @@ export const ToolbarActions: React.FC<Props> = ({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!IS_WIN && (
|
||||
{true && (
|
||||
<Tooltip title="Attach file">
|
||||
<IconButton
|
||||
size="small"
|
||||
|
||||
Reference in New Issue
Block a user