Merge pull request #163 from GOWxx/bugfix_send_button_cover_text

fix: send button covering the text in the textarea
This commit is contained in:
Yifei Zhang 2023-03-29 22:11:34 +08:00 committed by GitHub
commit f1b2f895b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -410,7 +410,7 @@
background-color: var(--white); background-color: var(--white);
color: var(--black); color: var(--black);
font-family: inherit; font-family: inherit;
padding: 10px 14px; padding: 10px 14px 50px;
resize: none; resize: none;
outline: none; outline: none;
} }

View File

@ -206,6 +206,11 @@ export function Chat(props: { showSideBar?: () => void, sideBarShowing?: boolean
// only search prompts when user input is short // only search prompts when user input is short
const SEARCH_TEXT_LIMIT = 30; const SEARCH_TEXT_LIMIT = 30;
const onInput = (text: string) => { const onInput = (text: string) => {
const textareaDom = inputRef.current
if (textareaDom) {
const paddingBottomNum: number = parseInt(window.getComputedStyle(textareaDom).paddingBottom, 10);
textareaDom.scrollTop = textareaDom.scrollHeight - textareaDom.offsetHeight + paddingBottomNum;
}
setUserInput(text); setUserInput(text);
const n = text.trim().length; const n = text.trim().length;
if (n === 0 || n > SEARCH_TEXT_LIMIT) { if (n === 0 || n > SEARCH_TEXT_LIMIT) {