impr: rewrite image upload handling

This commit is contained in:
James Xylight committed 2025-08-23 11:36:05 -07:00
1 parent 935650ff07
commit 7fa3b60bd4
11 files changed
+200 -286

No files matched your search

@@ -2,7 +2,7 @@
import MultiSelect from '$lib/components/input/Switch.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import { t } from '$lib/i18n/translations'
import { Button, Label, TextArea } from 'mono-svelte'
import { Button, Label, Modal, TextArea } from 'mono-svelte'
import type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
import { tick } from 'svelte'
import {
@@ -17,8 +17,8 @@
Photo,
Strikethrough,
} from 'svelte-hero-icons'
import ImageUploadModal from '../lemmy/modal/ImageUploadModal.svelte'
import type { ClassValue } from 'svelte/elements'
import ImageAttachForm from '../form/ImageAttachForm.svelte'
let textArea: HTMLTextAreaElement | undefined = $state()
@@ -122,15 +122,16 @@
</script>
{#if uploadingImage && images}
<ImageUploadModal
bind:open={uploadingImage}
bind:image
onupload={e => {
e.forEach(i => {
wrapSelection(`![](${i})\n\n`, '')
})
}}
/>
<Modal title={$t('form.post.uploadImage')} bind:open={uploadingImage}>
<ImageAttachForm
bind:image
onupload={e => {
e.forEach(i => {
wrapSelection(`![](${i})\n\n`, '')
})
}}
/>
</Modal>
{/if}
<div>