@salesforcedevs/dx-components 0.19.3-alpha.33 → 0.19.3-alpha.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.19.3-alpha.33",
3
+ "version": "0.19.3-alpha.37",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -339,6 +339,8 @@ export default class SidebarSearch extends LightningElement {
339
339
  new Set(
340
340
  [
341
341
  this.value,
342
+ Object.keys(termsToHighlight),
343
+ Object.keys(phrasesToHighlight),
342
344
  Object.values(termsToHighlight),
343
345
  Object.values(phrasesToHighlight)
344
346
  ].flat(2)
@@ -21,19 +21,20 @@ export const highlightTerms = (
21
21
  }
22
22
 
23
23
  try {
24
- let innerHtml = element.innerHTML.replace(
25
- // Remove previously added mark tags
26
- MARK_TAGS,
27
- ""
28
- );
29
-
30
- if (query) {
31
- innerHtml = innerHtml.replace(searchExp, "<mark>$&</mark>");
24
+ if (element.innerHTML.match(MARK_TAGS)) {
25
+ element.innerHTML.replace(
26
+ // Remove previously added mark tags
27
+ MARK_TAGS,
28
+ ""
29
+ );
30
+ }
31
+ if (element.innerHTML.match(searchExp) && query) {
32
+ element.innerHTML.replace(searchExp, "<mark>$&</mark>");
32
33
  }
33
-
34
- element.innerHTML = innerHtml;
35
34
  } catch (e) {
36
- console.error(e, element);
35
+ console.error(
36
+ `${element} could not be parsed by the highlight utility: ${e}`
37
+ );
37
38
  }
38
39
 
39
40
  // element