File tree 1 file changed +16
-3
lines changed
site/src/modules/workspaces/DynamicParameter
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -239,18 +239,30 @@ const DebouncedParameterField: FC<DebouncedParameterFieldProps> = ({
239
239
240
240
prevDebouncedValueRef . current = debouncedLocalValue ;
241
241
} , [ debouncedLocalValue , onChangeEvent ] ) ;
242
+ const textareaRef = useRef < HTMLTextAreaElement > ( null ) ;
243
+
244
+ const resizeTextarea = useEffectEvent ( ( ) => {
245
+ if ( textareaRef . current ) {
246
+ const textarea = textareaRef . current ;
247
+ textarea . style . height = `${ textarea . scrollHeight } px` ;
248
+ }
249
+ } ) ;
250
+
251
+ useEffect ( ( ) => {
252
+ resizeTextarea ( ) ;
253
+ } , [ resizeTextarea ] ) ;
242
254
243
255
switch ( parameter . form_type ) {
244
- case "textarea" :
256
+ case "textarea" : {
245
257
return (
246
258
< Textarea
259
+ ref = { textareaRef }
247
260
id = { id }
248
- className = "max-w-2xl "
261
+ className = "overflow-y-auto max-h-[500px] "
249
262
value = { localValue }
250
263
onChange = { ( e ) => {
251
264
const target = e . currentTarget ;
252
265
target . style . height = "auto" ;
253
- target . style . maxHeight = "700px" ;
254
266
target . style . height = `${ target . scrollHeight } px` ;
255
267
256
268
setLocalValue ( e . target . value ) ;
@@ -260,6 +272,7 @@ const DebouncedParameterField: FC<DebouncedParameterFieldProps> = ({
260
272
required = { parameter . required }
261
273
/>
262
274
) ;
275
+ }
263
276
264
277
case "input" : {
265
278
const inputType = parameter . type === "number" ? "number" : "text" ;
You can’t perform that action at this time.
0 commit comments