Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a6d5f5

Browse files
authored
fix: update textarea to fit content height and set a max height (#17946)
1 parent36d938f commit3a6d5f5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

‎site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,30 @@ const DebouncedParameterField: FC<DebouncedParameterFieldProps> = ({
239239

240240
prevDebouncedValueRef.current=debouncedLocalValue;
241241
},[debouncedLocalValue,onChangeEvent]);
242+
consttextareaRef=useRef<HTMLTextAreaElement>(null);
243+
244+
constresizeTextarea=useEffectEvent(()=>{
245+
if(textareaRef.current){
246+
consttextarea=textareaRef.current;
247+
textarea.style.height=`${textarea.scrollHeight}px`;
248+
}
249+
});
250+
251+
useEffect(()=>{
252+
resizeTextarea();
253+
},[resizeTextarea]);
242254

243255
switch(parameter.form_type){
244-
case"textarea":
256+
case"textarea":{
245257
return(
246258
<Textarea
259+
ref={textareaRef}
247260
id={id}
248-
className="max-w-2xl"
261+
className="overflow-y-automax-h-[500px]"
249262
value={localValue}
250263
onChange={(e)=>{
251264
consttarget=e.currentTarget;
252265
target.style.height="auto";
253-
target.style.maxHeight="700px";
254266
target.style.height=`${target.scrollHeight}px`;
255267

256268
setLocalValue(e.target.value);
@@ -260,6 +272,7 @@ const DebouncedParameterField: FC<DebouncedParameterFieldProps> = ({
260272
required={parameter.required}
261273
/>
262274
);
275+
}
263276

264277
case"input":{
265278
constinputType=parameter.type==="number" ?"number" :"text";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp