@nerimity/html-embed 1.1.4 → 1.1.6
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/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/package.json +1 -1
- package/src/index.ts +8 -5
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqHA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.htmlToJson = htmlToJson;
|
|
7
7
|
const htm_1 = __importDefault(require("htm"));
|
|
8
8
|
const css_1 = __importDefault(require("css"));
|
|
9
|
-
const allowedTags = ['div', 'img', 'span', 'strong', 'a', "style"];
|
|
9
|
+
const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', 'strong', 'a', "style", "p", "ul", "li", "ol", "table", "thead", "tbody", "tr", "td", "th", "blockquote", "pre", "br"];
|
|
10
10
|
const allowedAttributes = ["href", "src", "color", "style", "class"];
|
|
11
11
|
const allowedCssProperties = [
|
|
12
12
|
"display",
|
|
@@ -49,6 +49,7 @@ const allowedCssProperties = [
|
|
|
49
49
|
"marginLeft",
|
|
50
50
|
"marginRight",
|
|
51
51
|
"flex",
|
|
52
|
+
"flexWrap",
|
|
52
53
|
"flexShrink",
|
|
53
54
|
"flexDirection",
|
|
54
55
|
"gap",
|
|
@@ -69,7 +70,12 @@ const allowedCssProperties = [
|
|
|
69
70
|
"verticalAlign",
|
|
70
71
|
"lineHeight",
|
|
71
72
|
"backdropFilter",
|
|
72
|
-
"backgroundClip"
|
|
73
|
+
"backgroundClip",
|
|
74
|
+
"cursor",
|
|
75
|
+
"overflowX",
|
|
76
|
+
"overflowY",
|
|
77
|
+
"userSelect",
|
|
78
|
+
"pointerEvents",
|
|
73
79
|
];
|
|
74
80
|
function h(tag, props, ...children) {
|
|
75
81
|
// check if tag is safe
|
|
@@ -92,7 +98,6 @@ function h(tag, props, ...children) {
|
|
|
92
98
|
const keyVal = style.split(":");
|
|
93
99
|
const key = keyVal[0].trim();
|
|
94
100
|
const value = keyVal[1].trim();
|
|
95
|
-
console.log(key, value);
|
|
96
101
|
if (key === "position" && value === "fixed") {
|
|
97
102
|
throw new Error(value + " value is not allowed for " + key + "!");
|
|
98
103
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import htm from 'htm';
|
|
|
2
2
|
import css from 'css';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
const allowedTags = ['div', 'img', 'span', 'strong', 'a', "style"]
|
|
5
|
+
const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', 'strong', 'a', "style", "p", "ul", "li", "ol", "table", "thead", "tbody", "tr", "td", "th", "blockquote", "pre", "br"]
|
|
6
6
|
const allowedAttributes = ["href", "src", "color", "style", "class"]
|
|
7
7
|
const allowedCssProperties = [
|
|
8
8
|
"display",
|
|
@@ -45,6 +45,7 @@ const allowedCssProperties = [
|
|
|
45
45
|
"marginLeft",
|
|
46
46
|
"marginRight",
|
|
47
47
|
"flex",
|
|
48
|
+
"flexWrap",
|
|
48
49
|
"flexShrink",
|
|
49
50
|
"flexDirection",
|
|
50
51
|
"gap",
|
|
@@ -65,9 +66,12 @@ const allowedCssProperties = [
|
|
|
65
66
|
"verticalAlign",
|
|
66
67
|
"lineHeight",
|
|
67
68
|
"backdropFilter",
|
|
68
|
-
"backgroundClip"
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
"backgroundClip",
|
|
70
|
+
"cursor",
|
|
71
|
+
"overflowX",
|
|
72
|
+
"overflowY",
|
|
73
|
+
"userSelect",
|
|
74
|
+
"pointerEvents",
|
|
71
75
|
]
|
|
72
76
|
|
|
73
77
|
|
|
@@ -91,7 +95,6 @@ function h(tag: string, props: any, ...children: any[]) {
|
|
|
91
95
|
const keyVal = style.split(":")
|
|
92
96
|
const key = keyVal[0].trim()
|
|
93
97
|
const value = keyVal[1].trim()
|
|
94
|
-
console.log(key, value)
|
|
95
98
|
if (key === "position" && value === "fixed") {
|
|
96
99
|
throw new Error(value + " value is not allowed for "+ key + "!")
|
|
97
100
|
}
|