Background: I’m working on improving / fixing bugs in prosemirror-suggest-changes.
This is the Slice we’re working with:
{
"content": [
{
"type": "text",
"marks": [
{
"type": "em"
},
{
"type": "strong"
},
{
"type": "insertion",
"attrs": {
"id": "1"
}
}
],
"text": "test paragraph"
}
]
}
The code then loops through all the nodes in a slice and creates a new Transfrom for each children ( only 1 children in our example ):
const tr = new Transform(node);
Then on that Transform it calls:
tr.removeMark(0, node.nodeSize, markTypeToApply);
// or
tr.removeNodeMark(0, markTypeToApply);
Both of these calls fail. The first one at nodesBetween because it doesn’t have any children ( okay ). The second one is because doc.nodeAt(0) doesn’t return a Node.
In the docs:
new Transform(doc: Node)
Create a transform that starts with the given document.
What we’re giving to the Transform is not a document, so I understand why this would not work.
My question is: how to do this correctly, what direction I should try?