How to implement a search and replace plugin?

Since prosemirror doc has its own mechanism to compute text position, I can not use a common string search algorithm to index the target substring.

For example, we have a paragraph, there’re two text nodes inside.


   text "cae" [mark: bold] 

   text "eddc"

I want to search “caeed”

But it seems like very difficult to compute the range(start, end) of the found substring

@marjin Thanks for the great work of ProseMirror! Any idea about this question?