@cyberyozh/text-editor 0.1.7 → 0.1.8

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/render.js CHANGED
@@ -2224,10 +2224,24 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
2224
2224
 
2225
2225
  // src/extensions/views/components/table.tsx
2226
2226
  var import_jsx_runtime67 = require("react/jsx-runtime");
2227
- function Table({ children, colWidths = [] }) {
2227
+ function Table({ children }) {
2228
+ let colWidths = [];
2229
+ if (Array.isArray(children) && children.length > 0) {
2230
+ const firstRow = children[0];
2231
+ if (firstRow?.props?.children) {
2232
+ const cells = Array.isArray(firstRow.props.children) ? firstRow.props.children : [firstRow.props.children];
2233
+ colWidths = cells.map((cell) => cell?.props?.node?.attrs?.colwidth?.[0]).filter((width) => width !== void 0);
2234
+ }
2235
+ }
2228
2236
  const tableWidth = colWidths.length > 0 ? colWidths.reduce((total, width) => total + width, 0) : null;
2229
2237
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "tableWrapper", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("table", { style: tableWidth ? { width: `${tableWidth}px` } : void 0, children: [
2230
- colWidths.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("colgroup", { children: colWidths.map((width, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("col", { style: { width: `${width}px` } }, index)) }),
2238
+ colWidths.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("colgroup", { children: colWidths.map((width, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2239
+ "col",
2240
+ {
2241
+ style: { width: `${width}px` }
2242
+ },
2243
+ index
2244
+ )) }),
2231
2245
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { children })
2232
2246
  ] }) });
2233
2247
  }
@@ -2394,15 +2408,7 @@ var getNodeMapping = (getImageById) => ({
2394
2408
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Video, { src: node.attrs.src });
2395
2409
  },
2396
2410
  table({ children }) {
2397
- let colWidths = [];
2398
- if (Array.isArray(children) && children.length > 0) {
2399
- const firstRow = children[0];
2400
- if (firstRow?.props?.children) {
2401
- const cells = Array.isArray(firstRow.props.children) ? firstRow.props.children : [firstRow.props.children];
2402
- colWidths = cells.map((cell) => cell?.props?.node?.attrs?.colwidth?.[0]).filter((width) => width !== void 0);
2403
- }
2404
- }
2405
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Table, { colWidths, children });
2411
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Table, { children });
2406
2412
  },
2407
2413
  figure({ node }) {
2408
2414
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(