html component to do dom purify.
This commit is contained in:
@@ -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}
|
||||
Reference in New Issue
Block a user