Thank so much! This is making a lot more sense now.
I have my plugin rendering additions with decorations using prosemirror-changeset but one thing I don’t quite follow is the handling of deletions might work.
Based on the other thread I think this would be the approach.
- Include deleted slices as metadata when generating a new changeset using addSteps. So something like:
const newChangeSet = currentValue.addSteps(transaction.doc, transaction.mapping.maps, transaction.steps)
- Render slice content as widget decoration but drop leading/trailing tokens
change.deleted.forEach((span) => {
const serializer = DOMSerializer.fromSchema(state.schema);
const element = serializer.serializeFragment(span.data.slice.content);
Decoration.widget(change.fromA, element)
})
Does that sound about right?
Thank you