@salesforcedevs/docs-components 1.14.8-alpha100 → 1.14.8-alpha101

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/docs-components",
3
- "version": "1.14.8-alpha100",
3
+ "version": "1.14.8-alpha101",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -6,7 +6,7 @@ import Button from "dx/button";
6
6
  import { highlightTerms } from "dxUtils/highlight";
7
7
  import ContentCallout from "doc/contentCallout";
8
8
  import ContentMedia from "doc/contentMedia";
9
- import { normalizeHtmlEntities } from "docUtils/htmlEntities";
9
+ import { normalizeHtmlEntities } from "docUtils/utils";
10
10
 
11
11
  const HIGHLIGHTABLE_SELECTOR = [
12
12
  "p",
@@ -30,3 +30,23 @@ export function logCoveoPageView(
30
30
  });
31
31
  }
32
32
  }
33
+
34
+ export function normalizeHtmlEntities(str: string): string {
35
+ if (typeof str !== 'string') {
36
+ return str;
37
+ }
38
+
39
+ // First decode any double-encoded entities
40
+ const tempDiv = document.createElement('div');
41
+ tempDiv.innerHTML = str;
42
+ const decoded = tempDiv.textContent || tempDiv.innerText;
43
+
44
+ // Then properly encode special characters
45
+ return decoded
46
+ .replace(/&/g, '&')
47
+ .replace(/</g, '&lt;')
48
+ .replace(/>/g, '&gt;')
49
+ .replace(/"/g, '&quot;')
50
+ .replace(/'/g, '&#039;')
51
+ .replace(/\u00A0/g, '&nbsp;'); // Handle non-breaking space
52
+ }
@@ -1,25 +0,0 @@
1
- /**
2
- * Normalizes HTML entities in a string by first decoding any double-encoded entities
3
- * and then properly encoding special characters
4
- * @param str The string to normalize
5
- * @returns The normalized string with properly encoded HTML entities
6
- */
7
- export const normalizeHtmlEntities = (str: string): string => {
8
- if (typeof str !== 'string') {
9
- return str;
10
- }
11
-
12
- // First decode any double-encoded entities
13
- const tempDiv = document.createElement('div');
14
- tempDiv.innerHTML = str;
15
- const decoded = tempDiv.textContent || tempDiv.innerText;
16
-
17
- // Then properly encode special characters
18
- return decoded
19
- .replace(/&/g, '&amp;')
20
- .replace(/</g, '&lt;')
21
- .replace(/>/g, '&gt;')
22
- .replace(/"/g, '&quot;')
23
- .replace(/'/g, '&#039;')
24
- .replace(/\u00A0/g, '&nbsp;'); // Handle non-breaking space
25
- };