mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-01-19 15:10:35 +01:00
Fix autoscroll after fonts load
This commit is contained in:
parent
92ec8dda03
commit
c4d5331c03
14
js/main.js
14
js/main.js
|
|
@ -1086,3 +1086,17 @@ chatInput.addEventListener("input", () => {
|
|||
|
||||
// Update wasAtBottom when user scrolls
|
||||
targetElement.addEventListener("scroll", checkIfAtBottom);
|
||||
|
||||
//------------------------------------------------
|
||||
// Fix autoscroll after fonts load
|
||||
//------------------------------------------------
|
||||
document.fonts.addEventListener("loadingdone", (event) => {
|
||||
setTimeout(() => {
|
||||
if (!window.isScrolled) {
|
||||
const maxScroll = targetElement.scrollHeight - targetElement.clientHeight;
|
||||
if (targetElement.scrollTop < maxScroll - 5) {
|
||||
targetElement.scrollTop = maxScroll;
|
||||
}
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue