You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
draft of formatting
This commit is contained in:
14
src/editor/html_serialize.js
Normal file
14
src/editor/html_serialize.js
Normal 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>`;
|
||||
}
|
||||
}, "");
|
||||
}
|
||||
Reference in New Issue
Block a user