@qwickapps/react-framework 1.5.9 → 1.5.11
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/components/SafeSpan.d.ts.map +1 -1
- package/dist/index.esm.js +16 -6
- package/dist/index.js +16 -6
- package/dist/palettes/manifest.json +19 -19
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/SafeSpan.tsx +5 -2
- package/src/schemas/transformers/ComponentTransformer.ts +11 -2
- /package/dist/palettes/{palette-autumn.1.5.9.css → palette-autumn.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-autumn.1.5.9.min.css → palette-autumn.1.5.11.min.css} +0 -0
- /package/dist/palettes/{palette-cosmic.1.5.9.css → palette-cosmic.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-cosmic.1.5.9.min.css → palette-cosmic.1.5.11.min.css} +0 -0
- /package/dist/palettes/{palette-default.1.5.9.css → palette-default.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-default.1.5.9.min.css → palette-default.1.5.11.min.css} +0 -0
- /package/dist/palettes/{palette-ocean.1.5.9.css → palette-ocean.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-ocean.1.5.9.min.css → palette-ocean.1.5.11.min.css} +0 -0
- /package/dist/palettes/{palette-spring.1.5.9.css → palette-spring.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-spring.1.5.9.min.css → palette-spring.1.5.11.min.css} +0 -0
- /package/dist/palettes/{palette-winter.1.5.9.css → palette-winter.1.5.11.css} +0 -0
- /package/dist/palettes/{palette-winter.1.5.9.min.css → palette-winter.1.5.11.min.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeSpan.d.ts","sourceRoot":"","sources":["../../src/components/SafeSpan.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,KAAK,iBAAiB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AACpD,MAAM,WAAW,aAAc,SAAQ,iBAAiB,EAAE,eAAe;CAAG;
|
|
1
|
+
{"version":3,"file":"SafeSpan.d.ts","sourceRoot":"","sources":["../../src/components/SafeSpan.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,KAAK,iBAAiB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AACpD,MAAM,WAAW,aAAc,SAAQ,iBAAiB,EAAE,eAAe;CAAG;AAgF5E,qBAAa,QAAS,SAAQ,SAAS,CAAC,aAAa,CAAC;IAEpD,MAAM,CAAC,QAAQ,CAAC,OAAO,cAAc;IACrC,MAAM,CAAC,QAAQ,CAAC,OAAO,WAAW;IAGlC,SAAS,CAAC,yBAAyB,IAAI,OAAO;IAQ9C,SAAS,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY;IAM1C,SAAS,CAAC,qBAAqB,IAAI,KAAK,CAAC,YAAY;IAKrD,MAAM,CAAC,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAevD,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAWjC;AA4BD,eAAe,QAAQ,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -16804,7 +16804,7 @@ function SafeSpanView(props) {
|
|
|
16804
16804
|
});
|
|
16805
16805
|
// Enhanced HTML sanitization with strict security configuration
|
|
16806
16806
|
const sanitizeOptions = {
|
|
16807
|
-
allowedTags: ['p', 'br', 'strong', 'em', 'u', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img'],
|
|
16807
|
+
allowedTags: ['p', 'br', 'strong', 'em', 'u', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td'],
|
|
16808
16808
|
allowedAttributes: {
|
|
16809
16809
|
'a': ['href', 'title', 'target'],
|
|
16810
16810
|
'img': ['src', 'alt', 'title', 'width', 'height'],
|
|
@@ -16852,7 +16852,10 @@ function SafeSpanView(props) {
|
|
|
16852
16852
|
});
|
|
16853
16853
|
}
|
|
16854
16854
|
// Render sanitized HTML content
|
|
16855
|
-
|
|
16855
|
+
// Use div instead of span to allow block-level elements like <hr>, <table>, etc.
|
|
16856
|
+
// This prevents React error #137 (invalid element nesting) when HTML contains
|
|
16857
|
+
// block elements from markdown (e.g., --- becomes <hr>)
|
|
16858
|
+
return jsx("div", {
|
|
16856
16859
|
...htmlProps,
|
|
16857
16860
|
...styleProps,
|
|
16858
16861
|
dangerouslySetInnerHTML: {
|
|
@@ -18824,16 +18827,23 @@ let ComponentTransformer$1 = class ComponentTransformer {
|
|
|
18824
18827
|
}, transformedChildren);
|
|
18825
18828
|
}
|
|
18826
18829
|
// Fallback - use ReactNodeTransformer to handle as unregistered HTML
|
|
18830
|
+
const tagName = element.tagName.toLowerCase();
|
|
18831
|
+
// Void elements (self-closing tags) cannot have innerHTML
|
|
18832
|
+
// https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
18833
|
+
const voidElements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
18834
|
+
const isVoidElement = voidElements.includes(tagName);
|
|
18827
18835
|
return ReactNodeTransformer.deserialize({
|
|
18828
18836
|
type: 'react-element',
|
|
18829
|
-
elementType:
|
|
18837
|
+
elementType: tagName,
|
|
18830
18838
|
props: {
|
|
18831
18839
|
key,
|
|
18832
18840
|
className: element.className || undefined,
|
|
18833
18841
|
id: element.id || undefined,
|
|
18834
|
-
|
|
18835
|
-
|
|
18836
|
-
|
|
18842
|
+
...(isVoidElement ? {} : {
|
|
18843
|
+
dangerouslySetInnerHTML: {
|
|
18844
|
+
__html: element.innerHTML
|
|
18845
|
+
}
|
|
18846
|
+
})
|
|
18837
18847
|
}
|
|
18838
18848
|
});
|
|
18839
18849
|
}
|
package/dist/index.js
CHANGED
|
@@ -16806,7 +16806,7 @@ function SafeSpanView(props) {
|
|
|
16806
16806
|
});
|
|
16807
16807
|
// Enhanced HTML sanitization with strict security configuration
|
|
16808
16808
|
const sanitizeOptions = {
|
|
16809
|
-
allowedTags: ['p', 'br', 'strong', 'em', 'u', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img'],
|
|
16809
|
+
allowedTags: ['p', 'br', 'strong', 'em', 'u', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td'],
|
|
16810
16810
|
allowedAttributes: {
|
|
16811
16811
|
'a': ['href', 'title', 'target'],
|
|
16812
16812
|
'img': ['src', 'alt', 'title', 'width', 'height'],
|
|
@@ -16854,7 +16854,10 @@ function SafeSpanView(props) {
|
|
|
16854
16854
|
});
|
|
16855
16855
|
}
|
|
16856
16856
|
// Render sanitized HTML content
|
|
16857
|
-
|
|
16857
|
+
// Use div instead of span to allow block-level elements like <hr>, <table>, etc.
|
|
16858
|
+
// This prevents React error #137 (invalid element nesting) when HTML contains
|
|
16859
|
+
// block elements from markdown (e.g., --- becomes <hr>)
|
|
16860
|
+
return jsxRuntime.jsx("div", {
|
|
16858
16861
|
...htmlProps,
|
|
16859
16862
|
...styleProps,
|
|
16860
16863
|
dangerouslySetInnerHTML: {
|
|
@@ -18826,16 +18829,23 @@ let ComponentTransformer$1 = class ComponentTransformer {
|
|
|
18826
18829
|
}, transformedChildren);
|
|
18827
18830
|
}
|
|
18828
18831
|
// Fallback - use ReactNodeTransformer to handle as unregistered HTML
|
|
18832
|
+
const tagName = element.tagName.toLowerCase();
|
|
18833
|
+
// Void elements (self-closing tags) cannot have innerHTML
|
|
18834
|
+
// https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
18835
|
+
const voidElements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
18836
|
+
const isVoidElement = voidElements.includes(tagName);
|
|
18829
18837
|
return ReactNodeTransformer.deserialize({
|
|
18830
18838
|
type: 'react-element',
|
|
18831
|
-
elementType:
|
|
18839
|
+
elementType: tagName,
|
|
18832
18840
|
props: {
|
|
18833
18841
|
key,
|
|
18834
18842
|
className: element.className || undefined,
|
|
18835
18843
|
id: element.id || undefined,
|
|
18836
|
-
|
|
18837
|
-
|
|
18838
|
-
|
|
18844
|
+
...(isVoidElement ? {} : {
|
|
18845
|
+
dangerouslySetInnerHTML: {
|
|
18846
|
+
__html: element.innerHTML
|
|
18847
|
+
}
|
|
18848
|
+
})
|
|
18839
18849
|
}
|
|
18840
18850
|
});
|
|
18841
18851
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./manifest.schema.json",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.11",
|
|
4
4
|
"palettes": [
|
|
5
5
|
{
|
|
6
6
|
"id": "default",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"description": "Classic blue and neutral color scheme - the original QwickApps palette",
|
|
9
9
|
"author": "QwickApps",
|
|
10
10
|
"license": "PolyForm-Shield-1.0.0",
|
|
11
|
-
"version": "1.5.
|
|
12
|
-
"file": "palette-default.1.5.
|
|
11
|
+
"version": "1.5.11",
|
|
12
|
+
"file": "palette-default.1.5.11.css",
|
|
13
13
|
"primaryColor": "#007bff",
|
|
14
14
|
"inlined": true,
|
|
15
|
-
"fileMinified": "palette-default.1.5.
|
|
15
|
+
"fileMinified": "palette-default.1.5.11.min.css",
|
|
16
16
|
"fileLatest": "palette-default.latest.css",
|
|
17
17
|
"fileLatestMinified": "palette-default.latest.min.css"
|
|
18
18
|
},
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"description": "Warm oranges, golden yellows, and earthy browns - inspired by fall foliage",
|
|
23
23
|
"author": "QwickApps",
|
|
24
24
|
"license": "PolyForm-Shield-1.0.0",
|
|
25
|
-
"version": "1.5.
|
|
26
|
-
"file": "palette-autumn.1.5.
|
|
25
|
+
"version": "1.5.11",
|
|
26
|
+
"file": "palette-autumn.1.5.11.css",
|
|
27
27
|
"primaryColor": "#ea580c",
|
|
28
28
|
"inlined": false,
|
|
29
|
-
"fileMinified": "palette-autumn.1.5.
|
|
29
|
+
"fileMinified": "palette-autumn.1.5.11.min.css",
|
|
30
30
|
"fileLatest": "palette-autumn.latest.css",
|
|
31
31
|
"fileLatestMinified": "palette-autumn.latest.min.css"
|
|
32
32
|
},
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"description": "Modern purple gradient for creative and tech brands - inspired by cosmic nebulae",
|
|
37
37
|
"author": "QwickApps",
|
|
38
38
|
"license": "PolyForm-Shield-1.0.0",
|
|
39
|
-
"version": "1.5.
|
|
40
|
-
"file": "palette-cosmic.1.5.
|
|
39
|
+
"version": "1.5.11",
|
|
40
|
+
"file": "palette-cosmic.1.5.11.css",
|
|
41
41
|
"primaryColor": "#8b5cf6",
|
|
42
42
|
"inlined": false,
|
|
43
|
-
"fileMinified": "palette-cosmic.1.5.
|
|
43
|
+
"fileMinified": "palette-cosmic.1.5.11.min.css",
|
|
44
44
|
"fileLatest": "palette-cosmic.latest.css",
|
|
45
45
|
"fileLatestMinified": "palette-cosmic.latest.min.css"
|
|
46
46
|
},
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"description": "Deep blues, aqua teals, and seafoam greens - inspired by ocean depths",
|
|
51
51
|
"author": "QwickApps",
|
|
52
52
|
"license": "PolyForm-Shield-1.0.0",
|
|
53
|
-
"version": "1.5.
|
|
54
|
-
"file": "palette-ocean.1.5.
|
|
53
|
+
"version": "1.5.11",
|
|
54
|
+
"file": "palette-ocean.1.5.11.css",
|
|
55
55
|
"primaryColor": "#0891b2",
|
|
56
56
|
"inlined": false,
|
|
57
|
-
"fileMinified": "palette-ocean.1.5.
|
|
57
|
+
"fileMinified": "palette-ocean.1.5.11.min.css",
|
|
58
58
|
"fileLatest": "palette-ocean.latest.css",
|
|
59
59
|
"fileLatestMinified": "palette-ocean.latest.min.css"
|
|
60
60
|
},
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"description": "Fresh greens, soft pinks, and bright yellows - inspired by spring blooms",
|
|
65
65
|
"author": "QwickApps",
|
|
66
66
|
"license": "PolyForm-Shield-1.0.0",
|
|
67
|
-
"version": "1.5.
|
|
68
|
-
"file": "palette-spring.1.5.
|
|
67
|
+
"version": "1.5.11",
|
|
68
|
+
"file": "palette-spring.1.5.11.css",
|
|
69
69
|
"primaryColor": "#16a34a",
|
|
70
70
|
"inlined": false,
|
|
71
|
-
"fileMinified": "palette-spring.1.5.
|
|
71
|
+
"fileMinified": "palette-spring.1.5.11.min.css",
|
|
72
72
|
"fileLatest": "palette-spring.latest.css",
|
|
73
73
|
"fileLatestMinified": "palette-spring.latest.min.css"
|
|
74
74
|
},
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"description": "Cool blues, icy whites, and frosty grays - inspired by winter landscapes",
|
|
79
79
|
"author": "QwickApps",
|
|
80
80
|
"license": "PolyForm-Shield-1.0.0",
|
|
81
|
-
"version": "1.5.
|
|
82
|
-
"file": "palette-winter.1.5.
|
|
81
|
+
"version": "1.5.11",
|
|
82
|
+
"file": "palette-winter.1.5.11.css",
|
|
83
83
|
"primaryColor": "#0077be",
|
|
84
84
|
"inlined": false,
|
|
85
|
-
"fileMinified": "palette-winter.1.5.
|
|
85
|
+
"fileMinified": "palette-winter.1.5.11.min.css",
|
|
86
86
|
"fileLatest": "palette-winter.latest.css",
|
|
87
87
|
"fileLatestMinified": "palette-winter.latest.min.css"
|
|
88
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentTransformer.d.ts","sourceRoot":"","sources":["../../../src/schemas/transformers/ComponentTransformer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAc,EAAE,SAAS,EAAgB,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAchE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAc3D;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C;;;OAGG;IACH,MAAM,CAAC,YAAY,IAAI,OAAO;IAI9B;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,cAAc,EAAE,uBAAuB,GAAG,IAAI;IA4BvE;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM;IAKvD;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE;IAe9E;;;;KAIC;IACD,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAmD9B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAkE5B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,gCAAgC;IAI/C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IA4BtC;;;OAGG;IACH,MAAM,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAI1C;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,IAAI;IAO5B;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI;IAOtE;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI3C;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAe/D;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE;IAS/C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"ComponentTransformer.d.ts","sourceRoot":"","sources":["../../../src/schemas/transformers/ComponentTransformer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAc,EAAE,SAAS,EAAgB,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAchE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAc3D;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C;;;OAGG;IACH,MAAM,CAAC,YAAY,IAAI,OAAO;IAI9B;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,cAAc,EAAE,uBAAuB,GAAG,IAAI;IA4BvE;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM;IAKvD;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE;IAe9E;;;;KAIC;IACD,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAmD9B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAkE5B;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,gCAAgC;IAI/C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IA4BtC;;;OAGG;IACH,MAAM,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAI1C;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,IAAI;IAO5B;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI;IAOtE;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI3C;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAe/D;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE;IAS/C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IA+C/B;;;OAGG;IACH,MAAM,CAAC,qBAAqB,IAAI,MAAM,EAAE;CAGzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwickapps/react-framework",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.11",
|
|
4
4
|
"description": "Complete React framework with responsive navigation, flexible layouts, theming system, and reusable components for building modern applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -32,7 +32,7 @@ function SafeSpanView(props: SafeSpanViewProps) {
|
|
|
32
32
|
const sanitizeOptions = {
|
|
33
33
|
allowedTags: [
|
|
34
34
|
'p', 'br', 'strong', 'em', 'u', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
35
|
-
'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img'
|
|
35
|
+
'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'a', 'img', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td'
|
|
36
36
|
],
|
|
37
37
|
allowedAttributes: {
|
|
38
38
|
'a': ['href', 'title', 'target'],
|
|
@@ -85,8 +85,11 @@ function SafeSpanView(props: SafeSpanViewProps) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// Render sanitized HTML content
|
|
88
|
+
// Use div instead of span to allow block-level elements like <hr>, <table>, etc.
|
|
89
|
+
// This prevents React error #137 (invalid element nesting) when HTML contains
|
|
90
|
+
// block elements from markdown (e.g., --- becomes <hr>)
|
|
88
91
|
return (
|
|
89
|
-
<
|
|
92
|
+
<div
|
|
90
93
|
{...htmlProps}
|
|
91
94
|
{...styleProps}
|
|
92
95
|
dangerouslySetInnerHTML={{ __html: sanitizedHtml }}
|
|
@@ -414,14 +414,23 @@ export class ComponentTransformer {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
// Fallback - use ReactNodeTransformer to handle as unregistered HTML
|
|
417
|
+
const tagName = element.tagName.toLowerCase();
|
|
418
|
+
|
|
419
|
+
// Void elements (self-closing tags) cannot have innerHTML
|
|
420
|
+
// https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
421
|
+
const voidElements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
|
|
422
|
+
'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
423
|
+
|
|
424
|
+
const isVoidElement = voidElements.includes(tagName);
|
|
425
|
+
|
|
417
426
|
return ReactNodeTransformer.deserialize({
|
|
418
427
|
type: 'react-element',
|
|
419
|
-
elementType:
|
|
428
|
+
elementType: tagName,
|
|
420
429
|
props: {
|
|
421
430
|
key,
|
|
422
431
|
className: element.className || undefined,
|
|
423
432
|
id: element.id || undefined,
|
|
424
|
-
dangerouslySetInnerHTML: { __html: element.innerHTML }
|
|
433
|
+
...(isVoidElement ? {} : { dangerouslySetInnerHTML: { __html: element.innerHTML } })
|
|
425
434
|
}
|
|
426
435
|
});
|
|
427
436
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|