fix: critical fix, disable window file drop

This commit is contained in:
EETagent 2022-12-04 13:50:23 +01:00
parent 1ec14e5f77
commit 87c04c8602

View file

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import FileType from './FileType.svelte'; import FileType from './FileType.svelte';
import FileDrop from 'filedrop-svelte'; import { filedrop, type FileDropOptions } from 'filedrop-svelte';
import { submissionProgress, UploadStatus, type Status } from '$lib/stores/portfolio'; import { submissionProgress, UploadStatus, type Status } from '$lib/stores/portfolio';
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import ProgressBar from './ProgressBar.svelte'; import ProgressBar from './ProgressBar.svelte';
@ -86,6 +86,13 @@
}); });
} }
}; };
const FileDropOptions: FileDropOptions = {
accept: filetype === 'PDF' ? 'application/pdf' : 'application/zip',
maxSize: filesize * 1_000_000,
multiple: false,
windowDrop: false
};
</script> </script>
<div class="card uploadCard relative"> <div class="card uploadCard relative">
@ -144,24 +151,19 @@
</div> </div>
{:else} {:else}
<div class="body"> <div class="body">
<FileDrop <div
multiple={false} use:filedrop={FileDropOptions}
maxSize={filesize * 1_000_000}
accept={filetype == 'PDF' ? 'application/pdf' : 'application/zip'}
on:filedrop={(e) => onFileDrop(e.detail.files)} on:filedrop={(e) => onFileDrop(e.detail.files)}
on:filedragenter={dashAnimationStart} on:filedragenter={dashAnimationStart}
on:filedragleave={dashAnimationStop} on:filedragleave={dashAnimationStop}
class="drag group"
on:mouseenter={dashAnimationStart}
on:mouseleave={dashAnimationStop}
style={`background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='9' ry='9' stroke-opacity='50%' stroke='%23406280' stroke-width='4' stroke-dasharray='10' stroke-dashoffset='${dashAnimationProgress}' stroke-linecap='square'/%3e%3c/svg%3e");`}
> >
<div <span class="text-[#406280]">Sem přetáhněte,</span>
class="drag group" <span class="text-sspsGray">nebo nahrajte {placeholder}</span>
on:mouseenter={dashAnimationStart} </div>
on:mouseleave={dashAnimationStop}
style={`background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='9' ry='9' stroke-opacity='50%' stroke='%23406280' stroke-width='4' stroke-dasharray='10' stroke-dashoffset='${dashAnimationProgress}' stroke-linecap='square'/%3e%3c/svg%3e");`}
>
<span class="text-[#406280]">Sem přetáhněte,</span>
<span class="text-sspsGray">nebo nahrajte {placeholder}</span>
</div>
</FileDrop>
</div> </div>
{/if} {/if}
</div> </div>
@ -199,7 +201,7 @@
@apply p-7; @apply p-7;
} }
.uploaded { .uploaded {
@apply 2xl:px-14 ; @apply 2xl:px-14;
} }
.card h3 { .card h3 {
@apply text-sspsBlue text-2xl font-semibold xl:text-4xl; @apply text-sspsBlue text-2xl font-semibold xl:text-4xl;