Coming from 0.10, we had the markRange API that took a “onRemove” option to handle the case where the user delete the range while typing.
The 0.12 introduced Decorations as a replacement, but I couldn’t find a straightforward way to reproduce this feature.
I understand that the way to update the decorations while the user is typing is something like :
newDecorations = prev.decorations.map(action.transform.mapping, action.transform.doc);
Which will drop decorations that are no longer in use, but won’t be verbose about it.
Is there any canonical way to track for removed decorations ?
This feature was dropped, at least in the initial version of decorations. What were you using it for, precisely? Would being able to pass a callback to map help?
I’ve implemented a callback that you can pass to map. It only passes the decoration’s options object, since the start/end positions aren’t always in a sane state when the code decides to drop a given decoration. Does that work for you? The idea would be to store an ID or something similar in the options, and inspect that when the decoration is dropped.