Merge pull request #361 from hcengineering/main

Merge #343 into develop
This commit is contained in:
Andrey Sobolev 2021-11-25 00:54:14 +07:00 committed by GitHub
commit 5ea2d326b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -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}/>

View File

@ -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 }