Don't overextend edit textarea height

This commit is contained in:
Cohee 2024-07-11 21:25:52 +03:00
parent 4895b6def8
commit e22b18ce80

View File

@ -9232,9 +9232,12 @@ jQuery(async function () {
* @param {HTMLTextAreaElement} e Textarea element to auto-fit
*/
function autoFitEditTextArea(e) {
const computedStyle = window.getComputedStyle(e);
const maxHeight = parseInt(computedStyle.maxHeight, 10);
const newHeight = e.scrollHeight + 4;
scroll_holder = chatElement[0].scrollTop;
e.style.height = '0';
e.style.height = `${e.scrollHeight + 4}px`;
e.style.height = computedStyle.minHeight;
e.style.height = (newHeight < maxHeight) ? `${newHeight}px` : `${maxHeight}px`;
is_use_scroll_holder = true;
}
const autoFitEditTextAreaDebounced = debouncedThrottle(autoFitEditTextArea, debounce_timeout.short);