From c9033f601256f4b87a3ed801507e73cab281db51 Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Wed, 24 Nov 2021 10:52:21 +0100 Subject: [PATCH] fixes #343 Signed-off-by: Andrey Platov --- .../src/components/MessageViewer.svelte | 2 +- .../src/components/message/Nodes.svelte | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/presentation/src/components/MessageViewer.svelte b/packages/presentation/src/components/MessageViewer.svelte index d40006f78a..422f280395 100644 --- a/packages/presentation/src/components/MessageViewer.svelte +++ b/packages/presentation/src/components/MessageViewer.svelte @@ -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 diff --git a/packages/presentation/src/components/message/Nodes.svelte b/packages/presentation/src/components/message/Nodes.svelte index 84a4c84cac..f77edd07d1 100644 --- a/packages/presentation/src/components/message/Nodes.svelte +++ b/packages/presentation/src/components/message/Nodes.svelte @@ -25,11 +25,19 @@ {#if node.nodeType === Node.TEXT_NODE} {node.data} {:else} - {#if node.nodeName === 'em'} + {#if node.nodeName === 'EM'} - {:else if node.nodeName === 'strong'} + {:else if node.nodeName === 'STRONG'} - {:else if node.nodeName === 'span'} + {:else if node.nodeName === 'P'} +

+ {:else if node.nodeName === 'BLOCKQUOTE'} +
+ {:else if node.nodeName === 'CODE'} + + {:else if node.nodeName === 'BR'} +
+ {:else if node.nodeName === 'SPAN'} {:else} Unknown { node.nodeName }