mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-08 02:37:45 +02:00
[eric] fix: complete the windows ablation by rendering textarea in editorsurface and skipping the onboarding video element entirely
This commit is contained in:
@@ -443,12 +443,11 @@ const StepCardBody: React.FC<StepCardProps> = ({
|
||||
: undefined,
|
||||
}}
|
||||
>
|
||||
{step.videoSrc ? (
|
||||
{step.videoSrc && !(typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows')) ? (
|
||||
<Box
|
||||
component="video"
|
||||
src={step.videoSrc}
|
||||
autoPlay={typeof navigator === 'undefined' || !navigator.userAgent.includes('Windows')}
|
||||
preload={typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows') ? 'none' : 'metadata'}
|
||||
autoPlay
|
||||
muted
|
||||
loop
|
||||
playsInline
|
||||
|
||||
@@ -18,6 +18,9 @@ interface Props {
|
||||
onPaste: (e: React.ClipboardEvent) => void;
|
||||
}
|
||||
|
||||
// Windows-Electron: <div contentEditable> mounts hit a Chromium 144 TSF native crash on commit; the textarea ablation the handlers/draft already route for has to land here too or the renderer segfaults.
|
||||
const IS_WIN_ELECTRON = typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows') && navigator.userAgent.includes('Electron');
|
||||
|
||||
export const EditorSurface: React.FC<Props> = ({
|
||||
c, editorRef, disabled, hasContent, hasAttachments, autoRunMode, isRunning, queueLength,
|
||||
placeholderLabel, onInput, onClick, onKeyDown, onPaste,
|
||||
@@ -32,32 +35,62 @@ export const EditorSurface: React.FC<Props> = ({
|
||||
|
||||
return (
|
||||
<Box sx={{ px: 1.5, pt: hasAttachments ? 0.5 : 1.25, pb: 0.25, position: 'relative' }}>
|
||||
<div
|
||||
ref={editorRef}
|
||||
data-onboarding="chat-input"
|
||||
contentEditable={!disabled}
|
||||
suppressContentEditableWarning
|
||||
spellCheck={false}
|
||||
onInput={onInput}
|
||||
onClick={onClick}
|
||||
onKeyDown={onKeyDown}
|
||||
onPaste={onPaste}
|
||||
style={{
|
||||
width: '100%',
|
||||
minHeight: '1.5em',
|
||||
maxHeight: 220,
|
||||
overflowY: 'auto',
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
outline: 'none',
|
||||
color: c.text.primary,
|
||||
fontSize: '0.95rem',
|
||||
lineHeight: '1.55',
|
||||
fontFamily: 'inherit',
|
||||
wordBreak: 'break-word',
|
||||
whiteSpace: 'pre-wrap',
|
||||
}}
|
||||
/>
|
||||
{IS_WIN_ELECTRON ? (
|
||||
<textarea
|
||||
ref={editorRef as unknown as RefObject<HTMLTextAreaElement>}
|
||||
data-onboarding="chat-input"
|
||||
disabled={disabled}
|
||||
spellCheck={false}
|
||||
onInput={onInput}
|
||||
onClick={onClick}
|
||||
onKeyDown={onKeyDown as unknown as React.KeyboardEventHandler<HTMLTextAreaElement>}
|
||||
onPaste={onPaste as unknown as React.ClipboardEventHandler<HTMLTextAreaElement>}
|
||||
rows={1}
|
||||
style={{
|
||||
width: '100%',
|
||||
minHeight: '1.5em',
|
||||
maxHeight: 220,
|
||||
overflowY: 'auto',
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
outline: 'none',
|
||||
color: c.text.primary,
|
||||
fontSize: '0.95rem',
|
||||
lineHeight: '1.55',
|
||||
fontFamily: 'inherit',
|
||||
wordBreak: 'break-word',
|
||||
whiteSpace: 'pre-wrap',
|
||||
resize: 'none',
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
ref={editorRef}
|
||||
data-onboarding="chat-input"
|
||||
contentEditable={!disabled}
|
||||
suppressContentEditableWarning
|
||||
spellCheck={false}
|
||||
onInput={onInput}
|
||||
onClick={onClick}
|
||||
onKeyDown={onKeyDown}
|
||||
onPaste={onPaste}
|
||||
style={{
|
||||
width: '100%',
|
||||
minHeight: '1.5em',
|
||||
maxHeight: 220,
|
||||
overflowY: 'auto',
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
outline: 'none',
|
||||
color: c.text.primary,
|
||||
fontSize: '0.95rem',
|
||||
lineHeight: '1.55',
|
||||
fontFamily: 'inherit',
|
||||
wordBreak: 'break-word',
|
||||
whiteSpace: 'pre-wrap',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!hasContent && (
|
||||
<div
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user