@ones-editor/editor 0.0.7-beta.43 → 0.0.7-beta.46

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 CHANGED
@@ -47224,6 +47224,16 @@ $$${mathData.mathjaxText}$$
47224
47224
  const cjkCount = countCJKChars(text2);
47225
47225
  return text2.length + cjkCount;
47226
47226
  }
47227
+ function getCellColWidthByData(col, colSpan, colsWidth = []) {
47228
+ let width = 0;
47229
+ if (!colsWidth || colsWidth.length === 0) {
47230
+ return width;
47231
+ }
47232
+ for (let i = col; i < col + colSpan; i += 1) {
47233
+ width += colsWidth[i] || 0;
47234
+ }
47235
+ return width;
47236
+ }
47227
47237
  function padText(text2, length) {
47228
47238
  const textLength = getTextLengthWithCJK(text2);
47229
47239
  const paddingLength = length - textLength;
@@ -47233,6 +47243,7 @@ $$${mathData.mathjaxText}$$
47233
47243
  return text2;
47234
47244
  }
47235
47245
  function convertTo$d(editor, blockData, doc2, type, path) {
47246
+ var _a;
47236
47247
  const table = blockData;
47237
47248
  const grid = new DocTableGrid(table);
47238
47249
  if (type === "markdown" || type === "text") {
@@ -47315,14 +47326,16 @@ $$${mathData.mathjaxText}$$
47315
47326
  return lines2.join("\n");
47316
47327
  };
47317
47328
  const lines = [];
47318
- lines.push('<table style="border-collapse: collapse;">');
47329
+ const tableWidth = (_a = table.colsWidth) == null ? void 0 : _a.reduce((previousValue, currentValue) => previousValue + currentValue, 0).toString();
47330
+ lines.push(`<table style="border-collapse: collapse; min-width: ${tableWidth}">`);
47319
47331
  for (let row = 0; row < grid.rowCount; row++) {
47320
47332
  let rowText = "<tr>";
47321
47333
  for (let col = 0; col < grid.colCount; col++) {
47322
47334
  const cell = grid.getCell({ row, col });
47323
47335
  if (!cell.virtual) {
47324
47336
  const cellText = getContainerHtml(cell.containerId);
47325
- rowText += `<td colSpan="${cell.colSpan}" rowSpan="${cell.rowSpan}" style="border: 1px solid rgb(171, 171, 171); min-width: 20px">${cellText}</td>`;
47337
+ const width = getCellColWidthByData(col, cell.colSpan, table.colsWidth).toString() || "100";
47338
+ rowText += `<td colSpan="${cell.colSpan}" rowSpan="${cell.rowSpan}" data-width="${width}" style="padding: 8px; border: 1px solid rgb(171, 171, 171);">${cellText}</td>`;
47326
47339
  }
47327
47340
  }
47328
47341
  rowText += "</tr>";
@@ -55043,7 +55056,7 @@ ${codeText}
55043
55056
  if (!orderedList) {
55044
55057
  return 1;
55045
55058
  }
55046
- const startEl = elem.querySelector('[style="mso-list:Ignore"]');
55059
+ const startEl = elem.querySelector('[style^="mso-list:Ignore"]');
55047
55060
  if (startEl) {
55048
55061
  const startValue = startEl.innerText;
55049
55062
  if (startValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "0.0.7-beta.43",
3
+ "version": "0.0.7-beta.46",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",