From caf6afc4e333c696a71bdc05aa794e0c10f693d4 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Thu, 24 Oct 2024 14:07:02 +0700 Subject: [PATCH] fix: placeholder no hardware detect --- .../ThreadCenterPanel/ChatInput/RichTextEditor.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx index 8f296368f4..6e6beda072 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx @@ -301,6 +301,11 @@ const RichTextEditor = ({ textareaRef.current.style.overflow = textareaRef.current.clientHeight >= 390 ? 'auto' : 'hidden' } + + if (currentPrompt.length === 0) { + resetEditor() + } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [textareaRef.current?.clientHeight, currentPrompt, activeSettingInputBox]) const onStopInferenceClick = async () => { @@ -317,13 +322,15 @@ const RichTextEditor = ({ // Adjust the height of the textarea to its initial state if (textareaRef.current) { - textareaRef.current.style.height = '40px' // Reset to the initial height or your desired height + textareaRef.current.style.height = activeSettingInputBox + ? '100px' + : '44px' textareaRef.current.style.overflow = 'hidden' // Reset overflow style } // Ensure the editor re-renders decorations editor.onChange() - }, [editor]) + }, [activeSettingInputBox, editor]) const handleKeyDown = useCallback( (event: React.KeyboardEvent) => {