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,18 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import { ImageInput, toast } from 'mono-svelte'
|
||||
import { Button, Label, Modal, TextArea } from 'mono-svelte'
|
||||
import { createEventDispatcher, tick } from 'svelte'
|
||||
import { Button, Label, TextArea } from 'mono-svelte'
|
||||
import type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
|
||||
import { tick } from 'svelte'
|
||||
import {
|
||||
Bold,
|
||||
CodeBracket,
|
||||
DocumentPlus,
|
||||
ExclamationTriangle,
|
||||
H1,
|
||||
Icon,
|
||||
@@ -23,8 +18,7 @@
|
||||
Strikethrough,
|
||||
} from 'svelte-hero-icons'
|
||||
import ImageUploadModal from '../lemmy/modal/ImageUploadModal.svelte'
|
||||
import type { HTMLTextareaAttributes } from 'svelte/elements'
|
||||
import type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
let textArea: HTMLTextAreaElement | undefined = $state()
|
||||
|
||||
@@ -60,7 +54,7 @@
|
||||
}
|
||||
|
||||
let uploadingImage = $state(false)
|
||||
let image = $state<any>(null)
|
||||
let image = $state<FileList | null | undefined>(null)
|
||||
|
||||
const shortcuts = {
|
||||
KeyB: () => wrapSelection('**', '**'),
|
||||
@@ -68,11 +62,6 @@
|
||||
KeyS: () => wrapSelection('~~', '~~'),
|
||||
KeyH: () => wrapSelection('\n# ', ''),
|
||||
KeyK: () => wrapSelection('[](', ')'),
|
||||
Enter: (e: any) => {
|
||||
onconfirm?.(value)
|
||||
const newEvent = new Event('submit', { cancelable: true })
|
||||
e?.target?.form?.dispatchEvent(newEvent)
|
||||
},
|
||||
}
|
||||
|
||||
async function adjustHeight() {
|
||||
@@ -93,10 +82,9 @@
|
||||
rows?: number
|
||||
beforePreview?: (input: string) => string
|
||||
previewing?: boolean
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
customLabel?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
onconfirm?: (value: string) => void
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -107,12 +95,11 @@
|
||||
tools = true,
|
||||
disabled = false,
|
||||
rows = 2,
|
||||
beforePreview = (input) => input,
|
||||
beforePreview = input => input,
|
||||
previewing = $bindable(false),
|
||||
class: clazz = '',
|
||||
customLabel,
|
||||
children,
|
||||
onconfirm,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
|
||||
@@ -125,8 +112,8 @@
|
||||
<ImageUploadModal
|
||||
bind:open={uploadingImage}
|
||||
bind:image
|
||||
onupload={(e) => {
|
||||
e.forEach((i) => {
|
||||
onupload={e => {
|
||||
e.forEach(i => {
|
||||
wrapSelection(`\n\n`, '')
|
||||
})
|
||||
}}
|
||||
@@ -265,10 +252,10 @@ overflow-hidden transition-colors {clazz}"
|
||||
class="bg-inherit z-0 border-0 rounded-none ring-0! focus:ring-transparent! transition-none! resize-none"
|
||||
bind:value
|
||||
bind:element={textArea}
|
||||
onkeydown={(e) => {
|
||||
onkeydown={e => {
|
||||
if (disabled) return
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error yes it can
|
||||
let shortcut = shortcuts[e.code]
|
||||
if (shortcut) {
|
||||
e.preventDefault()
|
||||
@@ -277,11 +264,11 @@ overflow-hidden transition-colors {clazz}"
|
||||
}
|
||||
}}
|
||||
oninput={adjustHeight}
|
||||
onpaste={(e) => {
|
||||
onpaste={e => {
|
||||
if (!e.clipboardData?.files) return
|
||||
const files = Array.from(e.clipboardData.files)
|
||||
if (files[0]?.type.startsWith('image/')) {
|
||||
image = e.clipboardData.files[0]
|
||||
image = e.clipboardData.files[0] as unknown as FileList | null
|
||||
uploadingImage = true
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user