draft of formatting

pull/21833/head
Bruno Windels 2019-05-13 18:20:32 +01:00
parent eaf43d7277
commit 2fbe73e658
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
export function htmlSerialize(model) {
return model.parts.reduce((html, part) => {
switch (part.type) {
case "newline":
return html + "<br />";
case "plain":
case "pill-candidate":
return html + part.text;
case "room-pill":
case "user-pill":
return html + `<a href="https://matrix.to/#/${part.resourceId}">${part.text}</a>`;
}
}, "");
}