From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/base/chat/chat/chat-input-area/hooks.ts | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/components/base/chat/chat/chat-input-area/hooks.ts b/app/components/base/chat/chat/chat-input-area/hooks.ts index 6b6e801..5f54012 100644 --- a/app/components/base/chat/chat/chat-input-area/hooks.ts +++ b/app/components/base/chat/chat/chat-input-area/hooks.ts @@ -3,22 +3,23 @@ useRef, useState, } from 'react' +import type { TextAreaRef } from 'rc-textarea' export const useTextAreaHeight = () => { const wrapperRef = useRef<HTMLDivElement>(null) - const textareaRef = useRef<HTMLTextAreaElement | undefined>(undefined) + const textareaRef = useRef<TextAreaRef>(null) const textValueRef = useRef<HTMLDivElement>(null) const holdSpaceRef = useRef<HTMLDivElement>(null) const [isMultipleLine, setIsMultipleLine] = useState(false) const handleComputeHeight = useCallback(() => { - const textareaElement = textareaRef.current - + const textareaElement = textareaRef.current?.resizableTextArea.textArea if (wrapperRef.current && textareaElement && textValueRef.current && holdSpaceRef.current) { const { width: wrapperWidth } = wrapperRef.current.getBoundingClientRect() const { height: textareaHeight } = textareaElement.getBoundingClientRect() const { width: textValueWidth } = textValueRef.current.getBoundingClientRect() const { width: holdSpaceWidth } = holdSpaceRef.current.getBoundingClientRect() + if (textareaHeight > 32) { setIsMultipleLine(true) } -- Gitblit v1.8.0