mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-06-02 02:40:24 +09:00
use config to drive autoscroll state
This commit is contained in:
parent
e186e05c7d
commit
434abbc66f
@ -379,12 +379,13 @@ function useScrollToBottom() {
|
|||||||
// for auto-scroll
|
// for auto-scroll
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
const [autoScroll, setAutoScroll] = useState(true);
|
const [autoScroll, setAutoScroll] = useState(true);
|
||||||
|
const config = useAppConfig();
|
||||||
|
let isAutoScrollEnabled: boolean = config.autoScrollMessage;
|
||||||
function scrollDomToBottom() {
|
function scrollDomToBottom() {
|
||||||
const dom = scrollRef.current;
|
const dom = scrollRef.current;
|
||||||
if (dom) {
|
if (dom) {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
setAutoScroll(true);
|
setAutoScroll(isAutoScrollEnabled);
|
||||||
dom.scrollTo(0, dom.scrollHeight);
|
dom.scrollTo(0, dom.scrollHeight);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user