Creating a zero-width TextMarker


#1

I’m having some trouble creating a zero-width TextMarker. My use-case is showing a “deletion marker” to visually mark where some text has been deleted from a document.

For 99% of cases, a zero-width TextMarker seems to behave how I would expect - it can be inserted, updates when typing, etc. However if inserting a character immediately next to the marker, it is cleared. I have tried many combinations of the various markText options and I don’t seem to be able to prevent this behaviour.

The one exception is if I set { atomic: true, inclusiveLeft: true, inclusiveRight: true }, however this has undesirable cursor behaviour - the cursor appears to “skip” over the characters immediately next to the marker.

I’ve created a minimal working example of the problem: https://jsbin.com/tokebok/edit?html,css,js,output

Not entirely sure if this is a question or a feature request, but advice on solving this would be appreciated.


#2

Have you tried using setBookmark with a widget option?


#3

Thanks for the reply.

I had a workaround using addWidget, but was running into issues with positioning it correctly (due to some other text markers changing the DOM).

setBookmark with a widget looks exactly what I’m looking for! Thanks so much :slight_smile:

EDIT: modified my example https://jsbin.com/zuluzax/edit?html,css,js,output