mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Slightly more robust autoscroll
This commit is contained in:
parent
ca226a54c6
commit
74d98186fc
|
|
@ -187,8 +187,11 @@ const observer = new MutationObserver(function(mutations) {
|
||||||
|
|
||||||
doSyntaxHighlighting();
|
doSyntaxHighlighting();
|
||||||
|
|
||||||
if (!window.isScrolled && !isScrollingClassOnly && targetElement.scrollTop !== targetElement.scrollHeight) {
|
if (!window.isScrolled && !isScrollingClassOnly) {
|
||||||
targetElement.scrollTop = targetElement.scrollHeight;
|
const maxScroll = targetElement.scrollHeight - targetElement.clientHeight;
|
||||||
|
if (maxScroll > 0 && targetElement.scrollTop < maxScroll - 1) {
|
||||||
|
targetElement.scrollTop = maxScroll;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const chatElement = document.getElementById("chat");
|
const chatElement = document.getElementById("chat");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue