@ones-editor/editor 2.1.7-beta.29 → 2.1.7-beta.30
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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +34 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -73865,6 +73865,30 @@ ${content}
|
|
|
73865
73865
|
function createGrid(table) {
|
|
73866
73866
|
return new HtmlTableGrid(table);
|
|
73867
73867
|
}
|
|
73868
|
+
function initColsWidth(table, cols) {
|
|
73869
|
+
const colsWidth = Array(cols).fill(0);
|
|
73870
|
+
const colgroup = table.querySelector("colgroup");
|
|
73871
|
+
if (!colgroup) {
|
|
73872
|
+
return colsWidth;
|
|
73873
|
+
}
|
|
73874
|
+
for (let i = 0; i < cols; i++) {
|
|
73875
|
+
const col = colgroup.children[i];
|
|
73876
|
+
if (col) {
|
|
73877
|
+
const widthStr = col.getAttribute("width") || col.style.width;
|
|
73878
|
+
if (widthStr) {
|
|
73879
|
+
if (widthStr.endsWith("%"))
|
|
73880
|
+
;
|
|
73881
|
+
else {
|
|
73882
|
+
const width = Number.parseInt(widthStr, 10);
|
|
73883
|
+
if (width) {
|
|
73884
|
+
colsWidth[i] = width;
|
|
73885
|
+
}
|
|
73886
|
+
}
|
|
73887
|
+
}
|
|
73888
|
+
}
|
|
73889
|
+
}
|
|
73890
|
+
return colsWidth;
|
|
73891
|
+
}
|
|
73868
73892
|
function tableElementToBlock(table, options) {
|
|
73869
73893
|
var _a;
|
|
73870
73894
|
const grid = createGrid(table);
|
|
@@ -73872,7 +73896,7 @@ ${content}
|
|
|
73872
73896
|
const spanData = {};
|
|
73873
73897
|
const rows = grid.rowCount;
|
|
73874
73898
|
const cols = grid.colCount;
|
|
73875
|
-
const colsWidth =
|
|
73899
|
+
const colsWidth = initColsWidth(table, cols);
|
|
73876
73900
|
for (let row = 0; row < rows; row++) {
|
|
73877
73901
|
for (let col = 0; col < cols; col++) {
|
|
73878
73902
|
let cellBlocks;
|
|
@@ -73900,13 +73924,17 @@ ${content}
|
|
|
73900
73924
|
spanData[`${id}_colSpan`] = colSpan;
|
|
73901
73925
|
}
|
|
73902
73926
|
options.doc.blocks[id] = cellBlocks;
|
|
73903
|
-
if (
|
|
73904
|
-
|
|
73927
|
+
if (colsWidth[col] === 0) {
|
|
73928
|
+
if (cellData && !cellData.virtual) {
|
|
73929
|
+
colsWidth[col] = Math.max(colsWidth[col], getBlocksWidth((_a = options.font) != null ? _a : "", cellBlocks));
|
|
73930
|
+
}
|
|
73905
73931
|
}
|
|
73906
73932
|
}
|
|
73907
73933
|
}
|
|
73908
73934
|
for (let i = 0; i < grid.colCount; i++) {
|
|
73909
|
-
colsWidth[i]
|
|
73935
|
+
if (colsWidth[i] === 0) {
|
|
73936
|
+
colsWidth[i] = grid.getColumnWidth(i) || colsWidth[i] || 100;
|
|
73937
|
+
}
|
|
73910
73938
|
}
|
|
73911
73939
|
if (children.length === 0) {
|
|
73912
73940
|
return [];
|
|
@@ -89177,7 +89205,7 @@ ${data2.flowchartText}
|
|
|
89177
89205
|
}
|
|
89178
89206
|
}
|
|
89179
89207
|
});
|
|
89180
|
-
editor.version = "2.1.7-beta.
|
|
89208
|
+
editor.version = "2.1.7-beta.30";
|
|
89181
89209
|
return editor;
|
|
89182
89210
|
}
|
|
89183
89211
|
function isDoc(doc2) {
|
|
@@ -89291,7 +89319,7 @@ ${data2.flowchartText}
|
|
|
89291
89319
|
}
|
|
89292
89320
|
}
|
|
89293
89321
|
OnesEditorToolbar.register(editor);
|
|
89294
|
-
editor.version = "2.1.7-beta.
|
|
89322
|
+
editor.version = "2.1.7-beta.30";
|
|
89295
89323
|
return editor;
|
|
89296
89324
|
}
|
|
89297
89325
|
async function showDocVersions(editor, options, serverUrl) {
|