patent-editor 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.js +9 -20
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -401,18 +401,8 @@ const ia = Oe.create({
|
|
|
401
401
|
setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = ke(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
402
402
|
setReplaceTerm: (e) => () => (this.storage.replaceTerm = e, !0),
|
|
403
403
|
setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = ke(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
404
|
-
nextSearchResult: () => ({ editor: e }) =>
|
|
405
|
-
|
|
406
|
-
this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
|
|
407
|
-
const t = this.storage.results[this.storage.currentIndex];
|
|
408
|
-
return t && (e.commands.setTextSelection(t), ft(e)), e.view.dispatch(e.state.tr), !0;
|
|
409
|
-
},
|
|
410
|
-
previousSearchResult: () => ({ editor: e }) => {
|
|
411
|
-
if (this.storage.results.length === 0) return !1;
|
|
412
|
-
this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length;
|
|
413
|
-
const t = this.storage.results[this.storage.currentIndex];
|
|
414
|
-
return t && (e.commands.setTextSelection(t), ft(e)), e.view.dispatch(e.state.tr), !0;
|
|
415
|
-
},
|
|
404
|
+
nextSearchResult: () => ({ editor: e }) => this.storage.results.length === 0 ? !1 : (this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length, ft(e, this.storage.results[this.storage.currentIndex]), !0),
|
|
405
|
+
previousSearchResult: () => ({ editor: e }) => this.storage.results.length === 0 ? !1 : (this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length, ft(e, this.storage.results[this.storage.currentIndex]), !0),
|
|
416
406
|
replaceCurrent: () => ({ editor: e }) => {
|
|
417
407
|
if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
|
|
418
408
|
const t = this.storage.results[this.storage.currentIndex];
|
|
@@ -466,14 +456,13 @@ const ia = Oe.create({
|
|
|
466
456
|
];
|
|
467
457
|
}
|
|
468
458
|
});
|
|
469
|
-
function ft(e) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
});
|
|
459
|
+
function ft(e, t) {
|
|
460
|
+
if (!t) {
|
|
461
|
+
e.view.dispatch(e.state.tr);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const n = e.state.doc.content.size, r = Math.min(Math.max(t.from, 0), n), a = Math.min(Math.max(t.to, r), n);
|
|
465
|
+
e.chain().setTextSelection({ from: r, to: a }).scrollIntoView().run();
|
|
477
466
|
}
|
|
478
467
|
const sa = -1, oa = 1, pt = 0;
|
|
479
468
|
let Ge = null;
|