mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-23 14:06:00 +03:00
parent
33ce6a73f7
commit
c9033f6012
@ -23,7 +23,7 @@
|
||||
|
||||
const parser = new DOMParser()
|
||||
|
||||
$: dom = parser.parseFromString(message, 'application/xhtml+xml').firstChild as HTMLElement
|
||||
$: dom = parser.parseFromString(message, 'text/html').firstChild?.childNodes[1] as HTMLElement
|
||||
</script>
|
||||
|
||||
<Nodes nodes={dom.childNodes}/>
|
||||
|
@ -25,11 +25,19 @@
|
||||
{#if node.nodeType === Node.TEXT_NODE}
|
||||
{node.data}
|
||||
{:else}
|
||||
{#if node.nodeName === 'em'}
|
||||
{#if node.nodeName === 'EM'}
|
||||
<em><svelte:self nodes={node.childNodes}/></em>
|
||||
{:else if node.nodeName === 'strong'}
|
||||
{:else if node.nodeName === 'STRONG'}
|
||||
<strong><svelte:self nodes={node.childNodes}/></strong>
|
||||
{:else if node.nodeName === 'span'}
|
||||
{:else if node.nodeName === 'P'}
|
||||
<p><svelte:self nodes={node.childNodes}/></p>
|
||||
{:else if node.nodeName === 'BLOCKQUOTE'}
|
||||
<blockquote><svelte:self nodes={node.childNodes}/></blockquote>
|
||||
{:else if node.nodeName === 'CODE'}
|
||||
<code><svelte:self nodes={node.childNodes}/></code>
|
||||
{:else if node.nodeName === 'BR'}
|
||||
<br/>
|
||||
{:else if node.nodeName === 'SPAN'}
|
||||
<Person objectId={node.getAttribute('data-id')} title={node.getAttribute('data-label')} />
|
||||
{:else}
|
||||
Unknown { node.nodeName }
|
||||
|
Loading…
Reference in New Issue
Block a user