I have a Y Doc in the following structure
doc {
common: {
...
}
blocks: [
{
id: 1,
data: {
content: {
hero: {
body: "some content" <--- I want this to be collaborative XmlFragment
}
}
}
}
....
]
}
the whole document is collaborative, and what is the best way to make blocks[0].data.content.hero.body a XmlFragment.
Currently, I create a new XmlFragment with a composite id 1-data-content-hero-body
by doing doc.getXMLFragment("1-data-content-hero-body")
and update the doc.blocks[0].data.content.hero.body with the full string value (prosemirror doc) when the body changed, this works fine, but now the doc has duplicated data.
Every time I made one letter change it adds a new Item will the full transformed json, as well as a Item with one character change for the XmlFragment. If i turn off the GC, the doc size is getting really large pretty quickly.
What are some ways I can solve this? I want full collboration on all items in the Map