[Structure Design] Y.Text vs Y.XmlFragment

Hi, everyone.

About the inline format of the paragraph for the editor (e.g Quill, EditorJS)

On the web page, they will look like this:

  • bold: <b>ABC</b>
  • strikethrough: <s>ABC</s>
  • color: <span class="red">ABC</span>
  • and so on

But in the YJS’s Structure, we have two choices for implementation:

  • The Delta of Y.Text
[
  {
    insert: 'ABC',
    attributes: { bold: true }
  }
]
  • Y.XmlFragment
<XmlFragment>
  <XmlElement>  <!-- new Y.XmlElement('b') -->
    <XmlText>ABC</XmlText>
  </XmlElement>
</XmlFragment>

Which one is more generic or better?