From cfa686867c0b9ed3dde6a9ea0e2a100bb11debad Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 2 Jul 2021 18:20:07 -0700 Subject: [PATCH] Make `parse` a function that returns a MessageBody --- src/platform/web/dom/deserialize.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platform/web/dom/deserialize.js b/src/platform/web/dom/deserialize.js index e7abf3b9..aa0b324a 100644 --- a/src/platform/web/dom/deserialize.js +++ b/src/platform/web/dom/deserialize.js @@ -1,4 +1,4 @@ -import { HeaderBlock, ListBlock, CodeBlock, FormatPart, NewLinePart, RulePart, TextPart, LinkPart } from "../../../domain/session/room/timeline/MessageBody.js" +import { MessageBody, HeaderBlock, ListBlock, CodeBlock, FormatPart, NewLinePart, RulePart, TextPart, LinkPart } from "../../../domain/session/room/timeline/MessageBody.js" /* At the time of writing (Jul 1 2021), Matrix Spec recommends @@ -132,7 +132,8 @@ function parseNodes(result, nodes) { return parsed; } -export function parse(platform, html) { +export function parseHTMLBody(platform, html) { const parseResult = platform.parseHTML(html); - return parseNodes(parseResult, parseResult.rootNodes); + const parts = parseNodes(parseResult, parseResult.rootNodes); + return new MessageBody(html, parts); }