From 2fbe73e6581e6bc92a40156268efd4cde9ef3031 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 13 May 2019 18:20:32 +0100 Subject: [PATCH] draft of formatting --- src/editor/html_serialize.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/editor/html_serialize.js diff --git a/src/editor/html_serialize.js b/src/editor/html_serialize.js new file mode 100644 index 0000000000..bd8842b01f --- /dev/null +++ b/src/editor/html_serialize.js @@ -0,0 +1,14 @@ +export function htmlSerialize(model) { + return model.parts.reduce((html, part) => { + switch (part.type) { + case "newline": + return html + "
"; + case "plain": + case "pill-candidate": + return html + part.text; + case "room-pill": + case "user-pill": + return html + `${part.text}`; + } + }, ""); +}