MapComplete/src/UI/Base/FromHtml.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
391 B
Svelte
Raw Normal View History

2023-03-29 17:21:20 +02:00
<script lang="ts">
/**
* Given an HTML string, properly shows this
*/
import { Utils } from "../../Utils";
export let src: string
let htmlElem: HTMLElement
2023-03-29 17:21:20 +02:00
$: {
2023-04-21 18:09:14 +02:00
if (htmlElem) {
htmlElem.innerHTML = Utils.purify(src)
2023-03-29 17:21:20 +02:00
}
}
export let clss: string | undefined = undefined
2023-03-29 17:21:20 +02:00
</script>
{#if src !== undefined}
<span bind:this={htmlElem} class={clss} />
2023-03-29 17:21:20 +02:00
{/if}