Way to update content covered by text marker and keep text marker attached to document?

Hi there,

is there a way to update the content covered by a textMarker as returned from the doc.markText(...) function without removing the textMarker? In my usecase I place a inline widget over a piece of text “[pathToImage, zoom=2]”. The user can update the zoom level from the widget and this change should be reflected in the document as well, e.g. replace:

[pathToImage, zoom=2] → [pathToImage, zoom=3]

When I use the doc.replaceRange(...) method, the created textMarker is removed and I have to create a new textMarker object by calling doc.markText(...). Is there a way to replace the text content and keep the textMarker applied to the document?

Alternativly, is there a way to reattach a former created TextMarker object to a document again? E.g. something like doc.attachTextMarker(textMarker, from, to).

What do you think?

Cheers and thanks a lot for such an amazing editor :smile:

Julian

You could make it inclusiveLeft and inclusiveRight, but that also affects the behavior of new text typed at the edges of the marker (it’ll be part of the marker). If you don’t want that, you will have to re-create the marker after doing the replacement.