@lvce-editor/preview-sandbox-worker 4.1.0 → 4.2.0
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.
|
@@ -1232,6 +1232,10 @@ const set$1 = (uid, instance) => {
|
|
|
1232
1232
|
states$1.set(uid, instance);
|
|
1233
1233
|
};
|
|
1234
1234
|
|
|
1235
|
+
const mergeClassNames = (...classNames) => {
|
|
1236
|
+
return classNames.filter(Boolean).join(' ');
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1235
1239
|
const text = data => {
|
|
1236
1240
|
return {
|
|
1237
1241
|
childCount: 0,
|
|
@@ -1240,6 +1244,8 @@ const text = data => {
|
|
|
1240
1244
|
};
|
|
1241
1245
|
};
|
|
1242
1246
|
|
|
1247
|
+
const Body = 'Body';
|
|
1248
|
+
|
|
1243
1249
|
const Div = 'div';
|
|
1244
1250
|
const H1 = 'h1';
|
|
1245
1251
|
const H2 = 'h2';
|
|
@@ -1552,6 +1558,15 @@ const serialize = (document, elementMap = Object.create(null)) => {
|
|
|
1552
1558
|
for (let i = 0; i < childNodes.length; i++) {
|
|
1553
1559
|
rootChildCount += serializeNode(childNodes[i], dom, css, context);
|
|
1554
1560
|
}
|
|
1561
|
+
const bodyNode = {
|
|
1562
|
+
childCount: rootChildCount,
|
|
1563
|
+
type: Div$1
|
|
1564
|
+
};
|
|
1565
|
+
if (document.body) {
|
|
1566
|
+
applyAllowedAttributes(bodyNode, document.body);
|
|
1567
|
+
}
|
|
1568
|
+
bodyNode.className = bodyNode.className ? mergeClassNames(Body, bodyNode.className) : Body;
|
|
1569
|
+
dom.unshift(bodyNode);
|
|
1555
1570
|
return {
|
|
1556
1571
|
css,
|
|
1557
1572
|
dom
|