Skip to content

Commit 9db969b

Browse files
authored
fix(files): changed file input value sample from string -> object (#1947)
1 parent 2fbe0de commit 9db969b

File tree

2 files changed

+45
-0
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/starter
    • components/emcn/components/code

2 files changed

+45
-0
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/starter/input-format.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,47 @@ export function FieldFormat({
310310
)
311311
}
312312

313+
if (field.type === 'files') {
314+
const lineCount = fieldValue.split('\n').length
315+
const gutterWidth = calculateGutterWidth(lineCount)
316+
317+
const renderLineNumbers = () => {
318+
return Array.from({ length: lineCount }, (_, i) => (
319+
<div
320+
key={i}
321+
className='font-medium font-mono text-[var(--text-muted)] text-xs'
322+
style={{ height: `${21}px`, lineHeight: `${21}px` }}
323+
>
324+
{i + 1}
325+
</div>
326+
))
327+
}
328+
329+
return (
330+
<Code.Container className='min-h-[120px]'>
331+
<Code.Gutter width={gutterWidth}>{renderLineNumbers()}</Code.Gutter>
332+
<Code.Content paddingLeft={`${gutterWidth}px`}>
333+
<Code.Placeholder gutterWidth={gutterWidth} show={fieldValue.length === 0}>
334+
{
335+
'[\n {\n "data": "data:application/pdf;base64,...",\n "type": "file",\n "name": "document.pdf",\n "mime": "application/pdf"\n }\n]'
336+
}
337+
</Code.Placeholder>
338+
<Editor
339+
value={fieldValue}
340+
onValueChange={(newValue) => {
341+
if (!isReadOnly) {
342+
updateField(field.id, 'value', newValue)
343+
}
344+
}}
345+
highlight={(code) => highlight(code, languages.json, 'json')}
346+
disabled={isReadOnly}
347+
{...getCodeEditorProps({ disabled: isReadOnly })}
348+
/>
349+
</Code.Content>
350+
</Code.Container>
351+
)
352+
}
353+
313354
return (
314355
<>
315356
<Input

apps/sim/components/emcn/components/code/code.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ function Container({
8080
'group relative min-h-[100px] rounded-[4px] border border-[var(--border-strong)]',
8181
'bg-[#1F1F1F] font-medium font-mono text-sm transition-colors',
8282
'dark:border-[var(--border-strong)]',
83+
// Overflow handling for long content
84+
'overflow-x-auto',
85+
// Vertical resize handle
86+
'resize-y overflow-y-auto',
8387
// Streaming state
8488
isStreaming && 'streaming-effect',
8589
className

0 commit comments

Comments
 (0)