refac
This commit is contained in:
1 parent
2d83c7438c
commit
21e180182a
1 file changed
+19
-1
@@ -22,6 +22,23 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const autosize = (node: HTMLTextAreaElement) => {
|
||||||
|
const resize = () => {
|
||||||
|
node.style.height = 'auto';
|
||||||
|
node.style.height = `${node.scrollHeight}px`;
|
||||||
|
};
|
||||||
|
|
||||||
|
resize();
|
||||||
|
node.addEventListener('input', resize);
|
||||||
|
|
||||||
|
return {
|
||||||
|
update: resize,
|
||||||
|
destroy() {
|
||||||
|
node.removeEventListener('input', resize);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
$: if (promptSuggestions) {
|
$: if (promptSuggestions) {
|
||||||
setPromptSuggestions();
|
setPromptSuggestions();
|
||||||
}
|
}
|
||||||
@@ -155,10 +172,11 @@
|
|||||||
placement="top-start"
|
placement="top-start"
|
||||||
>
|
>
|
||||||
<textarea
|
<textarea
|
||||||
class="min-h-5 w-full resize-none bg-transparent text-[13px] leading-5 text-gray-700 outline-hidden placeholder:text-gray-300 dark:text-gray-200 dark:placeholder:text-gray-700"
|
class="min-h-5 w-full resize-none overflow-hidden bg-transparent text-[13px] leading-5 text-gray-700 outline-hidden placeholder:text-gray-300 dark:text-gray-200 dark:placeholder:text-gray-700"
|
||||||
placeholder={$i18n.t('Content')}
|
placeholder={$i18n.t('Content')}
|
||||||
aria-label={$i18n.t('Content')}
|
aria-label={$i18n.t('Content')}
|
||||||
rows="1"
|
rows="1"
|
||||||
|
use:autosize={prompt.content}
|
||||||
bind:value={prompt.content}
|
bind:value={prompt.content}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
Reference in new issue
Block a user