refactor(person-mention): move autoresize into PersonMentionEditor

Felix #5: TranscriptionBlock had a `\$effect(() => { void localText; ... })`
hack to re-trigger autoresize on text change, plus a captureTextarea
callback that the parent only used to size a node it didn't own.

The editor owns the textarea — it should also size it. Move the
autoresize \$effect into PersonMentionEditor so the parent only
captures the node when it genuinely needs to read selection bounds
(quote selection still works).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-29 01:08:12 +02:00
parent fd3a44d10c
commit 49db82e1bd
2 changed files with 14 additions and 13 deletions

View File

@@ -85,24 +85,11 @@ let textareaEl: HTMLTextAreaElement | null = null;
function captureTextarea(node: HTMLTextAreaElement) {
textareaEl = node;
resizeTextarea();
return () => {
textareaEl = null;
};
}
function resizeTextarea() {
if (!textareaEl) return;
textareaEl.style.height = 'auto';
textareaEl.style.height = `${textareaEl.scrollHeight}px`;
}
$effect(() => {
// Re-run autoresize whenever the bound text changes.
void localText;
resizeTextarea();
});
function emitChange() {
onTextChange(localText, localMentions);
}