How to implement a search and replace plugin?

Like the above, I’m looking for thoughts on the ‘best’ way to implement find/replace in ProseMirror. Some options I found:

  1. from 2016: GitHub - mattberkowitz/prosemirror-find-replace: Find & Replace plugin for ProseMirror thread: Find and Replace plugin It’s for old standalone prosemirror (vs. current organization as multiple modules). I attempted a quick test anyway, but no luck – perhaps only because the browser uses the same cmd-f (and/or that I’m a new to ProseMirror). I thought it was worth asking here before digging too far. The main code: prosemirror-find-replace/src/index.js at master · mattberkowitz/prosemirror-find-replace · GitHub

  2. ‘port’ from CodeMirror: search/src at main · codemirror/search · GitHub … but no idea if that’s realistic.

  3. ‘port’ from tiptap: tiptap-search-and-replace/src/searchAndReplace.ts at main · sereneinserenade/tiptap-search-and-replace · GitHub which I think is a v2 version by @sereneinserenade of tiptap v1 code

  4. ‘port’ from Wax: wax-prosemirror-services/src/FindAndReplaceService · master · wax / wax-prosemirror · GitLab

Thoughts? Anyone interested in helping out?

Goal: release an MIT licensed version with functionality similar to CodeMirror’s search

(Separate and out of scope, but full disclosure for those who care: we built our own UI around CodeMirror’s search and would do something similar for ProseMirror. Both will be part of one or more commercial desktop apps.)

1 Like