@etsoo/materialui 1.5.21 → 1.5.22
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.
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HTML element properties
|
|
3
|
+
* 自定义 HTML 元素属性
|
|
4
|
+
*/
|
|
5
|
+
export type HtmlDivProps = Omit<HTMLElement, "children"> & {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
1
8
|
/**
|
|
2
9
|
* Custom HTML element that sanitizes and displays HTML content
|
|
3
10
|
* 自定义 HTML 元素,用于清理和显示 HTML 内容
|
|
4
11
|
* @param props Properties
|
|
5
12
|
* @returns Component
|
|
6
13
|
*/
|
|
7
|
-
export declare function HtmlDiv(props:
|
|
14
|
+
export declare function HtmlDiv(props: HtmlDivProps): import("react/jsx-runtime").JSX.Element;
|
package/lib/cjs/html/HtmlDiv.js
CHANGED
|
@@ -17,6 +17,7 @@ class HtmlDivElement extends HTMLElement {
|
|
|
17
17
|
const wrapper = document.createElement("div");
|
|
18
18
|
if (this.textContent) {
|
|
19
19
|
wrapper.innerHTML = dompurify_1.default.sanitize(this.textContent);
|
|
20
|
+
this.textContent = null; // Clear the textContent to avoid duplication
|
|
20
21
|
}
|
|
21
22
|
shadow.appendChild(wrapper);
|
|
22
23
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HTML element properties
|
|
3
|
+
* 自定义 HTML 元素属性
|
|
4
|
+
*/
|
|
5
|
+
export type HtmlDivProps = Omit<HTMLElement, "children"> & {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
1
8
|
/**
|
|
2
9
|
* Custom HTML element that sanitizes and displays HTML content
|
|
3
10
|
* 自定义 HTML 元素,用于清理和显示 HTML 内容
|
|
4
11
|
* @param props Properties
|
|
5
12
|
* @returns Component
|
|
6
13
|
*/
|
|
7
|
-
export declare function HtmlDiv(props:
|
|
14
|
+
export declare function HtmlDiv(props: HtmlDivProps): import("react/jsx-runtime").JSX.Element;
|
package/lib/mjs/html/HtmlDiv.js
CHANGED
|
@@ -11,6 +11,7 @@ class HtmlDivElement extends HTMLElement {
|
|
|
11
11
|
const wrapper = document.createElement("div");
|
|
12
12
|
if (this.textContent) {
|
|
13
13
|
wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
|
|
14
|
+
this.textContent = null; // Clear the textContent to avoid duplication
|
|
14
15
|
}
|
|
15
16
|
shadow.appendChild(wrapper);
|
|
16
17
|
}
|
package/package.json
CHANGED
package/src/global.d.ts
CHANGED
package/src/html/HtmlDiv.tsx
CHANGED
|
@@ -13,6 +13,7 @@ class HtmlDivElement extends HTMLElement {
|
|
|
13
13
|
const wrapper = document.createElement("div");
|
|
14
14
|
if (this.textContent) {
|
|
15
15
|
wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
|
|
16
|
+
this.textContent = null; // Clear the textContent to avoid duplication
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
shadow.appendChild(wrapper);
|
|
@@ -24,13 +25,21 @@ if (!customElements.get("html-div")) {
|
|
|
24
25
|
customElements.define("html-div", HtmlDivElement);
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Custom HTML element properties
|
|
30
|
+
* 自定义 HTML 元素属性
|
|
31
|
+
*/
|
|
32
|
+
export type HtmlDivProps = Omit<HTMLElement, "children"> & {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
|
|
27
36
|
/**
|
|
28
37
|
* Custom HTML element that sanitizes and displays HTML content
|
|
29
38
|
* 自定义 HTML 元素,用于清理和显示 HTML 内容
|
|
30
39
|
* @param props Properties
|
|
31
40
|
* @returns Component
|
|
32
41
|
*/
|
|
33
|
-
export function HtmlDiv(props:
|
|
42
|
+
export function HtmlDiv(props: HtmlDivProps) {
|
|
34
43
|
// Destruct
|
|
35
44
|
const { children, ...rest } = props;
|
|
36
45
|
|