@progress/kendo-pdfviewer-common 0.2.6 → 0.2.7-dev.202401031409
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/es/search.js +6 -2
- package/dist/es2015/search.js +6 -2
- package/dist/npm/search.d.ts +1 -0
- package/dist/npm/search.js +6 -2
- package/package.json +1 -1
package/dist/es/search.js
CHANGED
|
@@ -69,8 +69,12 @@ export class SearchService {
|
|
|
69
69
|
matches: []
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
escapeRegExp(text) {
|
|
73
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
74
|
+
}
|
|
72
75
|
search({ text, matchCase }) {
|
|
73
|
-
let
|
|
76
|
+
let escapedText = this.escapeRegExp(text);
|
|
77
|
+
let searchRegex = new RegExp(escapedText, matchCase ? 'g' : 'ig');
|
|
74
78
|
let match;
|
|
75
79
|
if (this.shouldTransformText()) {
|
|
76
80
|
this.transformTextForSearch();
|
|
@@ -78,7 +82,7 @@ export class SearchService {
|
|
|
78
82
|
this.state.matches = [];
|
|
79
83
|
this.state.activeMatchIndex = 0;
|
|
80
84
|
this.removeIndicators();
|
|
81
|
-
if (
|
|
85
|
+
if (escapedText === '') {
|
|
82
86
|
return [];
|
|
83
87
|
}
|
|
84
88
|
match = searchRegex.exec(this.state.text);
|
package/dist/es2015/search.js
CHANGED
|
@@ -69,8 +69,12 @@ export class SearchService {
|
|
|
69
69
|
matches: []
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
escapeRegExp(text) {
|
|
73
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
74
|
+
}
|
|
72
75
|
search({ text, matchCase }) {
|
|
73
|
-
let
|
|
76
|
+
let escapedText = this.escapeRegExp(text);
|
|
77
|
+
let searchRegex = new RegExp(escapedText, matchCase ? 'g' : 'ig');
|
|
74
78
|
let match;
|
|
75
79
|
if (this.shouldTransformText()) {
|
|
76
80
|
this.transformTextForSearch();
|
|
@@ -78,7 +82,7 @@ export class SearchService {
|
|
|
78
82
|
this.state.matches = [];
|
|
79
83
|
this.state.activeMatchIndex = 0;
|
|
80
84
|
this.removeIndicators();
|
|
81
|
-
if (
|
|
85
|
+
if (escapedText === '') {
|
|
82
86
|
return [];
|
|
83
87
|
}
|
|
84
88
|
match = searchRegex.exec(this.state.text);
|
package/dist/npm/search.d.ts
CHANGED
package/dist/npm/search.js
CHANGED
|
@@ -71,8 +71,12 @@ class SearchService {
|
|
|
71
71
|
matches: []
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
escapeRegExp(text) {
|
|
75
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
76
|
+
}
|
|
74
77
|
search({ text, matchCase }) {
|
|
75
|
-
let
|
|
78
|
+
let escapedText = this.escapeRegExp(text);
|
|
79
|
+
let searchRegex = new RegExp(escapedText, matchCase ? 'g' : 'ig');
|
|
76
80
|
let match;
|
|
77
81
|
if (this.shouldTransformText()) {
|
|
78
82
|
this.transformTextForSearch();
|
|
@@ -80,7 +84,7 @@ class SearchService {
|
|
|
80
84
|
this.state.matches = [];
|
|
81
85
|
this.state.activeMatchIndex = 0;
|
|
82
86
|
this.removeIndicators();
|
|
83
|
-
if (
|
|
87
|
+
if (escapedText === '') {
|
|
84
88
|
return [];
|
|
85
89
|
}
|
|
86
90
|
match = searchRegex.exec(this.state.text);
|