| 9732 | * @param {HTMLTextAreaElement} e Textarea element to auto-fit | 9732 | * @param {HTMLTextAreaElement} e Textarea element to auto-fit |
| 9733 | */ | 9733 | */ |
| 9734 | function autoFitEditTextArea(e) { | 9734 | function autoFitEditTextArea(e) { |
| | 9735 | const scrollTop = chatElement.scrollTop(); |
| 9735 | e.style.height = '0px'; | 9736 | e.style.height = '0px'; |
| 9736 | const newHeight = e.scrollHeight + 4; | 9737 | const newHeight = e.scrollHeight + 4; |
| 9737 | e.style.height = `${newHeight}px`; | 9738 | e.style.height = `${newHeight}px`; |
| | 9739 | chatElement.scrollTop(scrollTop); |
| 9738 | } | 9740 | } |
| 9739 | const autoFitEditTextAreaDebounced = debounce(autoFitEditTextArea, debounce_timeout.short); | 9741 | const autoFitEditTextAreaDebounced = debounce(autoFitEditTextArea, debounce_timeout.short); |
| 9740 | document.addEventListener('input', e => { | 9742 | document.addEventListener('input', e => { |