This commit is contained in:
Pieter Vander Vennet 2024-01-15 01:46:22 +01:00
parent e66a91abbd
commit 8853bba4f7
2 changed files with 21 additions and 2 deletions

View file

@ -51,11 +51,30 @@
window.removeEventListener("drop", handleDragEvent)
})
</script>
<form
bind:this={formElement}
on:change|preventDefault={() => {
drawAttention = false
dispatcher("submit", inputElement.files)
}}
on:dragend={() => {
console.log("Drag end")
drawAttention = false
}}
on:dragenter|preventDefault|stopPropagation={(e) => {
console.log("Dragging enter")
drawAttention = true
e.dataTransfer.dropEffect = "copy"
}}
on:dragstart={() => {
drawAttention = false
}}
on:drop|preventDefault|stopPropagation={(e) => {
drawAttention = false
dispatcher("submit", e.dataTransfer.files)
}}
>
<label
class={twMerge(cls, drawAttention ? "glowing-shadow" : "")}

View file

@ -65,7 +65,7 @@
{/if}
{#if $failed > 0}
<div class="alert flex flex-col">
{#if failed === 1}
{#if $failed === 1}
<Tr cls="self-center" t={t.upload.one.failed} />
{:else}
<Tr cls="self-center" t={t.upload.multiple.someFailed.Subs({ count: $failed })} />