@harbour-enterprises/superdoc 0.24.0-next.4 → 0.24.0-next.6
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/chunks/{PdfViewer-D7C8g2G4.es.js → PdfViewer-BiHh3x6b.es.js} +1 -1
- package/dist/chunks/{PdfViewer-kOVuv-4I.cjs → PdfViewer-qk_hITc5.cjs} +1 -1
- package/dist/chunks/{index-BFKwBQjS.cjs → index-Di6nG2sc.cjs} +66 -10
- package/dist/chunks/{index-CnEAVnHQ.es.js → index-aMnFs35I.es.js} +66 -10
- package/dist/chunks/{super-editor.es-BmGTQ05x.cjs → super-editor.es-BKZvTraR.cjs} +579 -137
- package/dist/chunks/{super-editor.es-CBPoWvjs.es.js → super-editor.es-Dz7y81Yr.es.js} +579 -137
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/helpers/export.d.ts +1 -1
- package/dist/core/helpers/export.d.ts.map +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +10 -0
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DpPj67OW.js → converter-CI3WqmGV.js} +514 -197
- package/dist/super-editor/chunks/{docx-zipper-6Kc95yG-.js → docx-zipper-D4fk50d9.js} +1 -1
- package/dist/super-editor/chunks/{editor-Dx6AhT5N.js → editor-DC6pZVp1.js} +170 -43
- package/dist/super-editor/chunks/{toolbar-CXSg2lJ9.js → toolbar-DMobfM6u.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +10 -0
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-helpers.d.ts +16 -0
- package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +1 -1
- package/dist/super-editor/super-editor.es.js +7 -7
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +643 -145
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -15074,6 +15074,7 @@ async function readFromClipboard(state2) {
|
|
|
15074
15074
|
}
|
|
15075
15075
|
return content;
|
|
15076
15076
|
}
|
|
15077
|
+
const PIXELS_PER_INCH = 96;
|
|
15077
15078
|
function inchesToTwips(inches) {
|
|
15078
15079
|
if (inches == null) return;
|
|
15079
15080
|
if (typeof inches === "string") inches = parseFloat(inches);
|
|
@@ -15096,12 +15097,12 @@ function pixelsToTwips(pixels) {
|
|
|
15096
15097
|
}
|
|
15097
15098
|
function inchesToPixels(inches) {
|
|
15098
15099
|
if (inches == null) return;
|
|
15099
|
-
const pixels = inches *
|
|
15100
|
+
const pixels = inches * PIXELS_PER_INCH;
|
|
15100
15101
|
return Math.round(pixels * 1e3) / 1e3;
|
|
15101
15102
|
}
|
|
15102
15103
|
function pixelsToInches(pixels) {
|
|
15103
15104
|
if (pixels == null) return;
|
|
15104
|
-
const inches = Number(pixels) /
|
|
15105
|
+
const inches = Number(pixels) / PIXELS_PER_INCH;
|
|
15105
15106
|
return inches;
|
|
15106
15107
|
}
|
|
15107
15108
|
function twipsToLines(twips) {
|
|
@@ -15119,7 +15120,7 @@ function halfPointToPoints(halfPoints) {
|
|
|
15119
15120
|
function emuToPixels(emu) {
|
|
15120
15121
|
if (emu == null) return;
|
|
15121
15122
|
if (typeof emu === "string") emu = parseFloat(emu);
|
|
15122
|
-
const pixels = emu *
|
|
15123
|
+
const pixels = emu * PIXELS_PER_INCH / 914400;
|
|
15123
15124
|
return Math.round(pixels);
|
|
15124
15125
|
}
|
|
15125
15126
|
function pixelsToEmu(px) {
|
|
@@ -15155,12 +15156,12 @@ function degreesToRot(degrees) {
|
|
|
15155
15156
|
}
|
|
15156
15157
|
function pixelsToPolygonUnits(pixels) {
|
|
15157
15158
|
if (pixels == null) return;
|
|
15158
|
-
const pu = pixels *
|
|
15159
|
+
const pu = pixels * PIXELS_PER_INCH;
|
|
15159
15160
|
return Math.round(pu);
|
|
15160
15161
|
}
|
|
15161
15162
|
function polygonUnitsToPixels(pu) {
|
|
15162
15163
|
if (pu == null) return;
|
|
15163
|
-
const pixels = Number(pu) /
|
|
15164
|
+
const pixels = Number(pu) / PIXELS_PER_INCH;
|
|
15164
15165
|
return Math.round(pixels * 1e3) / 1e3;
|
|
15165
15166
|
}
|
|
15166
15167
|
function polygonToObj(polygonNode) {
|
|
@@ -27045,6 +27046,68 @@ const translator$_ = NodeTranslator.from(
|
|
|
27045
27046
|
repeatHeader: false
|
|
27046
27047
|
})
|
|
27047
27048
|
);
|
|
27049
|
+
const createPlaceholderCell = (gridWidth, reason) => {
|
|
27050
|
+
const safeWidth = Number.isFinite(gridWidth) ? gridWidth : 0;
|
|
27051
|
+
const noBorder = { val: "none", size: 0 };
|
|
27052
|
+
return {
|
|
27053
|
+
type: "tableCell",
|
|
27054
|
+
attrs: {
|
|
27055
|
+
colspan: 1,
|
|
27056
|
+
rowspan: 1,
|
|
27057
|
+
colwidth: [safeWidth],
|
|
27058
|
+
__placeholder: reason,
|
|
27059
|
+
borders: {
|
|
27060
|
+
top: { ...noBorder },
|
|
27061
|
+
right: { ...noBorder },
|
|
27062
|
+
bottom: { ...noBorder },
|
|
27063
|
+
left: { ...noBorder }
|
|
27064
|
+
}
|
|
27065
|
+
},
|
|
27066
|
+
content: [{ type: "paragraph", content: [] }]
|
|
27067
|
+
};
|
|
27068
|
+
};
|
|
27069
|
+
const advancePastRowSpans = (pendingRowSpans, startIndex, totalColumns) => {
|
|
27070
|
+
let index2 = startIndex;
|
|
27071
|
+
while (index2 < totalColumns && pendingRowSpans[index2] > 0) {
|
|
27072
|
+
pendingRowSpans[index2] -= 1;
|
|
27073
|
+
index2 += 1;
|
|
27074
|
+
}
|
|
27075
|
+
return index2;
|
|
27076
|
+
};
|
|
27077
|
+
const fillPlaceholderColumns = ({
|
|
27078
|
+
content,
|
|
27079
|
+
pendingRowSpans,
|
|
27080
|
+
currentIndex,
|
|
27081
|
+
targetIndex,
|
|
27082
|
+
totalColumns,
|
|
27083
|
+
gridColumnWidths,
|
|
27084
|
+
reason
|
|
27085
|
+
}) => {
|
|
27086
|
+
let index2 = currentIndex;
|
|
27087
|
+
while (index2 < targetIndex && index2 < totalColumns) {
|
|
27088
|
+
if (pendingRowSpans[index2] > 0) {
|
|
27089
|
+
pendingRowSpans[index2] -= 1;
|
|
27090
|
+
index2 += 1;
|
|
27091
|
+
continue;
|
|
27092
|
+
}
|
|
27093
|
+
const width = Array.isArray(gridColumnWidths) ? gridColumnWidths[index2] ?? 0 : 0;
|
|
27094
|
+
content.push(createPlaceholderCell(width, reason));
|
|
27095
|
+
index2 += 1;
|
|
27096
|
+
}
|
|
27097
|
+
return index2;
|
|
27098
|
+
};
|
|
27099
|
+
const isPlaceholderCell = (cell) => {
|
|
27100
|
+
if (!cell) return false;
|
|
27101
|
+
if (cell.attrs?.__placeholder) return true;
|
|
27102
|
+
const widths = cell.attrs?.colwidth;
|
|
27103
|
+
if (Array.isArray(widths) && widths.length > 0) {
|
|
27104
|
+
const hasMeaningfulWidth = widths.some(
|
|
27105
|
+
(value) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) > 1
|
|
27106
|
+
);
|
|
27107
|
+
if (!hasMeaningfulWidth) return true;
|
|
27108
|
+
}
|
|
27109
|
+
return false;
|
|
27110
|
+
};
|
|
27048
27111
|
const XML_NODE_NAME$h = "w:tr";
|
|
27049
27112
|
const SD_NODE_NAME$d = "tableRow";
|
|
27050
27113
|
const validXmlAttributes$b = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
@@ -27060,29 +27123,64 @@ const encode$n = (params, encodedAttrs) => {
|
|
|
27060
27123
|
nodes: [tPr]
|
|
27061
27124
|
});
|
|
27062
27125
|
}
|
|
27126
|
+
const gridBeforeRaw = tableRowProperties?.["gridBefore"];
|
|
27127
|
+
const safeGridBefore = typeof gridBeforeRaw === "number" && Number.isFinite(gridBeforeRaw) && gridBeforeRaw > 0 ? gridBeforeRaw : 0;
|
|
27063
27128
|
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
27064
27129
|
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
27065
27130
|
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
27066
|
-
const { columnWidths: gridColumnWidths } = params.extraParams;
|
|
27131
|
+
const { columnWidths: gridColumnWidths, activeRowSpans = [] } = params.extraParams;
|
|
27132
|
+
const totalColumns = Array.isArray(gridColumnWidths) ? gridColumnWidths.length : 0;
|
|
27133
|
+
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
27134
|
+
while (pendingRowSpans.length < totalColumns) pendingRowSpans.push(0);
|
|
27067
27135
|
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
27136
|
+
const content = [];
|
|
27068
27137
|
let currentColumnIndex = 0;
|
|
27069
|
-
const
|
|
27070
|
-
|
|
27138
|
+
const fillUntil = (target, reason) => {
|
|
27139
|
+
currentColumnIndex = fillPlaceholderColumns({
|
|
27140
|
+
content,
|
|
27141
|
+
pendingRowSpans,
|
|
27142
|
+
currentIndex: currentColumnIndex,
|
|
27143
|
+
targetIndex: target,
|
|
27144
|
+
totalColumns,
|
|
27145
|
+
gridColumnWidths,
|
|
27146
|
+
reason
|
|
27147
|
+
});
|
|
27148
|
+
};
|
|
27149
|
+
const skipOccupiedColumns = () => {
|
|
27150
|
+
currentColumnIndex = advancePastRowSpans(pendingRowSpans, currentColumnIndex, totalColumns);
|
|
27151
|
+
};
|
|
27152
|
+
fillUntil(safeGridBefore, "gridBefore");
|
|
27153
|
+
skipOccupiedColumns();
|
|
27154
|
+
cellNodes?.forEach((node) => {
|
|
27155
|
+
skipOccupiedColumns();
|
|
27156
|
+
const startColumn = currentColumnIndex;
|
|
27157
|
+
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
27071
27158
|
const result = translator$c.encode({
|
|
27072
27159
|
...params,
|
|
27073
27160
|
extraParams: {
|
|
27074
27161
|
...params.extraParams,
|
|
27075
|
-
node
|
|
27076
|
-
columnIndex:
|
|
27162
|
+
node,
|
|
27163
|
+
columnIndex: startColumn,
|
|
27077
27164
|
columnWidth
|
|
27078
27165
|
}
|
|
27079
27166
|
});
|
|
27080
|
-
|
|
27081
|
-
|
|
27082
|
-
|
|
27083
|
-
|
|
27084
|
-
|
|
27085
|
-
|
|
27167
|
+
if (result) {
|
|
27168
|
+
content.push(result);
|
|
27169
|
+
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
27170
|
+
const rowspan = Math.max(1, result.attrs?.rowspan || 1);
|
|
27171
|
+
if (rowspan > 1) {
|
|
27172
|
+
for (let offset = 0; offset < colspan; offset += 1) {
|
|
27173
|
+
const target = startColumn + offset;
|
|
27174
|
+
if (target < pendingRowSpans.length) {
|
|
27175
|
+
pendingRowSpans[target] = Math.max(pendingRowSpans[target], rowspan - 1);
|
|
27176
|
+
}
|
|
27177
|
+
}
|
|
27178
|
+
}
|
|
27179
|
+
currentColumnIndex = startColumn + colspan;
|
|
27180
|
+
}
|
|
27181
|
+
});
|
|
27182
|
+
skipOccupiedColumns();
|
|
27183
|
+
fillUntil(totalColumns, "gridAfter");
|
|
27086
27184
|
const newNode = {
|
|
27087
27185
|
type: "tableRow",
|
|
27088
27186
|
content,
|
|
@@ -27092,9 +27190,37 @@ const encode$n = (params, encodedAttrs) => {
|
|
|
27092
27190
|
};
|
|
27093
27191
|
const decode$p = (params, decodedAttrs) => {
|
|
27094
27192
|
const { node } = params;
|
|
27095
|
-
const
|
|
27193
|
+
const cells = node.content || [];
|
|
27194
|
+
let leadingPlaceholders = 0;
|
|
27195
|
+
while (leadingPlaceholders < cells.length && isPlaceholderCell(cells[leadingPlaceholders])) {
|
|
27196
|
+
leadingPlaceholders += 1;
|
|
27197
|
+
}
|
|
27198
|
+
let trailingPlaceholders = 0;
|
|
27199
|
+
while (trailingPlaceholders < cells.length - leadingPlaceholders && isPlaceholderCell(cells[cells.length - 1 - trailingPlaceholders])) {
|
|
27200
|
+
trailingPlaceholders += 1;
|
|
27201
|
+
}
|
|
27202
|
+
const trimmedSlice = cells.slice(leadingPlaceholders, cells.length - trailingPlaceholders);
|
|
27203
|
+
const sanitizedCells = trimmedSlice.map((cell) => {
|
|
27204
|
+
if (cell?.attrs && "__placeholder" in cell.attrs) {
|
|
27205
|
+
const { __placeholder, ...rest } = cell.attrs;
|
|
27206
|
+
return { ...cell, attrs: rest };
|
|
27207
|
+
}
|
|
27208
|
+
return cell;
|
|
27209
|
+
});
|
|
27210
|
+
const trimmedContent = sanitizedCells.filter((_2, index2) => !isPlaceholderCell(trimmedSlice[index2]));
|
|
27211
|
+
const translateParams = {
|
|
27212
|
+
...params,
|
|
27213
|
+
node: { ...node, content: trimmedContent }
|
|
27214
|
+
};
|
|
27215
|
+
const elements = translateChildNodes(translateParams);
|
|
27096
27216
|
if (node.attrs?.tableRowProperties) {
|
|
27097
27217
|
const tableRowProperties = { ...node.attrs.tableRowProperties };
|
|
27218
|
+
if (leadingPlaceholders > 0) {
|
|
27219
|
+
tableRowProperties.gridBefore = leadingPlaceholders;
|
|
27220
|
+
}
|
|
27221
|
+
if (trailingPlaceholders > 0) {
|
|
27222
|
+
tableRowProperties.gridAfter = trailingPlaceholders;
|
|
27223
|
+
}
|
|
27098
27224
|
if (node.attrs.rowHeight != null) {
|
|
27099
27225
|
const rowHeightPixels = twipsToPixels(node.attrs.tableRowProperties["rowHeight"]?.value);
|
|
27100
27226
|
if (rowHeightPixels !== node.attrs.rowHeight) {
|
|
@@ -27324,17 +27450,21 @@ const decode$o = (params) => {
|
|
|
27324
27450
|
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params, totalColumns, cellMinWidth);
|
|
27325
27451
|
const elements = [];
|
|
27326
27452
|
let columnIndex = 0;
|
|
27327
|
-
const pushColumn = (widthTwips) => {
|
|
27453
|
+
const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
|
|
27328
27454
|
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
27455
|
+
let shouldEnforceMinimum = enforceMinimum;
|
|
27329
27456
|
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
27330
27457
|
numericWidth = fallbackColumnWidthTwips;
|
|
27458
|
+
shouldEnforceMinimum = true;
|
|
27331
27459
|
}
|
|
27332
|
-
|
|
27460
|
+
const roundedWidth = Math.round(numericWidth);
|
|
27461
|
+
const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
|
|
27462
|
+
const safeWidth = Math.max(roundedWidth, minimumWidth);
|
|
27333
27463
|
const decoded = translator$u.decode({
|
|
27334
27464
|
node: { type: (
|
|
27335
27465
|
/** @type {string} */
|
|
27336
27466
|
translator$u.sdNodeOrKeyName
|
|
27337
|
-
), attrs: { col:
|
|
27467
|
+
), attrs: { col: safeWidth } }
|
|
27338
27468
|
});
|
|
27339
27469
|
if (decoded) elements.push(decoded);
|
|
27340
27470
|
};
|
|
@@ -27342,13 +27472,17 @@ const decode$o = (params) => {
|
|
|
27342
27472
|
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
27343
27473
|
const spanCount = Math.max(1, colspan);
|
|
27344
27474
|
for (let span = 0; span < spanCount; span++) {
|
|
27345
|
-
const
|
|
27475
|
+
const rawWidth = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
27476
|
+
const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
|
|
27477
|
+
const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
|
|
27346
27478
|
const colGridAttrs = grid?.[columnIndex] || {};
|
|
27347
27479
|
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
27348
27480
|
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
27349
27481
|
let cellWidthTwips;
|
|
27350
|
-
|
|
27351
|
-
|
|
27482
|
+
let enforceMinimum = false;
|
|
27483
|
+
if (hasCellWidth) {
|
|
27484
|
+
const tolerance = 0.5;
|
|
27485
|
+
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
27352
27486
|
cellWidthTwips = gridWidthTwips;
|
|
27353
27487
|
} else {
|
|
27354
27488
|
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
@@ -27357,8 +27491,9 @@ const decode$o = (params) => {
|
|
|
27357
27491
|
cellWidthTwips = gridWidthTwips;
|
|
27358
27492
|
} else {
|
|
27359
27493
|
cellWidthTwips = fallbackColumnWidthTwips;
|
|
27494
|
+
enforceMinimum = true;
|
|
27360
27495
|
}
|
|
27361
|
-
pushColumn(cellWidthTwips);
|
|
27496
|
+
pushColumn(cellWidthTwips, { enforceMinimum });
|
|
27362
27497
|
columnIndex++;
|
|
27363
27498
|
}
|
|
27364
27499
|
});
|
|
@@ -27521,7 +27656,9 @@ const encode$l = (params, encodedAttrs) => {
|
|
|
27521
27656
|
}
|
|
27522
27657
|
}
|
|
27523
27658
|
const content = [];
|
|
27524
|
-
|
|
27659
|
+
const totalColumns = columnWidths.length;
|
|
27660
|
+
const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
|
|
27661
|
+
rows.forEach((row, rowIndex) => {
|
|
27525
27662
|
const result = translator$Z.encode({
|
|
27526
27663
|
...params,
|
|
27527
27664
|
nodes: [row],
|
|
@@ -27530,10 +27667,45 @@ const encode$l = (params, encodedAttrs) => {
|
|
|
27530
27667
|
table: node,
|
|
27531
27668
|
rowBorders: borderRowData,
|
|
27532
27669
|
styleTag: tblStyleTag,
|
|
27533
|
-
columnWidths
|
|
27670
|
+
columnWidths,
|
|
27671
|
+
activeRowSpans: activeRowSpans.slice(),
|
|
27672
|
+
rowIndex
|
|
27534
27673
|
}
|
|
27535
27674
|
});
|
|
27536
|
-
if (result)
|
|
27675
|
+
if (result) {
|
|
27676
|
+
content.push(result);
|
|
27677
|
+
if (totalColumns > 0) {
|
|
27678
|
+
const activeRowSpansForCurrentRow = activeRowSpans.slice();
|
|
27679
|
+
for (let col = 0; col < totalColumns; col++) {
|
|
27680
|
+
if (activeRowSpans[col] > 0) {
|
|
27681
|
+
activeRowSpans[col] -= 1;
|
|
27682
|
+
}
|
|
27683
|
+
}
|
|
27684
|
+
let columnIndex = 0;
|
|
27685
|
+
const advanceColumnIndex = () => {
|
|
27686
|
+
while (columnIndex < totalColumns && activeRowSpansForCurrentRow[columnIndex] > 0) {
|
|
27687
|
+
columnIndex += 1;
|
|
27688
|
+
}
|
|
27689
|
+
};
|
|
27690
|
+
advanceColumnIndex();
|
|
27691
|
+
result.content?.forEach((cell) => {
|
|
27692
|
+
advanceColumnIndex();
|
|
27693
|
+
const colspan = Math.max(1, cell.attrs?.colspan || 1);
|
|
27694
|
+
const rowspan = Math.max(1, cell.attrs?.rowspan || 1);
|
|
27695
|
+
if (rowspan > 1) {
|
|
27696
|
+
for (let offset = 0; offset < colspan && columnIndex + offset < totalColumns; offset++) {
|
|
27697
|
+
const targetIndex = columnIndex + offset;
|
|
27698
|
+
const remainingRows = rowspan - 1;
|
|
27699
|
+
if (remainingRows > 0 && remainingRows > activeRowSpans[targetIndex]) {
|
|
27700
|
+
activeRowSpans[targetIndex] = remainingRows;
|
|
27701
|
+
}
|
|
27702
|
+
}
|
|
27703
|
+
}
|
|
27704
|
+
columnIndex += colspan;
|
|
27705
|
+
advanceColumnIndex();
|
|
27706
|
+
});
|
|
27707
|
+
}
|
|
27708
|
+
}
|
|
27537
27709
|
});
|
|
27538
27710
|
return {
|
|
27539
27711
|
type: "table",
|
|
@@ -27938,14 +28110,104 @@ function handleTableCellNode({
|
|
|
27938
28110
|
}
|
|
27939
28111
|
return {
|
|
27940
28112
|
type: "tableCell",
|
|
27941
|
-
content:
|
|
27942
|
-
|
|
27943
|
-
|
|
27944
|
-
|
|
27945
|
-
|
|
28113
|
+
content: normalizeTableCellContent(
|
|
28114
|
+
nodeListHandler.handler({
|
|
28115
|
+
...params,
|
|
28116
|
+
nodes: node.elements,
|
|
28117
|
+
path: [...params.path || [], node]
|
|
28118
|
+
}),
|
|
28119
|
+
params.editor
|
|
28120
|
+
),
|
|
27946
28121
|
attrs: attributes
|
|
27947
28122
|
};
|
|
27948
28123
|
}
|
|
28124
|
+
function normalizeTableCellContent(content, editor) {
|
|
28125
|
+
if (!Array.isArray(content) || content.length === 0) return content;
|
|
28126
|
+
const normalized = [];
|
|
28127
|
+
const pendingForNextBlock = [];
|
|
28128
|
+
const schema = editor?.schema;
|
|
28129
|
+
const cloneBlock = (node) => {
|
|
28130
|
+
if (!node) return node;
|
|
28131
|
+
const cloned = { ...node };
|
|
28132
|
+
if (Array.isArray(node.content)) {
|
|
28133
|
+
cloned.content = [...node.content];
|
|
28134
|
+
}
|
|
28135
|
+
return cloned;
|
|
28136
|
+
};
|
|
28137
|
+
const ensureArray = (node) => {
|
|
28138
|
+
if (!Array.isArray(node.content)) {
|
|
28139
|
+
node.content = [];
|
|
28140
|
+
}
|
|
28141
|
+
return node.content;
|
|
28142
|
+
};
|
|
28143
|
+
const isInlineNode = (node) => {
|
|
28144
|
+
if (!node || typeof node.type !== "string") return false;
|
|
28145
|
+
if (node.type === "text") return true;
|
|
28146
|
+
if (node.type === "bookmarkStart" || node.type === "bookmarkEnd") return true;
|
|
28147
|
+
const nodeType = schema?.nodes?.[node.type];
|
|
28148
|
+
if (nodeType) {
|
|
28149
|
+
if (typeof nodeType.isInline === "boolean") return nodeType.isInline;
|
|
28150
|
+
if (nodeType.spec?.group && typeof nodeType.spec.group === "string") {
|
|
28151
|
+
return nodeType.spec.group.split(" ").includes("inline");
|
|
28152
|
+
}
|
|
28153
|
+
}
|
|
28154
|
+
return false;
|
|
28155
|
+
};
|
|
28156
|
+
for (const node of content) {
|
|
28157
|
+
if (!node || typeof node.type !== "string") {
|
|
28158
|
+
normalized.push(node);
|
|
28159
|
+
continue;
|
|
28160
|
+
}
|
|
28161
|
+
if (!isInlineNode(node)) {
|
|
28162
|
+
const blockNode = cloneBlock(node);
|
|
28163
|
+
if (pendingForNextBlock.length) {
|
|
28164
|
+
const blockContent = ensureArray(blockNode);
|
|
28165
|
+
const leadingInline = pendingForNextBlock.splice(0);
|
|
28166
|
+
blockNode.content = [...leadingInline, ...blockContent];
|
|
28167
|
+
} else if (Array.isArray(blockNode.content)) {
|
|
28168
|
+
blockNode.content = [...blockNode.content];
|
|
28169
|
+
}
|
|
28170
|
+
normalized.push(blockNode);
|
|
28171
|
+
continue;
|
|
28172
|
+
}
|
|
28173
|
+
const targetIsNextBlock = node.type === "bookmarkStart" || normalized.length === 0;
|
|
28174
|
+
if (targetIsNextBlock) {
|
|
28175
|
+
pendingForNextBlock.push(node);
|
|
28176
|
+
} else {
|
|
28177
|
+
const lastIndex = normalized.length - 1;
|
|
28178
|
+
const lastNode = normalized[lastIndex];
|
|
28179
|
+
if (!lastNode || typeof lastNode.type !== "string" || isInlineNode(lastNode)) {
|
|
28180
|
+
pendingForNextBlock.push(node);
|
|
28181
|
+
continue;
|
|
28182
|
+
}
|
|
28183
|
+
const blockContent = ensureArray(lastNode);
|
|
28184
|
+
if (pendingForNextBlock.length) {
|
|
28185
|
+
blockContent.push(...pendingForNextBlock.splice(0));
|
|
28186
|
+
}
|
|
28187
|
+
blockContent.push(node);
|
|
28188
|
+
}
|
|
28189
|
+
}
|
|
28190
|
+
if (pendingForNextBlock.length) {
|
|
28191
|
+
if (normalized.length) {
|
|
28192
|
+
const lastIndex = normalized.length - 1;
|
|
28193
|
+
const lastNode = normalized[lastIndex];
|
|
28194
|
+
if (lastNode && typeof lastNode.type === "string" && !isInlineNode(lastNode)) {
|
|
28195
|
+
const blockContent = ensureArray(lastNode);
|
|
28196
|
+
blockContent.push(...pendingForNextBlock);
|
|
28197
|
+
pendingForNextBlock.length = 0;
|
|
28198
|
+
}
|
|
28199
|
+
}
|
|
28200
|
+
if (pendingForNextBlock.length) {
|
|
28201
|
+
normalized.push({
|
|
28202
|
+
type: "paragraph",
|
|
28203
|
+
attrs: {},
|
|
28204
|
+
content: [...pendingForNextBlock]
|
|
28205
|
+
});
|
|
28206
|
+
pendingForNextBlock.length = 0;
|
|
28207
|
+
}
|
|
28208
|
+
}
|
|
28209
|
+
return normalized;
|
|
28210
|
+
}
|
|
27949
28211
|
const processInlineCellBorders = (borders, rowBorders) => {
|
|
27950
28212
|
if (!borders) return null;
|
|
27951
28213
|
return ["bottom", "top", "left", "right"].reduce((acc, direction) => {
|
|
@@ -28499,6 +28761,7 @@ function sdtNodeTypeStrategy(node) {
|
|
|
28499
28761
|
}
|
|
28500
28762
|
return { type: "unknown", handler: null };
|
|
28501
28763
|
}
|
|
28764
|
+
const DRAWING_XML_TAG = "w:drawing";
|
|
28502
28765
|
function handleImageNode(node, params, isAnchor) {
|
|
28503
28766
|
const { docx, filename } = params;
|
|
28504
28767
|
const { attributes } = node;
|
|
@@ -28510,32 +28773,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28510
28773
|
};
|
|
28511
28774
|
const extent = node.elements.find((el) => el.name === "wp:extent");
|
|
28512
28775
|
const size = {
|
|
28513
|
-
width: emuToPixels(extent
|
|
28514
|
-
height: emuToPixels(extent
|
|
28776
|
+
width: emuToPixels(extent?.attributes?.cx),
|
|
28777
|
+
height: emuToPixels(extent?.attributes?.cy)
|
|
28515
28778
|
};
|
|
28516
|
-
const graphic = node.elements.find((el) => el.name === "a:graphic");
|
|
28517
|
-
const graphicData = graphic.elements.find((el) => el.name === "a:graphicData");
|
|
28518
|
-
const { uri: uri2 } = graphicData?.attributes || {};
|
|
28519
|
-
const shapeURI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
28520
|
-
if (!!uri2 && uri2 === shapeURI) {
|
|
28521
|
-
return handleShapeDrawing(params, node, graphicData);
|
|
28522
|
-
}
|
|
28523
|
-
const picture = graphicData.elements.find((el) => el.name === "pic:pic");
|
|
28524
|
-
if (!picture || !picture.elements) return null;
|
|
28525
|
-
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
28526
|
-
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
28527
|
-
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
28528
28779
|
let transformData = {};
|
|
28529
|
-
if (spPr) {
|
|
28530
|
-
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
28531
|
-
if (xfrm?.attributes) {
|
|
28532
|
-
transformData = {
|
|
28533
|
-
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
28534
|
-
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
28535
|
-
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
28536
|
-
};
|
|
28537
|
-
}
|
|
28538
|
-
}
|
|
28539
28780
|
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
28540
28781
|
if (effectExtent) {
|
|
28541
28782
|
const sanitizeEmuValue = (value) => {
|
|
@@ -28544,22 +28785,26 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28544
28785
|
return Number.isFinite(numeric) ? numeric : 0;
|
|
28545
28786
|
};
|
|
28546
28787
|
transformData.sizeExtension = {
|
|
28547
|
-
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
28548
|
-
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
28549
|
-
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
28550
|
-
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
28788
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["l"])),
|
|
28789
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["t"])),
|
|
28790
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["r"])),
|
|
28791
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["b"]))
|
|
28551
28792
|
};
|
|
28552
28793
|
}
|
|
28553
28794
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
28554
28795
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
28555
28796
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
28556
|
-
const hRelativeFrom = positionHTag?.attributes
|
|
28557
|
-
const alignH = positionHTag?.elements.find((el) => el.name === "wp:align")?.elements[0]?.text;
|
|
28797
|
+
const hRelativeFrom = positionHTag?.attributes?.relativeFrom;
|
|
28798
|
+
const alignH = positionHTag?.elements.find((el) => el.name === "wp:align")?.elements?.[0]?.text;
|
|
28558
28799
|
const positionVTag = node.elements.find((el) => el.name === "wp:positionV");
|
|
28559
28800
|
const positionV = positionVTag?.elements?.find((el) => el.name === "wp:posOffset");
|
|
28560
28801
|
const positionVValue = emuToPixels(positionV?.elements[0]?.text);
|
|
28561
|
-
const vRelativeFrom = positionVTag?.attributes
|
|
28562
|
-
const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements[0]?.text;
|
|
28802
|
+
const vRelativeFrom = positionVTag?.attributes?.relativeFrom;
|
|
28803
|
+
const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements?.[0]?.text;
|
|
28804
|
+
const marginOffset = {
|
|
28805
|
+
horizontal: positionHValue,
|
|
28806
|
+
top: positionVValue
|
|
28807
|
+
};
|
|
28563
28808
|
const simplePos = node.elements.find((el) => el.name === "wp:simplePos");
|
|
28564
28809
|
const wrapNode = isAnchor ? node.elements.find(
|
|
28565
28810
|
(el) => ["wp:wrapNone", "wp:wrapSquare", "wp:wrapThrough", "wp:wrapTight", "wp:wrapTopAndBottom"].includes(el.name)
|
|
@@ -28567,38 +28812,40 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28567
28812
|
const wrap2 = isAnchor ? { type: wrapNode?.name.slice(7) || "None", attrs: {} } : { type: "Inline" };
|
|
28568
28813
|
switch (wrap2.type) {
|
|
28569
28814
|
case "Square":
|
|
28570
|
-
|
|
28571
|
-
|
|
28815
|
+
if (wrapNode?.attributes?.wrapText) {
|
|
28816
|
+
wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
|
|
28817
|
+
}
|
|
28818
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28572
28819
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28573
28820
|
}
|
|
28574
|
-
if ("distL" in (wrapNode
|
|
28821
|
+
if ("distL" in (wrapNode?.attributes || {})) {
|
|
28575
28822
|
wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
|
|
28576
28823
|
}
|
|
28577
|
-
if ("distR" in (wrapNode
|
|
28824
|
+
if ("distR" in (wrapNode?.attributes || {})) {
|
|
28578
28825
|
wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
|
|
28579
28826
|
}
|
|
28580
|
-
if ("distT" in (wrapNode
|
|
28827
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28581
28828
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28582
28829
|
}
|
|
28583
28830
|
break;
|
|
28584
28831
|
case "Tight":
|
|
28585
28832
|
case "Through": {
|
|
28586
|
-
if ("distL" in (wrapNode
|
|
28833
|
+
if ("distL" in (wrapNode?.attributes || {})) {
|
|
28587
28834
|
wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
|
|
28588
28835
|
}
|
|
28589
|
-
if ("distR" in (wrapNode
|
|
28836
|
+
if ("distR" in (wrapNode?.attributes || {})) {
|
|
28590
28837
|
wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
|
|
28591
28838
|
}
|
|
28592
|
-
if ("distT" in (wrapNode
|
|
28839
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28593
28840
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28594
28841
|
}
|
|
28595
|
-
if ("distB" in (wrapNode
|
|
28842
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28596
28843
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28597
28844
|
}
|
|
28598
|
-
if ("wrapText" in (wrapNode
|
|
28845
|
+
if ("wrapText" in (wrapNode?.attributes || {})) {
|
|
28599
28846
|
wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
|
|
28600
28847
|
}
|
|
28601
|
-
const polygon = wrapNode
|
|
28848
|
+
const polygon = wrapNode?.elements?.find((el) => el.name === "wp:wrapPolygon");
|
|
28602
28849
|
if (polygon) {
|
|
28603
28850
|
wrap2.attrs.polygon = polygonToObj(polygon);
|
|
28604
28851
|
if (polygon.attributes?.edited !== void 0) {
|
|
@@ -28608,10 +28855,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28608
28855
|
break;
|
|
28609
28856
|
}
|
|
28610
28857
|
case "TopAndBottom":
|
|
28611
|
-
if ("distB" in (wrapNode
|
|
28858
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28612
28859
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28613
28860
|
}
|
|
28614
|
-
if ("distT" in (wrapNode
|
|
28861
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28615
28862
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28616
28863
|
}
|
|
28617
28864
|
break;
|
|
@@ -28629,17 +28876,42 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28629
28876
|
alignV
|
|
28630
28877
|
};
|
|
28631
28878
|
}
|
|
28632
|
-
const
|
|
28633
|
-
|
|
28634
|
-
|
|
28635
|
-
|
|
28879
|
+
const graphic = node.elements.find((el) => el.name === "a:graphic");
|
|
28880
|
+
const graphicData = graphic?.elements.find((el) => el.name === "a:graphicData");
|
|
28881
|
+
const { uri: uri2 } = graphicData?.attributes || {};
|
|
28882
|
+
const shapeURI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
28883
|
+
if (!!uri2 && uri2 === shapeURI) {
|
|
28884
|
+
const shapeMarginOffset = {
|
|
28885
|
+
left: positionHValue,
|
|
28886
|
+
horizontal: positionHValue,
|
|
28887
|
+
top: positionVValue
|
|
28888
|
+
};
|
|
28889
|
+
return handleShapeDrawing(params, node, graphicData, size, padding, shapeMarginOffset);
|
|
28890
|
+
}
|
|
28891
|
+
const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
|
|
28892
|
+
if (!picture || !picture.elements) return null;
|
|
28893
|
+
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
28894
|
+
const blip = blipFill?.elements.find((el) => el.name === "a:blip");
|
|
28895
|
+
if (!blip) return null;
|
|
28896
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
28897
|
+
if (spPr) {
|
|
28898
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
28899
|
+
if (xfrm?.attributes) {
|
|
28900
|
+
transformData = {
|
|
28901
|
+
...transformData,
|
|
28902
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
28903
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
28904
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
28905
|
+
};
|
|
28906
|
+
}
|
|
28907
|
+
}
|
|
28636
28908
|
const { attributes: blipAttributes = {} } = blip;
|
|
28637
28909
|
const rEmbed = blipAttributes["r:embed"];
|
|
28638
28910
|
if (!rEmbed) return null;
|
|
28639
28911
|
const currentFile = filename || "document.xml";
|
|
28640
28912
|
let rels = docx[`word/_rels/${currentFile}.rels`];
|
|
28641
28913
|
if (!rels) rels = docx[`word/_rels/document.xml.rels`];
|
|
28642
|
-
const relationships = rels
|
|
28914
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
28643
28915
|
const { elements } = relationships || [];
|
|
28644
28916
|
const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
|
|
28645
28917
|
if (!rel) return null;
|
|
@@ -28652,10 +28924,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28652
28924
|
type: "image",
|
|
28653
28925
|
attrs: {
|
|
28654
28926
|
src: path,
|
|
28655
|
-
alt: ["emf", "wmf"].includes(extension) ? "Unable to render EMF/WMF image" : docPr?.attributes
|
|
28927
|
+
alt: ["emf", "wmf"].includes(extension) ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
|
|
28656
28928
|
extension,
|
|
28657
|
-
id: docPr?.attributes
|
|
28658
|
-
title: docPr?.attributes
|
|
28929
|
+
id: docPr?.attributes?.id || "",
|
|
28930
|
+
title: docPr?.attributes?.descr || "Image",
|
|
28659
28931
|
inline: true,
|
|
28660
28932
|
padding,
|
|
28661
28933
|
marginOffset,
|
|
@@ -28670,6 +28942,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28670
28942
|
}
|
|
28671
28943
|
},
|
|
28672
28944
|
wrap: wrap2,
|
|
28945
|
+
...wrap2.type === "Square" && wrap2.attrs.wrapText ? {
|
|
28946
|
+
wrapText: wrap2.attrs.wrapText
|
|
28947
|
+
} : {},
|
|
28948
|
+
wrapTopAndBottom: wrap2.type === "TopAndBottom",
|
|
28673
28949
|
originalPadding: {
|
|
28674
28950
|
distT: attributes["distT"],
|
|
28675
28951
|
distB: attributes["distB"],
|
|
@@ -28681,7 +28957,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28681
28957
|
}
|
|
28682
28958
|
};
|
|
28683
28959
|
}
|
|
28684
|
-
const handleShapeDrawing = (params, node, graphicData) => {
|
|
28960
|
+
const handleShapeDrawing = (params, node, graphicData, size, padding, marginOffset) => {
|
|
28685
28961
|
const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
|
|
28686
28962
|
const textBox = wsp.elements.find((el) => el.name === "wps:txbx");
|
|
28687
28963
|
const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
|
|
@@ -28692,21 +28968,14 @@ const handleShapeDrawing = (params, node, graphicData) => {
|
|
|
28692
28968
|
return getRectangleShape(params, spPr);
|
|
28693
28969
|
}
|
|
28694
28970
|
if (!textBoxContent) {
|
|
28695
|
-
return
|
|
28971
|
+
return buildShapePlaceholder(node, size, padding, marginOffset, "drawing");
|
|
28696
28972
|
}
|
|
28697
|
-
|
|
28698
|
-
const translatedElement = nodeListHandler.handler({
|
|
28699
|
-
...params,
|
|
28700
|
-
node: textBoxContent.elements[0],
|
|
28701
|
-
nodes: textBoxContent.elements,
|
|
28702
|
-
path: [...params.path || [], textBoxContent]
|
|
28703
|
-
});
|
|
28704
|
-
return translatedElement[0];
|
|
28973
|
+
return buildShapePlaceholder(node, size, padding, marginOffset, "textbox");
|
|
28705
28974
|
};
|
|
28706
28975
|
const getRectangleShape = (params, node) => {
|
|
28707
28976
|
const schemaAttrs = {};
|
|
28708
28977
|
const [drawingNode] = params.nodes;
|
|
28709
|
-
if (drawingNode?.name ===
|
|
28978
|
+
if (drawingNode?.name === DRAWING_XML_TAG) {
|
|
28710
28979
|
schemaAttrs.drawingContent = drawingNode;
|
|
28711
28980
|
}
|
|
28712
28981
|
const xfrm = node.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -28730,6 +28999,52 @@ const getRectangleShape = (params, node) => {
|
|
|
28730
28999
|
attrs: schemaAttrs
|
|
28731
29000
|
};
|
|
28732
29001
|
};
|
|
29002
|
+
const buildShapePlaceholder = (node, size, padding, marginOffset, shapeType) => {
|
|
29003
|
+
const attrs = {
|
|
29004
|
+
drawingContent: {
|
|
29005
|
+
name: DRAWING_XML_TAG,
|
|
29006
|
+
elements: [carbonCopy(node)]
|
|
29007
|
+
},
|
|
29008
|
+
attributes: {
|
|
29009
|
+
"data-shape-type": shapeType
|
|
29010
|
+
}
|
|
29011
|
+
};
|
|
29012
|
+
if (size && (Number.isFinite(size.width) || Number.isFinite(size.height))) {
|
|
29013
|
+
attrs.size = {
|
|
29014
|
+
...Number.isFinite(size.width) ? { width: size.width } : {},
|
|
29015
|
+
...Number.isFinite(size.height) ? { height: size.height } : {}
|
|
29016
|
+
};
|
|
29017
|
+
}
|
|
29018
|
+
if (padding) {
|
|
29019
|
+
const paddingData = {};
|
|
29020
|
+
if (Number.isFinite(padding.top)) paddingData["data-padding-top"] = padding.top;
|
|
29021
|
+
if (Number.isFinite(padding.right)) paddingData["data-padding-right"] = padding.right;
|
|
29022
|
+
if (Number.isFinite(padding.bottom)) paddingData["data-padding-bottom"] = padding.bottom;
|
|
29023
|
+
if (Number.isFinite(padding.left)) paddingData["data-padding-left"] = padding.left;
|
|
29024
|
+
if (Object.keys(paddingData).length) {
|
|
29025
|
+
attrs.attributes = {
|
|
29026
|
+
...attrs.attributes,
|
|
29027
|
+
...paddingData
|
|
29028
|
+
};
|
|
29029
|
+
}
|
|
29030
|
+
}
|
|
29031
|
+
if (marginOffset) {
|
|
29032
|
+
const offsetData = {};
|
|
29033
|
+
const horizontal = Number.isFinite(marginOffset.horizontal) ? marginOffset.horizontal : Number.isFinite(marginOffset.left) ? marginOffset.left : void 0;
|
|
29034
|
+
if (Number.isFinite(horizontal)) offsetData["data-offset-x"] = horizontal;
|
|
29035
|
+
if (Number.isFinite(marginOffset.top)) offsetData["data-offset-y"] = marginOffset.top;
|
|
29036
|
+
if (Object.keys(offsetData).length) {
|
|
29037
|
+
attrs.attributes = {
|
|
29038
|
+
...attrs.attributes,
|
|
29039
|
+
...offsetData
|
|
29040
|
+
};
|
|
29041
|
+
}
|
|
29042
|
+
}
|
|
29043
|
+
return {
|
|
29044
|
+
type: "contentBlock",
|
|
29045
|
+
attrs
|
|
29046
|
+
};
|
|
29047
|
+
};
|
|
28733
29048
|
function handleAnchorNode(params) {
|
|
28734
29049
|
const { node } = params.extraParams;
|
|
28735
29050
|
if (node.name !== "wp:anchor") {
|
|
@@ -35441,7 +35756,7 @@ export {
|
|
|
35441
35756
|
objectIncludes as Z,
|
|
35442
35757
|
AddMarkStep as _,
|
|
35443
35758
|
Plugin as a,
|
|
35444
|
-
translator$
|
|
35759
|
+
translator$b as a$,
|
|
35445
35760
|
twipsToLines as a0,
|
|
35446
35761
|
pixelsToTwips as a1,
|
|
35447
35762
|
helpers as a2,
|
|
@@ -35452,33 +35767,33 @@ export {
|
|
|
35452
35767
|
createDocFromMarkdown as a7,
|
|
35453
35768
|
createDocFromHTML as a8,
|
|
35454
35769
|
EditorState as a9,
|
|
35455
|
-
|
|
35456
|
-
|
|
35457
|
-
|
|
35458
|
-
|
|
35459
|
-
|
|
35460
|
-
|
|
35461
|
-
|
|
35462
|
-
|
|
35463
|
-
|
|
35464
|
-
translator$
|
|
35465
|
-
translator$
|
|
35466
|
-
translator$
|
|
35467
|
-
translator$
|
|
35468
|
-
translator$
|
|
35469
|
-
translator$
|
|
35470
|
-
translator$
|
|
35471
|
-
translator$
|
|
35472
|
-
translator$
|
|
35473
|
-
translator$
|
|
35474
|
-
translator$
|
|
35475
|
-
translator$
|
|
35476
|
-
translator$
|
|
35477
|
-
|
|
35478
|
-
|
|
35479
|
-
|
|
35480
|
-
|
|
35481
|
-
translator
|
|
35770
|
+
getDefaultExportFromCjs$2 as aA,
|
|
35771
|
+
getContentTypesFromXml as aB,
|
|
35772
|
+
xmljs as aC,
|
|
35773
|
+
vClickOutside as aD,
|
|
35774
|
+
getActiveFormatting as aE,
|
|
35775
|
+
readFromClipboard as aF,
|
|
35776
|
+
handleClipboardPaste as aG,
|
|
35777
|
+
getFileObject as aH,
|
|
35778
|
+
runPropertyTranslators as aI,
|
|
35779
|
+
translator$d as aJ,
|
|
35780
|
+
translator$k as aK,
|
|
35781
|
+
translator$m as aL,
|
|
35782
|
+
translator$e as aM,
|
|
35783
|
+
translator$f as aN,
|
|
35784
|
+
translator$n as aO,
|
|
35785
|
+
translator$o as aP,
|
|
35786
|
+
translator$j as aQ,
|
|
35787
|
+
translator$g as aR,
|
|
35788
|
+
translator$r as aS,
|
|
35789
|
+
translator$i as aT,
|
|
35790
|
+
translator$l as aU,
|
|
35791
|
+
translator$h as aV,
|
|
35792
|
+
translator$q as aW,
|
|
35793
|
+
translator$p as aX,
|
|
35794
|
+
commentRangeEndTranslator as aY,
|
|
35795
|
+
commentRangeStartTranslator as aZ,
|
|
35796
|
+
translator$a as a_,
|
|
35482
35797
|
hasSomeParentWithClass as aa,
|
|
35483
35798
|
isActive as ab,
|
|
35484
35799
|
unflattenListsInHtml as ac,
|
|
@@ -35496,81 +35811,83 @@ export {
|
|
|
35496
35811
|
docxNumberigHelpers as ao,
|
|
35497
35812
|
parseIndentElement as ap,
|
|
35498
35813
|
combineIndents as aq,
|
|
35499
|
-
|
|
35500
|
-
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
35506
|
-
|
|
35507
|
-
|
|
35814
|
+
twipsToPixels as ar,
|
|
35815
|
+
PIXELS_PER_INCH as as,
|
|
35816
|
+
SelectionRange as at,
|
|
35817
|
+
Transform as au,
|
|
35818
|
+
isInTable as av,
|
|
35819
|
+
generateDocxRandomId as aw,
|
|
35820
|
+
insertNewRelationship as ax,
|
|
35821
|
+
inchesToPixels as ay,
|
|
35822
|
+
commonjsGlobal as az,
|
|
35508
35823
|
Slice as b,
|
|
35509
|
-
|
|
35510
|
-
translator
|
|
35511
|
-
translator$
|
|
35512
|
-
translator$
|
|
35513
|
-
translator$
|
|
35514
|
-
translator$
|
|
35515
|
-
translator$
|
|
35516
|
-
translator$
|
|
35517
|
-
translator$
|
|
35518
|
-
translator$
|
|
35519
|
-
translator$
|
|
35520
|
-
translator$
|
|
35521
|
-
translator$
|
|
35522
|
-
translator$
|
|
35523
|
-
translator$
|
|
35524
|
-
translator$
|
|
35525
|
-
translator$
|
|
35526
|
-
translator$
|
|
35527
|
-
translator$
|
|
35528
|
-
translator$
|
|
35529
|
-
translator$
|
|
35530
|
-
translator$
|
|
35531
|
-
translator$
|
|
35532
|
-
translator$
|
|
35533
|
-
translator$
|
|
35534
|
-
translator$
|
|
35535
|
-
translator$
|
|
35536
|
-
translator$
|
|
35537
|
-
translator$
|
|
35538
|
-
translator$
|
|
35539
|
-
translator$
|
|
35540
|
-
translator$
|
|
35541
|
-
translator$
|
|
35542
|
-
translator$
|
|
35543
|
-
translator$
|
|
35544
|
-
translator$
|
|
35545
|
-
translator$
|
|
35546
|
-
translator$
|
|
35547
|
-
translator$
|
|
35548
|
-
translator$
|
|
35549
|
-
translator$
|
|
35550
|
-
translator$
|
|
35551
|
-
translator$
|
|
35552
|
-
translator$
|
|
35553
|
-
translator$
|
|
35554
|
-
translator$
|
|
35555
|
-
translator$
|
|
35556
|
-
translator$
|
|
35557
|
-
translator$
|
|
35558
|
-
translator$
|
|
35559
|
-
translator$
|
|
35560
|
-
translator$
|
|
35561
|
-
translator$
|
|
35562
|
-
translator$
|
|
35563
|
-
translator$
|
|
35564
|
-
translator$
|
|
35565
|
-
translator$
|
|
35566
|
-
translator$
|
|
35567
|
-
translator$
|
|
35568
|
-
translator$
|
|
35569
|
-
translator$
|
|
35570
|
-
translator$
|
|
35571
|
-
translator$
|
|
35572
|
-
translator$
|
|
35824
|
+
translator$5 as b$,
|
|
35825
|
+
translator$$ as b0,
|
|
35826
|
+
translator$10 as b1,
|
|
35827
|
+
translator$1l as b2,
|
|
35828
|
+
translator$_ as b3,
|
|
35829
|
+
translator$11 as b4,
|
|
35830
|
+
translator$Z as b5,
|
|
35831
|
+
translator$z as b6,
|
|
35832
|
+
translator$c as b7,
|
|
35833
|
+
translator$M as b8,
|
|
35834
|
+
translator$N as b9,
|
|
35835
|
+
translator$1i as bA,
|
|
35836
|
+
translator$1b as bB,
|
|
35837
|
+
translator$1o as bC,
|
|
35838
|
+
translator$F as bD,
|
|
35839
|
+
translator$14 as bE,
|
|
35840
|
+
translator$G as bF,
|
|
35841
|
+
translator$H as bG,
|
|
35842
|
+
translator$1m as bH,
|
|
35843
|
+
translator$1c as bI,
|
|
35844
|
+
translator$1q as bJ,
|
|
35845
|
+
translator$15 as bK,
|
|
35846
|
+
translator$u as bL,
|
|
35847
|
+
translator$16 as bM,
|
|
35848
|
+
translator$17 as bN,
|
|
35849
|
+
translator$J as bO,
|
|
35850
|
+
translator$9 as bP,
|
|
35851
|
+
translator$18 as bQ,
|
|
35852
|
+
translator$1j as bR,
|
|
35853
|
+
translator$19 as bS,
|
|
35854
|
+
translator$1a as bT,
|
|
35855
|
+
translator$1r as bU,
|
|
35856
|
+
translator$L as bV,
|
|
35857
|
+
translator$7 as bW,
|
|
35858
|
+
translator$6 as bX,
|
|
35859
|
+
translator$Y as bY,
|
|
35860
|
+
translator$1n as bZ,
|
|
35861
|
+
translator$4 as b_,
|
|
35862
|
+
translator$O as ba,
|
|
35863
|
+
translator$P as bb,
|
|
35864
|
+
translator$Q as bc,
|
|
35865
|
+
translator$v as bd,
|
|
35866
|
+
translator$R as be,
|
|
35867
|
+
translator$S as bf,
|
|
35868
|
+
translator$T as bg,
|
|
35869
|
+
translator$U as bh,
|
|
35870
|
+
translator$12 as bi,
|
|
35871
|
+
translator$t as bj,
|
|
35872
|
+
translator$V as bk,
|
|
35873
|
+
translator$13 as bl,
|
|
35874
|
+
translator$w as bm,
|
|
35875
|
+
translator$W as bn,
|
|
35876
|
+
translator$x as bo,
|
|
35877
|
+
translator$s as bp,
|
|
35878
|
+
translator$1p as bq,
|
|
35879
|
+
translator$1f as br,
|
|
35880
|
+
translator$1g as bs,
|
|
35881
|
+
translator$1k as bt,
|
|
35882
|
+
translator$B as bu,
|
|
35883
|
+
translator$X as bv,
|
|
35884
|
+
translator$8 as bw,
|
|
35885
|
+
translator$D as bx,
|
|
35886
|
+
translator$1h as by,
|
|
35887
|
+
translator$1d as bz,
|
|
35573
35888
|
DOMParser$1 as c,
|
|
35889
|
+
translator$1 as c0,
|
|
35890
|
+
_sfc_main as c1,
|
|
35574
35891
|
Mark as d,
|
|
35575
35892
|
dropPoint as e,
|
|
35576
35893
|
callOrGet as f,
|