I’d like to restrict the search in prosemirror-search to a set of ranges.
Currently only a single range is supported.
I thought of an optional ranges?: { from: number, to: number }[] property in SearchQuery; then I would adapt nextMatch and prevMatch to adjust the range to the most suitable one in the set of ranges. Do you find this ok, @marijn ?
Sorry, but I’d feel that’d complicate the package too much, and I’d advise forking search.ts (it’s not a lot of code anyway, and you can reuse query.ts as is).
I’ve implemented a search mechanism based on CSS-like selectors in my editor for pandoc AST, so you can search for, e.g., blockquote > para or emph ~ strong, to get nodes’ or mark ranges’ references.
The combination of that mechanism with prosemirror-search lets you do some pretty complex search and replace operations.
CSS-like selectors return the ranges covered by one or more Nodes or Marks, that’s why I must adapt prosemirror-search to work on a set of ranges.