mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2024-12-22 00:06:28 +00:00
don't remove already selected files
This commit is contained in:
parent
83f0902291
commit
43f67c795d
@ -3,6 +3,7 @@
|
||||
import { Files } from '$lib/files'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { t } from 'svelte-intl-precompile'
|
||||
import Button from './Button.svelte'
|
||||
import MaxSize from './MaxSize.svelte'
|
||||
|
||||
export let label: string = ''
|
||||
@ -13,7 +14,7 @@
|
||||
async function onInput(e: Event) {
|
||||
const input = e.target as HTMLInputElement
|
||||
if (input?.files?.length) {
|
||||
files = Array.from(input.files)
|
||||
files = [...files, ...Array.from(input.files)]
|
||||
const data: FileDTO[] = await Promise.all(
|
||||
files.map(async (file) => ({
|
||||
name: file.name,
|
||||
@ -27,6 +28,12 @@
|
||||
dispatch('file', '')
|
||||
}
|
||||
}
|
||||
|
||||
function clear(e: Event) {
|
||||
e.preventDefault()
|
||||
files = []
|
||||
dispatch('file', '')
|
||||
}
|
||||
</script>
|
||||
|
||||
<label>
|
||||
@ -43,6 +50,8 @@
|
||||
{file.name}
|
||||
</div>
|
||||
{/each}
|
||||
<div class="spacer" />
|
||||
<Button on:click={clear}>Clear</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div>
|
||||
@ -66,4 +75,8 @@
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user