From c1096492eb4d20c3bbad63647141d535e6981763 Mon Sep 17 00:00:00 2001 From: SnowCait Date: Fri, 13 Oct 2023 12:20:59 +0900 Subject: [PATCH] Refactor media picker --- web/src/routes/editor/MediaPicker.svelte | 14 +------------- web/src/routes/editor/NoteEditor.svelte | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/web/src/routes/editor/MediaPicker.svelte b/web/src/routes/editor/MediaPicker.svelte index f2ce85878..bcef97d2c 100644 --- a/web/src/routes/editor/MediaPicker.svelte +++ b/web/src/routes/editor/MediaPicker.svelte @@ -2,28 +2,16 @@ import { createEventDispatcher } from 'svelte'; import IconPhoto from '@tabler/icons-svelte/dist/svelte/icons/IconPhoto.svelte'; - export let mediaFiles: File[] = []; - let input: HTMLInputElement | undefined; let files: FileList; const dispatch = createEventDispatcher(); - - function upload() { - dispatch('pick', files); - console.log('[media upload]', files); - for (const file of files) { - console.log('[media upload file]', file); - mediaFiles.push(file); - mediaFiles = mediaFiles; - } - } - + dispatch('pick', files)} accept="image/*" hidden>