mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
CSS: don't change --chat-height when outside the chat tab
This commit is contained in:
parent
c419206ce1
commit
a4079e879e
24
js/main.js
24
js/main.js
@ -339,19 +339,21 @@ function updateCssProperties() {
|
|||||||
// Set the height of the chat area
|
// Set the height of the chat area
|
||||||
const chatContainer = document.getElementById("chat").parentNode.parentNode.parentNode;
|
const chatContainer = document.getElementById("chat").parentNode.parentNode.parentNode;
|
||||||
const chatInputHeight = document.querySelector("#chat-input textarea").clientHeight;
|
const chatInputHeight = document.querySelector("#chat-input textarea").clientHeight;
|
||||||
const newChatHeight = `${chatContainer.clientHeight - chatInputHeight + 40}px`;
|
if (chatContainer.clientHeight > 0) {
|
||||||
document.documentElement.style.setProperty("--chat-height", newChatHeight);
|
const newChatHeight = `${chatContainer.clientHeight - chatInputHeight + 40}px`;
|
||||||
document.documentElement.style.setProperty("--input-delta", `${chatInputHeight - 40}px`);
|
document.documentElement.style.setProperty("--chat-height", newChatHeight);
|
||||||
|
document.documentElement.style.setProperty("--input-delta", `${chatInputHeight - 40}px`);
|
||||||
|
|
||||||
// Set the position offset of the chat input box
|
// Set the position offset of the chat input box
|
||||||
const header = document.querySelector(".header_bar");
|
const header = document.querySelector(".header_bar");
|
||||||
const headerHeight = `${header.clientHeight}px`;
|
const headerHeight = `${header.clientHeight}px`;
|
||||||
document.documentElement.style.setProperty("--header-height", headerHeight);
|
document.documentElement.style.setProperty("--header-height", headerHeight);
|
||||||
|
|
||||||
// Offset the scroll position of the chat area
|
// Offset the scroll position of the chat area
|
||||||
if (chatInputHeight !== currentChatInputHeight) {
|
if (chatInputHeight !== currentChatInputHeight) {
|
||||||
chatContainer.scrollTop += chatInputHeight > currentChatInputHeight ? chatInputHeight : -chatInputHeight;
|
chatContainer.scrollTop += chatInputHeight > currentChatInputHeight ? chatInputHeight : -chatInputHeight;
|
||||||
currentChatInputHeight = chatInputHeight;
|
currentChatInputHeight = chatInputHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user