Thank you for the feedback marijn. I will try with references to ranges outside the document.
One downside is that it could be a bit trickier to preserving comments when users copy to clipboard (Although I don’t know if my organisation needs this functionality anyway).
I think I can use the transaction mapping to update the references as the document is modified.
state: {
apply(transaction, currentValue, oldState, newState) {
comments.forEach(comment => {
comment.from = transaction.mapping.map(comment.from);
comment.to = transaction.mapping.map(comment.to);
})
}
}
Just a bit of background. We are building a text editor for highly structured pharmaceutical data. Hopefully can come back and show it off once it is done!
Thanks