changeset 124:05489f6e9d6f default tip

faster fixTextarea
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 29 Jan 2026 09:07:08 -0700
parents 50f611bbfa19
children
files src/chat.js
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/chat.js	Wed Dec 10 20:34:30 2025 -0700
+++ b/src/chat.js	Thu Jan 29 09:07:08 2026 -0700
@@ -47,9 +47,13 @@
 	document.querySelector('div[input]').scrollIntoView({block: 'end'});
 }
 
+let textareaInitialHeight;
+
 function fixTextarea(event) {
 	let textarea = event.target;
-	textarea.style.height = 'initial';
+	if( !textareaInitialHeight )
+		textareaInitialHeight = getComputedStyle(textarea).height;
+	textarea.style.height = textareaInitialHeight;
 	textarea.style.height = (textarea.scrollHeight+2) + 'px';
 	textarea.scrollIntoViewIfNeeded(false);
 }