add option to always update search results

This commit is contained in:
Chrissi2812 2019-05-29 12:24:46 +02:00
parent 0e5aa7f116
commit d3514c3d36
No known key found for this signature in database
GPG Key ID: B4B82C7E618271DA

View File

@ -25,6 +25,7 @@ export default class Search extends Extension {
searching: false, searching: false,
caseSensitive: false, caseSensitive: false,
disableRegex: true, disableRegex: true,
alwaysSearch: false,
} }
} }
@ -121,7 +122,7 @@ export default class Search extends Extension {
state: { state: {
init() { return DecorationSet.empty }, init() { return DecorationSet.empty },
apply: (tr, old) => { apply: (tr, old) => {
if (this.options.searching) { if (this.options.searching || (tr.docChanged && this.options.alwaysSearch)) {
return this.createDeco(tr.doc) return this.createDeco(tr.doc)
} }
if (tr.docChanged) { if (tr.docChanged) {