html component to do dom purify.

This commit is contained in:
Jason Schwarzenberger
2020-12-02 14:35:49 +13:00
parent f524ecec7b
commit 8c40124e07
4 changed files with 22 additions and 41 deletions
+15
View File
@@ -0,0 +1,15 @@
<script>
import DOMPurify from "dompurify";
import { onMount } from "svelte";
export let html;
let purify;
onMount(() => {
purify = (html) => DOMPurify.sanitize(html);
});
</script>
{#if purify}
{@html html}
{:else}{html}{/if}