This commit is contained in:
Timothy J. Baek 2024-08-21 22:27:21 +02:00
parent dc4c6b3b14
commit 94eb91063c

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
export let show = false; export let show = false;
export let src = ''; export let src = '';
@ -45,6 +45,14 @@
document.body.removeChild(previewElement); document.body.removeChild(previewElement);
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
} }
onDestroy(() => {
show = false;
if (previewElement) {
document.body.removeChild(previewElement);
}
});
</script> </script>
{#if show} {#if show}