2019-09-19 05:35:40 +02:00
|
|
|
<script>
|
2020-02-03 10:50:30 +01:00
|
|
|
import { buildStyle } from "./buildStyle"
|
2019-09-19 05:35:40 +02:00
|
|
|
|
2020-02-14 12:51:45 +01:00
|
|
|
export let text = ""
|
|
|
|
export let className = ""
|
|
|
|
|
|
|
|
export let formattingTag = ""
|
2019-09-19 05:35:40 +02:00
|
|
|
|
2020-04-27 12:26:34 +02:00
|
|
|
export let fontFamily = ""
|
2020-04-23 14:22:41 +02:00
|
|
|
export let fontSize = "1em"
|
2020-02-03 10:50:30 +01:00
|
|
|
export let textAlign = ""
|
|
|
|
export let verticalAlign = ""
|
|
|
|
export let color = ""
|
2019-09-19 05:35:40 +02:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
export let _bb
|
2019-09-19 05:35:40 +02:00
|
|
|
|
2020-02-14 12:51:45 +01:00
|
|
|
const isTag = tag => (formattingTag || "").indexOf(tag) > -1
|
|
|
|
|
2020-04-23 14:22:41 +02:00
|
|
|
$: style = buildStyle({
|
2020-04-27 12:26:34 +02:00
|
|
|
"font-size": fontSize,
|
|
|
|
"font-family": fontFamily,
|
2020-04-23 14:22:41 +02:00
|
|
|
color,
|
|
|
|
})
|
2019-09-19 05:35:40 +02:00
|
|
|
</script>
|
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
{#if isTag('none')}
|
2020-04-23 14:22:41 +02:00
|
|
|
<span {style}>{text}</span>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if isTag('<b>')}
|
|
|
|
<b class={className} {style}>{text}</b>
|
|
|
|
{:else if isTag('<strong>')}
|
|
|
|
<strong class={className} {style}>{text}</strong>
|
|
|
|
{:else if isTag('<i>')}
|
|
|
|
<i class={className} {style}>{text}</i>
|
|
|
|
{:else if isTag('<em>')}
|
|
|
|
<em class={className} {style}>{text}</em>
|
|
|
|
{:else if isTag('<mark>')}
|
|
|
|
<mark class={className} {style}>{text}</mark>
|
|
|
|
{:else if isTag('<small>')}
|
|
|
|
<small class={className} {style}>{text}</small>
|
|
|
|
{:else if isTag('<del>')}
|
|
|
|
<del class={className} {style}>{text}</del>
|
|
|
|
{:else if isTag('<ins>')}
|
|
|
|
<ins class={className} {style}>{text}</ins>
|
|
|
|
{:else if isTag('<sub>')}
|
|
|
|
<sub class={className} {style}>{text}</sub>
|
|
|
|
{:else if isTag('<sup>')}
|
|
|
|
<sup class={className} {style}>{text}</sup>
|
|
|
|
{:else}{text}{/if}
|