forked from XiaoMo/ChatGPT-Next-Web
optimize: scrolling experience
This commit is contained in:
parent
73f4ea38c6
commit
a6890c0f58
@ -377,7 +377,8 @@ export function Chat(props: {
|
|||||||
chatStore.onUserInput(userInput).then(() => setIsLoading(false));
|
chatStore.onUserInput(userInput).then(() => setIsLoading(false));
|
||||||
setUserInput("");
|
setUserInput("");
|
||||||
setPromptHints([]);
|
setPromptHints([]);
|
||||||
inputRef.current?.focus();
|
if (!isMobileScreen()) inputRef.current?.focus();
|
||||||
|
setAutoScroll(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// stop response
|
// stop response
|
||||||
@ -533,8 +534,11 @@ export function Chat(props: {
|
|||||||
className={styles["chat-body"]}
|
className={styles["chat-body"]}
|
||||||
ref={scrollRef}
|
ref={scrollRef}
|
||||||
onScroll={(e) => onChatBodyScroll(e.currentTarget)}
|
onScroll={(e) => onChatBodyScroll(e.currentTarget)}
|
||||||
onMouseOver={() => inputRef.current?.blur()}
|
onWheel={() => setAutoScroll(false)}
|
||||||
onTouchStart={() => inputRef.current?.blur()}
|
onTouchStart={() => {
|
||||||
|
inputRef.current?.blur();
|
||||||
|
setAutoScroll(false);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{messages.map((message, i) => {
|
{messages.map((message, i) => {
|
||||||
const isUser = message.role === "user";
|
const isUser = message.role === "user";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user