From 9c00ae80006ba7f9c51c931f8600cae58639e63b Mon Sep 17 00:00:00 2001 From: pngwn Date: Fri, 25 Feb 2022 15:12:22 +0000 Subject: [PATCH] fix audio --- ui/packages/audio/src/Audio.svelte | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ui/packages/audio/src/Audio.svelte b/ui/packages/audio/src/Audio.svelte index b51e4a500b..077d23b41a 100644 --- a/ui/packages/audio/src/Audio.svelte +++ b/ui/packages/audio/src/Audio.svelte @@ -23,7 +23,7 @@ let inited = false; let crop_values = [0, 100]; - const dispatch = createEventDispatcher(); + const dispatch = createEventDispatcher<{ change: Value }>(); function blob_to_data_url(blob: Blob): Promise { return new Promise((fulfill, reject) => { @@ -77,7 +77,7 @@ }; function clear() { - dispatch("change", { data: null, name: null }); + dispatch("change"); mode = ""; value = null; } @@ -117,6 +117,15 @@ crop_max: values[1] }); } + + function handle_load({ + detail + }: { + detail: { data: string; name: string; size: number; is_example: boolean }; + }) { + value = detail; + dispatch("change", { data: detail.data, name: detail.name }); + }
@@ -138,13 +147,7 @@ {/if} {:else if source === "upload"} - ( - (value = detail), dispatch("change", { data: detail }) - )} - {theme} - > + {drop_text}
- {or_text} -
{upload_text}