Auto-resize input field after a message was sent
This commit is contained in:
parent
cbdccf3b92
commit
bfb8b6baf2
1 changed files with 11 additions and 8 deletions
|
@ -111,6 +111,13 @@
|
|||
messageHistoryContainer.scrollTo(0, messageHistoryContainer.scrollHeight);
|
||||
}
|
||||
|
||||
function resizeInputElement() {
|
||||
// Calculate Line height
|
||||
textInputElement.style.removeProperty("height");
|
||||
let newHeight = textInputElement.scrollHeight;
|
||||
textInputElement.style.height = newHeight.toString() + "px";
|
||||
}
|
||||
|
||||
function disableInput() {
|
||||
settingsMaxTokensElement.disabled = true;
|
||||
settingsTemperatureElement.disabled = true;
|
||||
|
@ -145,6 +152,7 @@
|
|||
}
|
||||
else {
|
||||
textInputElement.value = "";
|
||||
resizeInputElement();
|
||||
addMessage(input, MessageType.USER);
|
||||
let prompt = conversation.join("");
|
||||
let settings = getSettings();
|
||||
|
@ -174,11 +182,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
textInputElement.addEventListener("input", e => {
|
||||
// Calculate Line height
|
||||
textInputElement.style.removeProperty("height");
|
||||
let newHeight = textInputElement.scrollHeight;
|
||||
textInputElement.style.height = newHeight.toString() + "px";
|
||||
});
|
||||
textInputElement.addEventListener("input", resizeInputElement);
|
||||
|
||||
})();
|
Reference in a new issue