Instruct style improvements (#4951)

This commit is contained in:
oobabooga 2023-12-16 22:16:26 -03:00 committed by GitHub
parent 41424907b1
commit 7a84d7b2da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 19 deletions

View file

@ -123,6 +123,8 @@ targetElement.addEventListener("scroll", function() {
// Create a MutationObserver instance
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
updateChatHeight();
if(!isScrolled) {
targetElement.scrollTop = targetElement.scrollHeight;
}
@ -373,3 +375,15 @@ function toggleBigPicture() {
}
}
//------------------------------------------------
// Define the --chat-height global CSS variable to
// the height of the chat parent
//------------------------------------------------
function updateChatHeight() {
const chatContainer = document.getElementById('chat').parentNode.parentNode.parentNode;
const newChatHeight = `${chatContainer.clientHeight}px`;
document.documentElement.style.setProperty('--chat-height', newChatHeight);
}
window.addEventListener('resize', updateChatHeight);