diff --git a/qwen3-tts-frontend/src/components/ui/textarea.tsx b/qwen3-tts-frontend/src/components/ui/textarea.tsx index a3cef2d..a62c2d8 100644 --- a/qwen3-tts-frontend/src/components/ui/textarea.tsx +++ b/qwen3-tts-frontend/src/components/ui/textarea.tsx @@ -12,7 +12,12 @@ const Textarea = React.forwardRef< const adjustHeight = React.useCallback((element: HTMLTextAreaElement) => { element.style.height = 'auto' - element.style.height = `${element.scrollHeight}px` + const maxHeight = window.innerWidth >= 768 + ? Math.min(400, window.innerHeight * 0.5) + : window.innerHeight * 0.6 + const newHeight = Math.min(element.scrollHeight, maxHeight) + element.style.height = `${newHeight}px` + element.style.overflowY = element.scrollHeight > maxHeight ? 'auto' : 'hidden' }, []) React.useLayoutEffect(() => { @@ -41,7 +46,7 @@ const Textarea = React.forwardRef< return (