BorderlessTextarea: Auto height on value changes

Update the height on value changes instead of only on input events.
That way, if the value is externally updated then the height will update as well
This commit is contained in:
estib 2024-10-21 11:34:55 +02:00
parent 5811a5741a
commit 41b9ed4ad7

View File

@ -51,6 +51,15 @@
}
}, 0);
});
$effect(() => {
if (ref) {
// reference the value to trigger
// the effect when it changes
value;
autoHeight(ref);
}
});
</script>
<textarea
@ -65,7 +74,6 @@
{placeholder}
{readonly}
oninput={(e) => {
autoHeight(e.currentTarget);
oninput?.(e);
}}
onfocus={(e) => {