change textarea auto height method

This commit is contained in:
2024-01-12 17:17:48 +08:00
parent 18a7c7b5d7
commit 4f3f6bd544
2 changed files with 13 additions and 2 deletions

View File

@@ -80,6 +80,12 @@ const LongInput = (props: {
onChange={(event: any) => {
props.chatStore[props.field] = event.target.value;
props.setChatStore({ ...props.chatStore });
event.target.style.height = "auto";
event.target.style.height = `${event.target.scrollHeight + 1}px`;
}}
onKeyPress={(event: any) => {
event.target.style.height = "auto";
event.target.style.height = `${event.target.scrollHeight + 1}px`;
}}
></textarea>
</Help>