@trafica/editor 1.0.26 → 1.0.28
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.js +16 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1627,7 +1627,7 @@ var htmlSerializer = {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
};
|
|
1629
1629
|
function serializeBlock(node, idCounts = /* @__PURE__ */ new Map()) {
|
|
1630
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
1630
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
1631
1631
|
switch (node.type) {
|
|
1632
1632
|
case "paragraph": {
|
|
1633
1633
|
const align = ((_a = node.attrs) == null ? void 0 : _a.align) ? ` data-align="${node.attrs.align}"` : "";
|
|
@@ -1683,23 +1683,29 @@ function serializeBlock(node, idCounts = /* @__PURE__ */ new Map()) {
|
|
|
1683
1683
|
return "<hr />";
|
|
1684
1684
|
case "table": {
|
|
1685
1685
|
const rows = node.children.map((c) => serializeBlock(c)).join("");
|
|
1686
|
-
|
|
1686
|
+
const colWidths = (_q = (_p = node.attrs) == null ? void 0 : _p.colWidths) != null ? _q : [];
|
|
1687
|
+
let colgroup = "";
|
|
1688
|
+
if (colWidths.length > 0) {
|
|
1689
|
+
const total = colWidths.reduce((s, w) => s + w, 0) || colWidths.length * 120;
|
|
1690
|
+
colgroup = `<colgroup>${colWidths.map((w) => `<col style="width:${(w / total * 100).toFixed(4)}%">`).join("")}</colgroup>`;
|
|
1691
|
+
}
|
|
1692
|
+
return `<div style="overflow-x:auto;margin:0.75em 0;"><table style="border-collapse:collapse;table-layout:fixed;width:100%;font-size:inherit;font-family:inherit;">${colgroup}<tbody>${rows}</tbody></table></div>`;
|
|
1687
1693
|
}
|
|
1688
1694
|
case "table_row": {
|
|
1689
1695
|
const cells = node.children.map((c) => serializeBlock(c)).join("");
|
|
1690
1696
|
return `<tr>${cells}</tr>`;
|
|
1691
1697
|
}
|
|
1692
1698
|
case "table_cell": {
|
|
1693
|
-
if ((
|
|
1694
|
-
const cs = ((
|
|
1695
|
-
const rs = ((
|
|
1696
|
-
return `<td${cs}${rs}>${serializeChildren(node.children)}</td>`;
|
|
1699
|
+
if ((_r = node.attrs) == null ? void 0 : _r.covered) return "";
|
|
1700
|
+
const cs = ((_s = node.attrs) == null ? void 0 : _s.colspan) > 1 ? ` colspan="${(_t = node.attrs) == null ? void 0 : _t.colspan}"` : "";
|
|
1701
|
+
const rs = ((_u = node.attrs) == null ? void 0 : _u.rowspan) > 1 ? ` rowspan="${(_v = node.attrs) == null ? void 0 : _v.rowspan}"` : "";
|
|
1702
|
+
return `<td${cs}${rs} style="border:1px solid #d1d5db;padding:0.5em 0.75em;vertical-align:top;min-width:40px;word-break:break-word;">${serializeChildren(node.children)}</td>`;
|
|
1697
1703
|
}
|
|
1698
1704
|
case "table_header": {
|
|
1699
|
-
if ((
|
|
1700
|
-
const cs = ((
|
|
1701
|
-
const rs = ((
|
|
1702
|
-
return `<th${cs}${rs}>${serializeChildren(node.children)}</th>`;
|
|
1705
|
+
if ((_w = node.attrs) == null ? void 0 : _w.covered) return "";
|
|
1706
|
+
const cs = ((_x = node.attrs) == null ? void 0 : _x.colspan) > 1 ? ` colspan="${(_y = node.attrs) == null ? void 0 : _y.colspan}"` : "";
|
|
1707
|
+
const rs = ((_z = node.attrs) == null ? void 0 : _z.rowspan) > 1 ? ` rowspan="${(_A = node.attrs) == null ? void 0 : _A.rowspan}"` : "";
|
|
1708
|
+
return `<th${cs}${rs} style="border:1px solid #d1d5db;padding:0.5em 0.75em;vertical-align:top;min-width:40px;word-break:break-word;background:#f9fafb;font-weight:600;text-align:left;">${serializeChildren(node.children)}</th>`;
|
|
1703
1709
|
}
|
|
1704
1710
|
default:
|
|
1705
1711
|
return `<p>${serializeChildren(node.children)}</p>`;
|