diff --git a/packages/tiptap-extensions/src/extensions/Search.js b/packages/tiptap-extensions/src/extensions/Search.js index 2603968e9..0ccbb9e38 100644 --- a/packages/tiptap-extensions/src/extensions/Search.js +++ b/packages/tiptap-extensions/src/extensions/Search.js @@ -99,17 +99,16 @@ export default class Search extends Extension { } find(searchTerm) { - return ({ doc, tr }, dispatch) => { + return ({ tr }, dispatch) => { this.options.searching = true this.searchTerm = searchTerm - this._search(doc) - dispatch(tr) } } createDeco(doc) { + this._search(doc) return this.decorations ? DecorationSet.create(doc, this.decorations) : [] } @@ -117,7 +116,7 @@ export default class Search extends Extension { return [ new Plugin({ state: { - init: (_, { doc }) => this.createDeco(doc), + init() { return DecorationSet.empty }, apply: (tr, old) => { if (this.options.searching) { return this.createDeco(tr.doc)