Add option to toggle scrolling to bottom when switching between branches

This commit is contained in:
Zhuoran
2024-08-04 09:56:04 +08:00
parent a75a9c953a
commit 948d29b676
2 changed files with 43 additions and 10 deletions

View File

@@ -146,12 +146,14 @@
await tick();
const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
if ($settings.scrollOnBranchChange) {
const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
setTimeout(() => {
scrollToBottom();
}, 100);
setTimeout(() => {
scrollToBottom();
}, 100);
}
};
const showNextMessage = async (message) => {
@@ -195,12 +197,14 @@
await tick();
const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
if ($settings.scrollOnBranchChange) {
const element = document.getElementById('messages-container');
autoScroll = element.scrollHeight - element.scrollTop <= element.clientHeight + 50;
setTimeout(() => {
scrollToBottom();
}, 100);
setTimeout(() => {
scrollToBottom();
}, 100);
}
};
const deleteMessageHandler = async (messageId) => {