Replacing keywords in text as they are written

You could use a transactionFilter that checks whether the text around any of the changed ranges (tr.changes.iterChangedRanges) the new doc matches your keyword, and adds an additional transaction that changes them when it does (return [tr, {changes: [...], sequential: true}]).

2 Likes