diff --git a/src/domain/MessageObjectFormat.js b/src/domain/MessageObjectFormat.js new file mode 100644 index 00000000..461856b4 --- /dev/null +++ b/src/domain/MessageObjectFormat.js @@ -0,0 +1,24 @@ +export class MessageObjectFormat { + + constructor(message = []) { + this._root = message; + } + + insertText(text) { + if (text.length) + this._root.push({ type: "text", text: text }); + } + + insertLink(link, displayText) { + this._root.push({ type: "link", url: link, text: displayText }); + } + + insertNewline() { + this._root.push({ type: "newline" }); + } + + [Symbol.iterator]() { + return this._root.values(); + } + +}