Restore mark decoration when redoing

The mark decoration is removed when the decorated text is remove from the doc, is there a way to restore the mark decoration when user undo the action that bring the text back?

Thanks in advance.

Managed to achieve it by comparing previous state field with current transaction, when the decoration is removed, register a effect using invertedEffects

There is, but it’s somewhat more involved that you may be hoping. I’ve added a new example that shows how to do something like this.

2 Likes

Thank you for the quick reply and detailed example, it is really helpful!