fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,24 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { browser } from '$app/environment'
|
||||
import { tick } from 'svelte'
|
||||
import type { HTMLTextareaAttributes } from 'svelte/elements'
|
||||
|
||||
let textarea: HTMLTextAreaElement | undefined = $state()
|
||||
|
||||
async function adjustHeight(value: string) {
|
||||
async function adjustHeight() {
|
||||
await tick()
|
||||
if (textarea) {
|
||||
textarea.style.height = 'auto' // Reset height to auto to calculate new height
|
||||
textarea.style.height = `${textarea.scrollHeight}px` // Set height to the scrollHeight
|
||||
}
|
||||
}
|
||||
interface Props {
|
||||
interface Props extends HTMLTextareaAttributes {
|
||||
label?: string | undefined
|
||||
value: string
|
||||
required?: boolean
|
||||
class?: string
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -29,8 +26,8 @@
|
||||
...rest
|
||||
}: Props = $props()
|
||||
|
||||
run(() => {
|
||||
adjustHeight(value)
|
||||
$effect(() => {
|
||||
if (value) adjustHeight()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -45,7 +42,7 @@
|
||||
{/if}
|
||||
<textarea
|
||||
bind:this={textarea}
|
||||
oninput={() => adjustHeight(value)}
|
||||
oninput={() => adjustHeight()}
|
||||
bind:value
|
||||
{required}
|
||||
{...rest}
|
||||
|
||||
Reference in new issue
Block a user