Make parse a function that returns a MessageBody

This commit is contained in:
Danila Fedorin 2021-07-02 18:20:07 -07:00
parent 6ba2deffef
commit cfa686867c

View file

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