mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-14 18:49:02 +08:00
fix search highlight on doc change
This commit is contained in:
parent
fc617a4d32
commit
753fc76324
@ -95,9 +95,15 @@ export default class Search extends Extension {
|
|||||||
new Plugin({
|
new Plugin({
|
||||||
state: {
|
state: {
|
||||||
init: (_, { doc }) => this.createDeco(doc),
|
init: (_, { doc }) => this.createDeco(doc),
|
||||||
apply: (tr, old) => (
|
apply: (tr, old) => {
|
||||||
(tr.docChanged || this.options.searching) ? this.createDeco(tr.doc) : old
|
if (this.options.searching) {
|
||||||
),
|
return this.createDeco(tr.doc)
|
||||||
|
}
|
||||||
|
if (tr.docChanged) {
|
||||||
|
return old.map(tr.mapping, tr.doc)
|
||||||
|
}
|
||||||
|
return old
|
||||||
|
},
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
decorations(state) { return this.getState(state) },
|
decorations(state) { return this.getState(state) },
|
||||||
|
Loading…
Reference in New Issue
Block a user