fix: placeholder no hardware detect (#3876)

This commit is contained in:
Faisal Amir 2024-10-24 14:26:17 +07:00 committed by GitHub
parent 037357e04c
commit c47d049920
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) => {