bug
In the highlight example, type a word in the search box, then delete that word (or change it slightly) in the paragraph. The highlight will still be visible applied to the wrong characters.

The highlight should be removed if the text changes. I think only a minor tweak to the onInputChange method is needed. When I have some extra time this week I can look into it.
Ah good call. Actually if we just extracted the body of onInputChange out into an updateDecorators method, and called it from both onInputChange and onChange, I think that would fix it.
I just realized...
This is due to state.decorations not being updated in the same way that state.selection is updated in ./operations/apply.js. Every time an operation is applied, the logic checks to see if the selection range needs to be shifted/removed based on what was inserted/removed. If the same thing happened for decorations this would be fixed.
I think we should fix it at the source, instead of in the example.
@ianstormtaylor any update on this bug?
Not from me personally, because I’m not affected by it right now. But if anyone else wanted to PR a fix that would be awesome!
This is fixed in the latest versions of Slate.
Most helpful comment
I just realized...
This is due to
state.decorationsnot being updated in the same way thatstate.selectionis updated in./operations/apply.js. Every time an operation is applied, the logic checks to see if the selection range needs to be shifted/removed based on what was inserted/removed. If the same thing happened for decorations this would be fixed.I think we should fix it at the source, instead of in the example.