@harbour-enterprises/superdoc 0.27.3-next.1 → 0.28.0-next.1
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-Bnj3c-92.es.js → PdfViewer-9z5hlRyt.es.js} +1 -1
- package/dist/chunks/{PdfViewer-BkJGiP2u.cjs → PdfViewer-Jb55JUCS.cjs} +1 -1
- package/dist/chunks/{index-CuLDIhMe.cjs → index-D0UvyM8m.cjs} +10 -4
- package/dist/chunks/{index-lF5qA9nw.es.js → index-DqP-8_tO.es.js} +10 -4
- package/dist/chunks/{super-editor.es-6ikSS3Qu.es.js → super-editor.es-BBJIKdhr.es.js} +1690 -1674
- package/dist/chunks/{super-editor.es-RvLsj0rg.cjs → super-editor.es-Ca5D3ZTW.cjs} +1690 -1674
- package/dist/chunks/uuid-CjlX8hrF.es.js +35 -0
- package/dist/chunks/uuid-R7L08bOx.cjs +34 -0
- package/dist/components/CommentsLayer/use-comment.d.ts.map +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-GcMLdei-.js → converter-AR-76siZ.js} +1344 -1416
- package/dist/super-editor/chunks/{docx-zipper-Y0x9TJvc.js → docx-zipper-DVb-VGgt.js} +1 -1
- package/dist/super-editor/chunks/{editor-B97ToSSc.js → editor-mK_uimq6.js} +93 -5
- package/dist/super-editor/chunks/{toolbar-Cm21JZgi.js → toolbar-ByoNwr7x.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/super-editor/src/components/toolbar/use-toolbar-item.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/getSelectionMarks.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/commands/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/commands/setTextSelection.d.ts +4 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +0 -16
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/legacy-handle-table-cell-node.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts +2 -1
- package/dist/super-editor/super-editor/src/tests/helpers/helpers.d.ts +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +1722 -1702
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +5 -8
- package/dist/chunks/uuid-CQzaMNgL.cjs +0 -36
- package/dist/chunks/uuid-DIIKH5Zc.es.js +0 -37
- package/dist/images/altText_add.svg +0 -3
- package/dist/images/altText_done.svg +0 -3
- package/dist/images/annotation-check.svg +0 -11
- package/dist/images/annotation-comment.svg +0 -16
- package/dist/images/annotation-help.svg +0 -26
- package/dist/images/annotation-insert.svg +0 -10
- package/dist/images/annotation-key.svg +0 -11
- package/dist/images/annotation-newparagraph.svg +0 -11
- package/dist/images/annotation-noicon.svg +0 -7
- package/dist/images/annotation-note.svg +0 -42
- package/dist/images/annotation-paperclip.svg +0 -6
- package/dist/images/annotation-paragraph.svg +0 -16
- package/dist/images/annotation-pushpin.svg +0 -7
- package/dist/images/cursor-editorFreeHighlight.svg +0 -6
- package/dist/images/cursor-editorFreeText.svg +0 -3
- package/dist/images/cursor-editorInk.svg +0 -4
- package/dist/images/cursor-editorTextHighlight.svg +0 -8
- package/dist/images/editor-toolbar-delete.svg +0 -5
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/toolbarButton-editorHighlight.svg +0 -6
- package/dist/images/toolbarButton-menuArrow.svg +0 -3
package/dist/superdoc.umd.js
CHANGED
|
@@ -7762,9 +7762,9 @@
|
|
|
7762
7762
|
var revLookup = [];
|
|
7763
7763
|
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
7764
7764
|
var code$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
7765
|
-
for (var i$1
|
|
7766
|
-
lookup[i$1
|
|
7767
|
-
revLookup[code$1.charCodeAt(i$1
|
|
7765
|
+
for (var i$1 = 0, len = code$1.length; i$1 < len; ++i$1) {
|
|
7766
|
+
lookup[i$1] = code$1[i$1];
|
|
7767
|
+
revLookup[code$1.charCodeAt(i$1)] = i$1;
|
|
7768
7768
|
}
|
|
7769
7769
|
revLookup["-".charCodeAt(0)] = 62;
|
|
7770
7770
|
revLookup["_".charCodeAt(0)] = 63;
|
|
@@ -19072,39 +19072,37 @@
|
|
|
19072
19072
|
}
|
|
19073
19073
|
var libExports = requireLib();
|
|
19074
19074
|
const xmljs = /* @__PURE__ */ getDefaultExportFromCjs$2(libExports);
|
|
19075
|
-
|
|
19076
|
-
|
|
19075
|
+
let getRandomValues$1;
|
|
19076
|
+
const rnds8$1 = new Uint8Array(16);
|
|
19077
19077
|
function rng$1() {
|
|
19078
19078
|
if (!getRandomValues$1) {
|
|
19079
|
-
getRandomValues$1 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)
|
|
19079
|
+
getRandomValues$1 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
19080
19080
|
if (!getRandomValues$1) {
|
|
19081
19081
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
19082
19082
|
}
|
|
19083
19083
|
}
|
|
19084
19084
|
return getRandomValues$1(rnds8$1);
|
|
19085
19085
|
}
|
|
19086
|
-
const
|
|
19087
|
-
|
|
19088
|
-
|
|
19086
|
+
const byteToHex$1 = [];
|
|
19087
|
+
for (let i2 = 0; i2 < 256; ++i2) {
|
|
19088
|
+
byteToHex$1.push((i2 + 256).toString(16).slice(1));
|
|
19089
19089
|
}
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
byteToHex$1.push((i$2 + 256).toString(16).substr(1));
|
|
19093
|
-
}
|
|
19094
|
-
function stringify$1(arr) {
|
|
19095
|
-
var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
19096
|
-
var uuid = (byteToHex$1[arr[offset2 + 0]] + byteToHex$1[arr[offset2 + 1]] + byteToHex$1[arr[offset2 + 2]] + byteToHex$1[arr[offset2 + 3]] + "-" + byteToHex$1[arr[offset2 + 4]] + byteToHex$1[arr[offset2 + 5]] + "-" + byteToHex$1[arr[offset2 + 6]] + byteToHex$1[arr[offset2 + 7]] + "-" + byteToHex$1[arr[offset2 + 8]] + byteToHex$1[arr[offset2 + 9]] + "-" + byteToHex$1[arr[offset2 + 10]] + byteToHex$1[arr[offset2 + 11]] + byteToHex$1[arr[offset2 + 12]] + byteToHex$1[arr[offset2 + 13]] + byteToHex$1[arr[offset2 + 14]] + byteToHex$1[arr[offset2 + 15]]).toLowerCase();
|
|
19097
|
-
if (!validate$1(uuid)) {
|
|
19098
|
-
throw TypeError("Stringified UUID is invalid");
|
|
19099
|
-
}
|
|
19100
|
-
return uuid;
|
|
19090
|
+
function unsafeStringify$1(arr, offset2 = 0) {
|
|
19091
|
+
return byteToHex$1[arr[offset2 + 0]] + byteToHex$1[arr[offset2 + 1]] + byteToHex$1[arr[offset2 + 2]] + byteToHex$1[arr[offset2 + 3]] + "-" + byteToHex$1[arr[offset2 + 4]] + byteToHex$1[arr[offset2 + 5]] + "-" + byteToHex$1[arr[offset2 + 6]] + byteToHex$1[arr[offset2 + 7]] + "-" + byteToHex$1[arr[offset2 + 8]] + byteToHex$1[arr[offset2 + 9]] + "-" + byteToHex$1[arr[offset2 + 10]] + byteToHex$1[arr[offset2 + 11]] + byteToHex$1[arr[offset2 + 12]] + byteToHex$1[arr[offset2 + 13]] + byteToHex$1[arr[offset2 + 14]] + byteToHex$1[arr[offset2 + 15]];
|
|
19101
19092
|
}
|
|
19093
|
+
const randomUUID$1 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
19094
|
+
const native$1 = {
|
|
19095
|
+
randomUUID: randomUUID$1
|
|
19096
|
+
};
|
|
19102
19097
|
function v4$1(options, buf, offset2) {
|
|
19098
|
+
if (native$1.randomUUID && true && !options) {
|
|
19099
|
+
return native$1.randomUUID();
|
|
19100
|
+
}
|
|
19103
19101
|
options = options || {};
|
|
19104
|
-
|
|
19102
|
+
const rnds = options.random || (options.rng || rng$1)();
|
|
19105
19103
|
rnds[6] = rnds[6] & 15 | 64;
|
|
19106
19104
|
rnds[8] = rnds[8] & 63 | 128;
|
|
19107
|
-
return
|
|
19105
|
+
return unsafeStringify$1(rnds);
|
|
19108
19106
|
}
|
|
19109
19107
|
function getDefaultExportFromCjs$3(x) {
|
|
19110
19108
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -22157,6 +22155,7 @@
|
|
|
22157
22155
|
addTextNode(dom, marks) {
|
|
22158
22156
|
let value = dom.nodeValue;
|
|
22159
22157
|
let top2 = this.top, preserveWS = top2.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (top2.options & OPT_PRESERVE_WS) > 0;
|
|
22158
|
+
let { schema } = this.parser;
|
|
22160
22159
|
if (preserveWS === "full" || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
|
|
22161
22160
|
if (!preserveWS) {
|
|
22162
22161
|
value = value.replace(/[ \t\r\n\u000c]+/g, " ");
|
|
@@ -22166,13 +22165,22 @@
|
|
|
22166
22165
|
if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text))
|
|
22167
22166
|
value = value.slice(1);
|
|
22168
22167
|
}
|
|
22169
|
-
} else if (preserveWS
|
|
22170
|
-
value = value.replace(/\r?\n|\r/g, " ");
|
|
22171
|
-
} else {
|
|
22168
|
+
} else if (preserveWS === "full") {
|
|
22172
22169
|
value = value.replace(/\r\n?/g, "\n");
|
|
22170
|
+
} else if (schema.linebreakReplacement && /[\r\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {
|
|
22171
|
+
let lines = value.split(/\r?\n|\r/);
|
|
22172
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
22173
|
+
if (i2)
|
|
22174
|
+
this.insertNode(schema.linebreakReplacement.create(), marks, true);
|
|
22175
|
+
if (lines[i2])
|
|
22176
|
+
this.insertNode(schema.text(lines[i2]), marks, !/\S/.test(lines[i2]));
|
|
22177
|
+
}
|
|
22178
|
+
value = "";
|
|
22179
|
+
} else {
|
|
22180
|
+
value = value.replace(/\r?\n|\r/g, " ");
|
|
22173
22181
|
}
|
|
22174
22182
|
if (value)
|
|
22175
|
-
this.insertNode(
|
|
22183
|
+
this.insertNode(schema.text(value), marks, !/\S/.test(value));
|
|
22176
22184
|
this.findInText(dom);
|
|
22177
22185
|
} else {
|
|
22178
22186
|
this.findInside(dom);
|
|
@@ -26732,7 +26740,6 @@
|
|
|
26732
26740
|
} else {
|
|
26733
26741
|
if (to == null)
|
|
26734
26742
|
to = from2;
|
|
26735
|
-
to = to == null ? from2 : to;
|
|
26736
26743
|
if (!text)
|
|
26737
26744
|
return this.deleteRange(from2, to);
|
|
26738
26745
|
let marks = this.storedMarks;
|
|
@@ -26741,7 +26748,7 @@
|
|
|
26741
26748
|
marks = to == from2 ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
|
|
26742
26749
|
}
|
|
26743
26750
|
this.replaceRangeWith(from2, to, schema.text(text, marks));
|
|
26744
|
-
if (!this.selection.empty)
|
|
26751
|
+
if (!this.selection.empty && this.selection.to == from2 + text.length)
|
|
26745
26752
|
this.setSelection(Selection.near(this.selection.$to));
|
|
26746
26753
|
return this;
|
|
26747
26754
|
}
|
|
@@ -26933,7 +26940,7 @@
|
|
|
26933
26940
|
return newInstance;
|
|
26934
26941
|
}
|
|
26935
26942
|
/**
|
|
26936
|
-
|
|
26943
|
+
Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
|
|
26937
26944
|
*/
|
|
26938
26945
|
get tr() {
|
|
26939
26946
|
return new Transaction(this);
|
|
@@ -34732,53 +34739,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34732
34739
|
attributes: validXmlAttributes$c
|
|
34733
34740
|
};
|
|
34734
34741
|
const translator$1b = NodeTranslator.from(config$h);
|
|
34735
|
-
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
34736
|
-
if (!table || !Array.isArray(table.content)) {
|
|
34737
|
-
return table;
|
|
34738
|
-
}
|
|
34739
|
-
const rows = table.content;
|
|
34740
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
34741
|
-
const row = rows[rowIndex];
|
|
34742
|
-
if (!row) continue;
|
|
34743
|
-
if (!Array.isArray(row.content)) {
|
|
34744
|
-
row.content = [];
|
|
34745
|
-
}
|
|
34746
|
-
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
34747
|
-
const cell = row.content[cellIndex];
|
|
34748
|
-
if (!cell) continue;
|
|
34749
|
-
const attrs = cell.attrs || {};
|
|
34750
|
-
if (!attrs.rowspan || attrs.rowspan <= 1) continue;
|
|
34751
|
-
const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
|
|
34752
|
-
for (let offset2 = 1; offset2 < maxRowspan; offset2++) {
|
|
34753
|
-
const rowToChange = rows[rowIndex + offset2];
|
|
34754
|
-
if (!rowToChange) continue;
|
|
34755
|
-
if (!Array.isArray(rowToChange.content)) {
|
|
34756
|
-
rowToChange.content = [];
|
|
34757
|
-
}
|
|
34758
|
-
const existingCell = rowToChange.content[cellIndex];
|
|
34759
|
-
if (existingCell?.attrs?.continueMerge) continue;
|
|
34760
|
-
const mergedCell = {
|
|
34761
|
-
type: cell.type,
|
|
34762
|
-
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
34763
|
-
attrs: {
|
|
34764
|
-
...cell.attrs,
|
|
34765
|
-
rowspan: null,
|
|
34766
|
-
continueMerge: true
|
|
34767
|
-
}
|
|
34768
|
-
};
|
|
34769
|
-
rowToChange.content.splice(cellIndex, 0, mergedCell);
|
|
34770
|
-
}
|
|
34771
|
-
}
|
|
34772
|
-
}
|
|
34773
|
-
return table;
|
|
34774
|
-
}
|
|
34775
34742
|
const translator$1a = NodeTranslator.from({
|
|
34776
|
-
xmlName: "w:cantSplit",
|
|
34777
|
-
sdNodeOrKeyName: "cantSplit",
|
|
34778
|
-
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34779
|
-
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
34780
|
-
});
|
|
34781
|
-
const translator$19 = NodeTranslator.from({
|
|
34782
34743
|
xmlName: "w:cnfStyle",
|
|
34783
34744
|
sdNodeOrKeyName: "cnfStyle",
|
|
34784
34745
|
attributes: [
|
|
@@ -34804,299 +34765,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34804
34765
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34805
34766
|
}
|
|
34806
34767
|
});
|
|
34807
|
-
const translator$
|
|
34808
|
-
const translator$17 = NodeTranslator.from(
|
|
34809
|
-
createSingleAttrPropertyHandler(
|
|
34810
|
-
"w:gridAfter",
|
|
34811
|
-
null,
|
|
34812
|
-
"w:val",
|
|
34813
|
-
(v2) => parseInteger(v2) ?? void 0,
|
|
34814
|
-
(v2) => integerToString(v2)
|
|
34815
|
-
)
|
|
34816
|
-
);
|
|
34817
|
-
const translator$16 = NodeTranslator.from(
|
|
34818
|
-
createSingleAttrPropertyHandler(
|
|
34819
|
-
"w:gridBefore",
|
|
34820
|
-
null,
|
|
34821
|
-
"w:val",
|
|
34822
|
-
(v2) => parseInteger(v2) ?? void 0,
|
|
34823
|
-
(v2) => integerToString(v2)
|
|
34824
|
-
)
|
|
34825
|
-
);
|
|
34826
|
-
const translator$15 = NodeTranslator.from({
|
|
34827
|
-
xmlName: "w:hidden",
|
|
34828
|
-
sdNodeOrKeyName: "hidden",
|
|
34829
|
-
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34830
|
-
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
34831
|
-
});
|
|
34832
|
-
const translator$14 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
34833
|
-
const translator$13 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
34834
|
-
const translator$12 = NodeTranslator.from({
|
|
34835
|
-
xmlName: "w:tblHeader",
|
|
34836
|
-
sdNodeOrKeyName: "repeatHeader",
|
|
34837
|
-
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34838
|
-
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
34839
|
-
});
|
|
34840
|
-
const translator$11 = NodeTranslator.from({
|
|
34841
|
-
xmlName: "w:trHeight",
|
|
34842
|
-
sdNodeOrKeyName: "rowHeight",
|
|
34843
|
-
encode: ({ nodes }) => {
|
|
34844
|
-
const heightAttrs = {};
|
|
34845
|
-
const val = nodes[0].attributes["w:val"];
|
|
34846
|
-
if (val) {
|
|
34847
|
-
heightAttrs["value"] = parseInt(val, 10);
|
|
34848
|
-
}
|
|
34849
|
-
const rule = nodes[0].attributes["w:hRule"];
|
|
34850
|
-
if (rule) {
|
|
34851
|
-
heightAttrs["rule"] = rule;
|
|
34852
|
-
}
|
|
34853
|
-
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
34854
|
-
},
|
|
34855
|
-
decode: ({ node }) => {
|
|
34856
|
-
if (!node.attrs?.rowHeight) return;
|
|
34857
|
-
const heightAttrs = {};
|
|
34858
|
-
if (typeof node.attrs.rowHeight.value === "number" && !isNaN(node.attrs.rowHeight.value)) {
|
|
34859
|
-
heightAttrs["w:val"] = String(node.attrs.rowHeight.value);
|
|
34860
|
-
}
|
|
34861
|
-
if (node.attrs.rowHeight.rule) {
|
|
34862
|
-
heightAttrs["w:hRule"] = node.attrs.rowHeight.rule;
|
|
34863
|
-
}
|
|
34864
|
-
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
34865
|
-
}
|
|
34866
|
-
});
|
|
34867
|
-
const translator$10 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
34868
|
-
const translator$$ = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
34869
|
-
const propertyTranslators$6 = [
|
|
34870
|
-
translator$1a,
|
|
34871
|
-
translator$19,
|
|
34872
|
-
translator$18,
|
|
34873
|
-
translator$17,
|
|
34874
|
-
translator$16,
|
|
34875
|
-
translator$15,
|
|
34876
|
-
translator$14,
|
|
34877
|
-
translator$13,
|
|
34878
|
-
translator$12,
|
|
34879
|
-
translator$11,
|
|
34880
|
-
translator$10,
|
|
34881
|
-
translator$$
|
|
34882
|
-
];
|
|
34883
|
-
const translator$_ = NodeTranslator.from(
|
|
34884
|
-
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$6, {
|
|
34885
|
-
cantSplit: false,
|
|
34886
|
-
hidden: false,
|
|
34887
|
-
repeatHeader: false
|
|
34888
|
-
})
|
|
34889
|
-
);
|
|
34890
|
-
const createPlaceholderCell = (gridWidth, reason) => {
|
|
34891
|
-
const safeWidth = Number.isFinite(gridWidth) ? gridWidth : 0;
|
|
34892
|
-
const noBorder = { val: "none", size: 0 };
|
|
34893
|
-
return {
|
|
34894
|
-
type: "tableCell",
|
|
34895
|
-
attrs: {
|
|
34896
|
-
colspan: 1,
|
|
34897
|
-
rowspan: 1,
|
|
34898
|
-
colwidth: [safeWidth],
|
|
34899
|
-
__placeholder: reason,
|
|
34900
|
-
borders: {
|
|
34901
|
-
top: { ...noBorder },
|
|
34902
|
-
right: { ...noBorder },
|
|
34903
|
-
bottom: { ...noBorder },
|
|
34904
|
-
left: { ...noBorder }
|
|
34905
|
-
}
|
|
34906
|
-
},
|
|
34907
|
-
content: [{ type: "paragraph", content: [] }]
|
|
34908
|
-
};
|
|
34909
|
-
};
|
|
34910
|
-
const advancePastRowSpans = (pendingRowSpans, startIndex, totalColumns) => {
|
|
34911
|
-
let index2 = startIndex;
|
|
34912
|
-
while (index2 < totalColumns && pendingRowSpans[index2] > 0) {
|
|
34913
|
-
pendingRowSpans[index2] -= 1;
|
|
34914
|
-
index2 += 1;
|
|
34915
|
-
}
|
|
34916
|
-
return index2;
|
|
34917
|
-
};
|
|
34918
|
-
const fillPlaceholderColumns = ({
|
|
34919
|
-
content,
|
|
34920
|
-
pendingRowSpans,
|
|
34921
|
-
currentIndex,
|
|
34922
|
-
targetIndex,
|
|
34923
|
-
totalColumns,
|
|
34924
|
-
gridColumnWidths,
|
|
34925
|
-
reason
|
|
34926
|
-
}) => {
|
|
34927
|
-
let index2 = currentIndex;
|
|
34928
|
-
while (index2 < targetIndex && index2 < totalColumns) {
|
|
34929
|
-
if (pendingRowSpans[index2] > 0) {
|
|
34930
|
-
pendingRowSpans[index2] -= 1;
|
|
34931
|
-
index2 += 1;
|
|
34932
|
-
continue;
|
|
34933
|
-
}
|
|
34934
|
-
const width = Array.isArray(gridColumnWidths) ? gridColumnWidths[index2] ?? 0 : 0;
|
|
34935
|
-
content.push(createPlaceholderCell(width, reason));
|
|
34936
|
-
index2 += 1;
|
|
34937
|
-
}
|
|
34938
|
-
return index2;
|
|
34939
|
-
};
|
|
34940
|
-
const isPlaceholderCell = (cell) => {
|
|
34941
|
-
if (!cell) return false;
|
|
34942
|
-
if (cell.attrs?.__placeholder) return true;
|
|
34943
|
-
const widths = cell.attrs?.colwidth;
|
|
34944
|
-
if (Array.isArray(widths) && widths.length > 0) {
|
|
34945
|
-
const hasMeaningfulWidth = widths.some(
|
|
34946
|
-
(value) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) > 1
|
|
34947
|
-
);
|
|
34948
|
-
if (!hasMeaningfulWidth) return true;
|
|
34949
|
-
}
|
|
34950
|
-
return false;
|
|
34951
|
-
};
|
|
34952
|
-
const XML_NODE_NAME$h = "w:tr";
|
|
34953
|
-
const SD_NODE_NAME$d = "tableRow";
|
|
34954
|
-
const validXmlAttributes$b = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
34955
|
-
(xmlName) => createAttributeHandler(xmlName)
|
|
34956
|
-
);
|
|
34957
|
-
const encode$n = (params2, encodedAttrs) => {
|
|
34958
|
-
const { row } = params2.extraParams;
|
|
34959
|
-
let tableRowProperties = {};
|
|
34960
|
-
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
34961
|
-
if (tPr) {
|
|
34962
|
-
tableRowProperties = translator$_.encode({
|
|
34963
|
-
...params2,
|
|
34964
|
-
nodes: [tPr]
|
|
34965
|
-
});
|
|
34966
|
-
}
|
|
34967
|
-
const gridBeforeRaw = tableRowProperties?.["gridBefore"];
|
|
34968
|
-
const safeGridBefore = typeof gridBeforeRaw === "number" && Number.isFinite(gridBeforeRaw) && gridBeforeRaw > 0 ? gridBeforeRaw : 0;
|
|
34969
|
-
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
34970
|
-
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
34971
|
-
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
34972
|
-
const { columnWidths: gridColumnWidths, activeRowSpans = [] } = params2.extraParams;
|
|
34973
|
-
const totalColumns = Array.isArray(gridColumnWidths) ? gridColumnWidths.length : 0;
|
|
34974
|
-
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
34975
|
-
while (pendingRowSpans.length < totalColumns) pendingRowSpans.push(0);
|
|
34976
|
-
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
34977
|
-
const content = [];
|
|
34978
|
-
let currentColumnIndex = 0;
|
|
34979
|
-
const fillUntil = (target, reason) => {
|
|
34980
|
-
currentColumnIndex = fillPlaceholderColumns({
|
|
34981
|
-
content,
|
|
34982
|
-
pendingRowSpans,
|
|
34983
|
-
currentIndex: currentColumnIndex,
|
|
34984
|
-
targetIndex: target,
|
|
34985
|
-
totalColumns,
|
|
34986
|
-
gridColumnWidths,
|
|
34987
|
-
reason
|
|
34988
|
-
});
|
|
34989
|
-
};
|
|
34990
|
-
const skipOccupiedColumns = () => {
|
|
34991
|
-
currentColumnIndex = advancePastRowSpans(pendingRowSpans, currentColumnIndex, totalColumns);
|
|
34992
|
-
};
|
|
34993
|
-
fillUntil(safeGridBefore, "gridBefore");
|
|
34994
|
-
skipOccupiedColumns();
|
|
34995
|
-
cellNodes?.forEach((node) => {
|
|
34996
|
-
skipOccupiedColumns();
|
|
34997
|
-
const startColumn = currentColumnIndex;
|
|
34998
|
-
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
34999
|
-
const result = translator$c.encode({
|
|
35000
|
-
...params2,
|
|
35001
|
-
extraParams: {
|
|
35002
|
-
...params2.extraParams,
|
|
35003
|
-
node,
|
|
35004
|
-
columnIndex: startColumn,
|
|
35005
|
-
columnWidth
|
|
35006
|
-
}
|
|
35007
|
-
});
|
|
35008
|
-
if (result) {
|
|
35009
|
-
content.push(result);
|
|
35010
|
-
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
35011
|
-
const rowspan = Math.max(1, result.attrs?.rowspan || 1);
|
|
35012
|
-
if (rowspan > 1) {
|
|
35013
|
-
for (let offset2 = 0; offset2 < colspan; offset2 += 1) {
|
|
35014
|
-
const target = startColumn + offset2;
|
|
35015
|
-
if (target < pendingRowSpans.length) {
|
|
35016
|
-
pendingRowSpans[target] = Math.max(pendingRowSpans[target], rowspan - 1);
|
|
35017
|
-
}
|
|
35018
|
-
}
|
|
35019
|
-
}
|
|
35020
|
-
currentColumnIndex = startColumn + colspan;
|
|
35021
|
-
}
|
|
35022
|
-
});
|
|
35023
|
-
skipOccupiedColumns();
|
|
35024
|
-
fillUntil(totalColumns, "gridAfter");
|
|
35025
|
-
const newNode = {
|
|
35026
|
-
type: "tableRow",
|
|
35027
|
-
content,
|
|
35028
|
-
attrs: encodedAttrs
|
|
35029
|
-
};
|
|
35030
|
-
return newNode;
|
|
35031
|
-
};
|
|
35032
|
-
const decode$p = (params2, decodedAttrs) => {
|
|
35033
|
-
const { node } = params2;
|
|
35034
|
-
const cells = node.content || [];
|
|
35035
|
-
let leadingPlaceholders = 0;
|
|
35036
|
-
while (leadingPlaceholders < cells.length && isPlaceholderCell(cells[leadingPlaceholders])) {
|
|
35037
|
-
leadingPlaceholders += 1;
|
|
35038
|
-
}
|
|
35039
|
-
let trailingPlaceholders = 0;
|
|
35040
|
-
while (trailingPlaceholders < cells.length - leadingPlaceholders && isPlaceholderCell(cells[cells.length - 1 - trailingPlaceholders])) {
|
|
35041
|
-
trailingPlaceholders += 1;
|
|
35042
|
-
}
|
|
35043
|
-
const trimmedSlice = cells.slice(leadingPlaceholders, cells.length - trailingPlaceholders);
|
|
35044
|
-
const sanitizedCells = trimmedSlice.map((cell) => {
|
|
35045
|
-
if (cell?.attrs && "__placeholder" in cell.attrs) {
|
|
35046
|
-
const { __placeholder, ...rest } = cell.attrs;
|
|
35047
|
-
return { ...cell, attrs: rest };
|
|
35048
|
-
}
|
|
35049
|
-
return cell;
|
|
35050
|
-
});
|
|
35051
|
-
const trimmedContent = sanitizedCells.filter((_2, index2) => !isPlaceholderCell(trimmedSlice[index2]));
|
|
35052
|
-
const translateParams = {
|
|
35053
|
-
...params2,
|
|
35054
|
-
node: { ...node, content: trimmedContent }
|
|
35055
|
-
};
|
|
35056
|
-
const elements = translateChildNodes(translateParams);
|
|
35057
|
-
if (node.attrs?.tableRowProperties) {
|
|
35058
|
-
const tableRowProperties = { ...node.attrs.tableRowProperties };
|
|
35059
|
-
if (leadingPlaceholders > 0) {
|
|
35060
|
-
tableRowProperties.gridBefore = leadingPlaceholders;
|
|
35061
|
-
}
|
|
35062
|
-
if (trailingPlaceholders > 0) {
|
|
35063
|
-
tableRowProperties.gridAfter = trailingPlaceholders;
|
|
35064
|
-
}
|
|
35065
|
-
if (node.attrs.rowHeight != null) {
|
|
35066
|
-
const rowHeightPixels = twipsToPixels(node.attrs.tableRowProperties["rowHeight"]?.value);
|
|
35067
|
-
if (rowHeightPixels !== node.attrs.rowHeight) {
|
|
35068
|
-
tableRowProperties["rowHeight"] = { value: String(pixelsToTwips(node.attrs["rowHeight"])) };
|
|
35069
|
-
}
|
|
35070
|
-
}
|
|
35071
|
-
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
35072
|
-
const trPr = translator$_.decode({
|
|
35073
|
-
...params2,
|
|
35074
|
-
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
35075
|
-
});
|
|
35076
|
-
if (trPr) elements.unshift(trPr);
|
|
35077
|
-
}
|
|
35078
|
-
return {
|
|
35079
|
-
name: "w:tr",
|
|
35080
|
-
attributes: decodedAttrs || {},
|
|
35081
|
-
elements
|
|
35082
|
-
};
|
|
35083
|
-
};
|
|
35084
|
-
const config$g = {
|
|
35085
|
-
xmlName: XML_NODE_NAME$h,
|
|
35086
|
-
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
35087
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
35088
|
-
encode: encode$n,
|
|
35089
|
-
decode: decode$p,
|
|
35090
|
-
attributes: validXmlAttributes$b
|
|
35091
|
-
};
|
|
35092
|
-
const translator$Z = NodeTranslator.from(config$g);
|
|
35093
|
-
const translator$Y = NodeTranslator.from({
|
|
35094
|
-
xmlName: "w:bidiVisual",
|
|
35095
|
-
sdNodeOrKeyName: "rightToLeft",
|
|
35096
|
-
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
35097
|
-
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
35098
|
-
});
|
|
35099
|
-
const translator$X = NodeTranslator.from({
|
|
34768
|
+
const translator$19 = NodeTranslator.from({
|
|
35100
34769
|
xmlName: "w:shd",
|
|
35101
34770
|
sdNodeOrKeyName: "shading",
|
|
35102
34771
|
attributes: [
|
|
@@ -35118,895 +34787,284 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35118
34787
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
35119
34788
|
}
|
|
35120
34789
|
});
|
|
35121
|
-
const translator$
|
|
35122
|
-
const translator$
|
|
35123
|
-
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35130
|
-
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
35131
|
-
},
|
|
35132
|
-
decode: function({ node }, context) {
|
|
35133
|
-
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
35134
|
-
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
35135
|
-
}
|
|
35136
|
-
});
|
|
35137
|
-
const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
35138
|
-
const translator$Q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
35139
|
-
const translator$P = NodeTranslator.from(
|
|
35140
|
-
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
35141
|
-
);
|
|
35142
|
-
const translator$O = NodeTranslator.from(
|
|
35143
|
-
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
34790
|
+
const translator$18 = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
34791
|
+
const translator$17 = NodeTranslator.from(
|
|
34792
|
+
createSingleAttrPropertyHandler(
|
|
34793
|
+
"w:gridSpan",
|
|
34794
|
+
null,
|
|
34795
|
+
"w:val",
|
|
34796
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
34797
|
+
(v2) => integerToString(v2)
|
|
34798
|
+
)
|
|
35144
34799
|
);
|
|
35145
|
-
const translator$
|
|
35146
|
-
const translator$
|
|
35147
|
-
|
|
35148
|
-
|
|
35149
|
-
|
|
35150
|
-
|
|
35151
|
-
|
|
35152
|
-
|
|
35153
|
-
|
|
35154
|
-
|
|
35155
|
-
|
|
35156
|
-
|
|
35157
|
-
|
|
35158
|
-
const translator$
|
|
35159
|
-
const translator$
|
|
35160
|
-
const translator$
|
|
35161
|
-
const translator$
|
|
35162
|
-
const
|
|
35163
|
-
|
|
35164
|
-
|
|
35165
|
-
|
|
35166
|
-
|
|
35167
|
-
|
|
35168
|
-
|
|
35169
|
-
|
|
35170
|
-
|
|
35171
|
-
|
|
35172
|
-
|
|
35173
|
-
translator$L,
|
|
35174
|
-
translator$J,
|
|
35175
|
-
translator$H,
|
|
35176
|
-
translator$G,
|
|
35177
|
-
translator$F,
|
|
35178
|
-
translator$D,
|
|
35179
|
-
translator$B,
|
|
35180
|
-
translator$z
|
|
34800
|
+
const translator$16 = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
|
|
34801
|
+
const translator$15 = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
34802
|
+
const translator$14 = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
34803
|
+
const translator$13 = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
34804
|
+
const translator$12 = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
34805
|
+
const translator$11 = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
34806
|
+
const translator$10 = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
34807
|
+
const translator$$ = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
34808
|
+
const translator$_ = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
34809
|
+
const translator$Z = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
34810
|
+
const translator$Y = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
34811
|
+
const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
34812
|
+
const translator$W = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
34813
|
+
const translator$V = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
34814
|
+
const translator$U = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
34815
|
+
const translator$T = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
|
|
34816
|
+
const translator$S = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
|
|
34817
|
+
const propertyTranslators$6 = [
|
|
34818
|
+
translator$V,
|
|
34819
|
+
translator$X,
|
|
34820
|
+
translator$$,
|
|
34821
|
+
translator$15,
|
|
34822
|
+
translator$13,
|
|
34823
|
+
translator$Z,
|
|
34824
|
+
translator$11,
|
|
34825
|
+
translator$10,
|
|
34826
|
+
translator$T,
|
|
34827
|
+
translator$S
|
|
35181
34828
|
];
|
|
35182
|
-
const translator$
|
|
35183
|
-
createNestedPropertiesTranslator("w:
|
|
34829
|
+
const translator$R = NodeTranslator.from(
|
|
34830
|
+
createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$6)
|
|
35184
34831
|
);
|
|
35185
|
-
const
|
|
35186
|
-
|
|
35187
|
-
|
|
35188
|
-
|
|
35189
|
-
|
|
35190
|
-
|
|
35191
|
-
|
|
35192
|
-
|
|
35193
|
-
const translator$w = NodeTranslator.from(
|
|
35194
|
-
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$4)
|
|
34832
|
+
const translator$Q = NodeTranslator.from(
|
|
34833
|
+
createSingleAttrPropertyHandler(
|
|
34834
|
+
"w:noWrap",
|
|
34835
|
+
null,
|
|
34836
|
+
"w:val",
|
|
34837
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
34838
|
+
(v2) => booleanToString(v2)
|
|
34839
|
+
)
|
|
35195
34840
|
);
|
|
35196
|
-
const propertyTranslators$
|
|
35197
|
-
translator$Y,
|
|
34841
|
+
const propertyTranslators$5 = [
|
|
35198
34842
|
translator$14,
|
|
35199
|
-
translator$
|
|
34843
|
+
translator$12,
|
|
34844
|
+
translator$_,
|
|
34845
|
+
translator$Y,
|
|
35200
34846
|
translator$W,
|
|
35201
|
-
translator$
|
|
35202
|
-
translator$V,
|
|
35203
|
-
translator$U,
|
|
35204
|
-
translator$T,
|
|
35205
|
-
translator$S,
|
|
35206
|
-
translator$R,
|
|
35207
|
-
translator$Q,
|
|
35208
|
-
translator$P,
|
|
35209
|
-
translator$O,
|
|
35210
|
-
translator$N,
|
|
35211
|
-
translator$M,
|
|
35212
|
-
translator$x,
|
|
35213
|
-
translator$w
|
|
34847
|
+
translator$U
|
|
35214
34848
|
];
|
|
35215
|
-
const translator$
|
|
35216
|
-
createNestedPropertiesTranslator("w:
|
|
34849
|
+
const translator$P = NodeTranslator.from(
|
|
34850
|
+
createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$5)
|
|
35217
34851
|
);
|
|
35218
|
-
const translator$
|
|
35219
|
-
|
|
34852
|
+
const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
|
|
34853
|
+
const translator$N = NodeTranslator.from(
|
|
34854
|
+
createSingleAttrPropertyHandler(
|
|
34855
|
+
"w:tcFitText",
|
|
34856
|
+
null,
|
|
34857
|
+
"w:val",
|
|
34858
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
34859
|
+
(v2) => booleanToString(v2)
|
|
34860
|
+
)
|
|
35220
34861
|
);
|
|
35221
|
-
const
|
|
35222
|
-
const
|
|
35223
|
-
|
|
35224
|
-
|
|
35225
|
-
|
|
35226
|
-
|
|
35227
|
-
|
|
35228
|
-
|
|
35229
|
-
|
|
35230
|
-
|
|
35231
|
-
|
|
35232
|
-
|
|
35233
|
-
|
|
35234
|
-
|
|
35235
|
-
} else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
|
|
35236
|
-
return defaultValue;
|
|
35237
|
-
}
|
|
35238
|
-
return DEFAULT_COLUMN_WIDTH_PX;
|
|
35239
|
-
};
|
|
35240
|
-
const getTableWidthPx = (params2) => {
|
|
35241
|
-
const explicitWidth = params2?.node?.attrs?.tableWidth?.width;
|
|
35242
|
-
if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
|
|
35243
|
-
const tableWidth = params2?.node?.attrs?.tableProperties?.tableWidth;
|
|
35244
|
-
if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
|
|
35245
|
-
const { value, type: type2 } = tableWidth;
|
|
35246
|
-
if (!type2 || type2 === "auto" || type2 === "dxa") {
|
|
35247
|
-
return twipsToPixels(value);
|
|
35248
|
-
}
|
|
35249
|
-
}
|
|
35250
|
-
return null;
|
|
35251
|
-
};
|
|
35252
|
-
const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwips) => {
|
|
35253
|
-
const columnCount = Math.max(totalColumns, 1);
|
|
35254
|
-
const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params2);
|
|
35255
|
-
const tableWidthPx = getTableWidthPx(params2);
|
|
35256
|
-
const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
35257
|
-
let fallbackWidthPx = safeDefaultPx;
|
|
35258
|
-
if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
|
|
35259
|
-
fallbackWidthPx = tableWidthPx / columnCount;
|
|
35260
|
-
}
|
|
35261
|
-
const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
|
|
35262
|
-
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
|
|
35263
|
-
const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
35264
|
-
return safeDefault;
|
|
35265
|
-
}
|
|
35266
|
-
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
35267
|
-
};
|
|
35268
|
-
const XML_NODE_NAME$g = "w:tblGrid";
|
|
35269
|
-
const SD_ATTR_KEY$3 = "grid";
|
|
35270
|
-
const cellMinWidth = pixelsToTwips(10);
|
|
35271
|
-
const encode$m = (params2) => {
|
|
34862
|
+
const translator$M = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
|
|
34863
|
+
const translator$L = NodeTranslator.from(
|
|
34864
|
+
createSingleAttrPropertyHandler(
|
|
34865
|
+
"w:hideMark",
|
|
34866
|
+
null,
|
|
34867
|
+
"w:val",
|
|
34868
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
34869
|
+
(v2) => booleanToString(v2)
|
|
34870
|
+
)
|
|
34871
|
+
);
|
|
34872
|
+
const translator$K = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
|
|
34873
|
+
const XML_NODE_NAME$h = "w:headers";
|
|
34874
|
+
const SD_ATTR_KEY$3 = "headers";
|
|
34875
|
+
const encode$n = (params2) => {
|
|
35272
34876
|
const { nodes } = params2;
|
|
35273
34877
|
const node = nodes[0];
|
|
35274
|
-
const attributes = encodeProperties(node, { [translator$
|
|
34878
|
+
const attributes = encodeProperties(node, { [translator$K.xmlName]: translator$K }, true);
|
|
35275
34879
|
return {
|
|
35276
|
-
xmlName: XML_NODE_NAME$
|
|
34880
|
+
xmlName: XML_NODE_NAME$h,
|
|
35277
34881
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
35278
34882
|
attributes
|
|
35279
34883
|
};
|
|
35280
34884
|
};
|
|
35281
|
-
const decode$
|
|
35282
|
-
const {
|
|
35283
|
-
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
35284
|
-
const { firstRow = {} } = params2.extraParams || {};
|
|
35285
|
-
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
35286
|
-
const columnCountFromCells = cellNodes.reduce((count, cell) => {
|
|
35287
|
-
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
35288
|
-
return count + spanCount;
|
|
35289
|
-
}, 0);
|
|
35290
|
-
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
35291
|
-
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
|
|
35292
|
-
const elements = [];
|
|
35293
|
-
let columnIndex = 0;
|
|
35294
|
-
const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
|
|
35295
|
-
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
35296
|
-
let shouldEnforceMinimum = enforceMinimum;
|
|
35297
|
-
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
35298
|
-
numericWidth = fallbackColumnWidthTwips;
|
|
35299
|
-
shouldEnforceMinimum = true;
|
|
35300
|
-
}
|
|
35301
|
-
const roundedWidth = Math.round(numericWidth);
|
|
35302
|
-
const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
|
|
35303
|
-
const safeWidth = Math.max(roundedWidth, minimumWidth);
|
|
35304
|
-
const decoded = translator$u.decode({
|
|
35305
|
-
node: { type: (
|
|
35306
|
-
/** @type {string} */
|
|
35307
|
-
translator$u.sdNodeOrKeyName
|
|
35308
|
-
), attrs: { col: safeWidth } }
|
|
35309
|
-
});
|
|
35310
|
-
if (decoded) elements.push(decoded);
|
|
35311
|
-
};
|
|
35312
|
-
cellNodes.forEach((cell) => {
|
|
35313
|
-
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
35314
|
-
const spanCount = Math.max(1, colspan);
|
|
35315
|
-
for (let span = 0; span < spanCount; span++) {
|
|
35316
|
-
const rawWidth = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
35317
|
-
const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
|
|
35318
|
-
const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
|
|
35319
|
-
const colGridAttrs = grid?.[columnIndex] || {};
|
|
35320
|
-
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
35321
|
-
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
35322
|
-
let cellWidthTwips;
|
|
35323
|
-
let enforceMinimum = false;
|
|
35324
|
-
if (hasCellWidth) {
|
|
35325
|
-
const tolerance = 0.5;
|
|
35326
|
-
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
35327
|
-
cellWidthTwips = gridWidthTwips;
|
|
35328
|
-
} else {
|
|
35329
|
-
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
35330
|
-
}
|
|
35331
|
-
} else if (gridWidthTwips != null) {
|
|
35332
|
-
cellWidthTwips = gridWidthTwips;
|
|
35333
|
-
} else {
|
|
35334
|
-
cellWidthTwips = fallbackColumnWidthTwips;
|
|
35335
|
-
enforceMinimum = true;
|
|
35336
|
-
}
|
|
35337
|
-
pushColumn(cellWidthTwips, { enforceMinimum });
|
|
35338
|
-
columnIndex++;
|
|
35339
|
-
}
|
|
35340
|
-
});
|
|
35341
|
-
while (columnIndex < grid.length) {
|
|
35342
|
-
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
35343
|
-
pushColumn(gridWidthTwips);
|
|
35344
|
-
columnIndex++;
|
|
35345
|
-
}
|
|
34885
|
+
const decode$p = (params2) => {
|
|
34886
|
+
const { headers = [] } = params2.node.attrs || {};
|
|
35346
34887
|
const newNode = {
|
|
35347
|
-
name: XML_NODE_NAME$
|
|
34888
|
+
name: XML_NODE_NAME$h,
|
|
35348
34889
|
attributes: {},
|
|
35349
|
-
elements
|
|
34890
|
+
elements: headers.map(
|
|
34891
|
+
(header) => translator$K.decode({
|
|
34892
|
+
node: { type: "header", attrs: header }
|
|
34893
|
+
})
|
|
34894
|
+
)
|
|
35350
34895
|
};
|
|
35351
34896
|
return newNode;
|
|
35352
34897
|
};
|
|
35353
|
-
const config$
|
|
35354
|
-
xmlName: XML_NODE_NAME$
|
|
34898
|
+
const config$g = {
|
|
34899
|
+
xmlName: XML_NODE_NAME$h,
|
|
35355
34900
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
35356
|
-
encode: encode$
|
|
35357
|
-
decode: decode$
|
|
35358
|
-
};
|
|
35359
|
-
const translator$t = NodeTranslator.from(config$f);
|
|
35360
|
-
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
35361
|
-
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
35362
|
-
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
35363
|
-
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
35364
|
-
const pctToPercent = (value) => {
|
|
35365
|
-
if (value == null) return null;
|
|
35366
|
-
return value / 50;
|
|
34901
|
+
encode: encode$n,
|
|
34902
|
+
decode: decode$p
|
|
35367
34903
|
};
|
|
35368
|
-
const
|
|
35369
|
-
const
|
|
35370
|
-
|
|
35371
|
-
|
|
35372
|
-
|
|
35373
|
-
|
|
35374
|
-
|
|
35375
|
-
|
|
35376
|
-
|
|
35377
|
-
|
|
35378
|
-
|
|
34904
|
+
const translator$J = NodeTranslator.from(config$g);
|
|
34905
|
+
const propertyTranslators$4 = [
|
|
34906
|
+
translator$1a,
|
|
34907
|
+
translator$18,
|
|
34908
|
+
translator$17,
|
|
34909
|
+
translator$16,
|
|
34910
|
+
translator$R,
|
|
34911
|
+
translator$19,
|
|
34912
|
+
translator$Q,
|
|
34913
|
+
translator$P,
|
|
34914
|
+
translator$O,
|
|
34915
|
+
translator$N,
|
|
34916
|
+
translator$M,
|
|
34917
|
+
translator$L,
|
|
34918
|
+
translator$J
|
|
34919
|
+
];
|
|
34920
|
+
const translator$I = NodeTranslator.from(
|
|
34921
|
+
createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators$4)
|
|
34922
|
+
);
|
|
34923
|
+
function handleTableCellNode({
|
|
34924
|
+
params: params2,
|
|
34925
|
+
node,
|
|
34926
|
+
table,
|
|
34927
|
+
row,
|
|
34928
|
+
rowBorders,
|
|
34929
|
+
columnIndex,
|
|
34930
|
+
columnWidth = null,
|
|
34931
|
+
allColumnWidths = [],
|
|
34932
|
+
_referencedStyles
|
|
34933
|
+
}) {
|
|
34934
|
+
const { nodeListHandler } = params2;
|
|
34935
|
+
const attributes = {};
|
|
34936
|
+
const referencedStyles = _referencedStyles ?? { fontSize: null, fonts: {}, cellMargins: {} };
|
|
34937
|
+
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
34938
|
+
const tableCellProperties = tcPr ? translator$I.encode({ ...params2, nodes: [tcPr] }) ?? {} : {};
|
|
34939
|
+
attributes["tableCellProperties"] = tableCellProperties;
|
|
34940
|
+
if (rowBorders?.insideH) {
|
|
34941
|
+
rowBorders["bottom"] = rowBorders.insideH;
|
|
34942
|
+
delete rowBorders.insideH;
|
|
35379
34943
|
}
|
|
35380
|
-
|
|
35381
|
-
|
|
35382
|
-
|
|
35383
|
-
if (!row?.elements?.length) return 0;
|
|
35384
|
-
return row.elements.reduce((count, element) => {
|
|
35385
|
-
if (element.name !== "w:tc") return count;
|
|
35386
|
-
const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
|
|
35387
|
-
const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
35388
|
-
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
35389
|
-
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
35390
|
-
}, 0);
|
|
35391
|
-
};
|
|
35392
|
-
const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
35393
|
-
const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
35394
|
-
const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWidthMeasurement }) => {
|
|
35395
|
-
const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
|
|
35396
|
-
const columnCount = countColumnsInRow(firstRow);
|
|
35397
|
-
if (!columnCount) return null;
|
|
35398
|
-
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
|
|
35399
|
-
/** @type {any} */
|
|
35400
|
-
params2
|
|
35401
|
-
);
|
|
35402
|
-
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
35403
|
-
let totalWidthPx;
|
|
35404
|
-
if (tableWidthMeasurement) {
|
|
35405
|
-
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
35406
|
-
if (resolved != null) totalWidthPx = resolved;
|
|
34944
|
+
if (rowBorders?.insideV) {
|
|
34945
|
+
rowBorders["right"] = rowBorders.insideV;
|
|
34946
|
+
delete rowBorders?.insideV;
|
|
35407
34947
|
}
|
|
35408
|
-
if (
|
|
35409
|
-
|
|
34948
|
+
if (rowBorders) attributes["borders"] = { ...rowBorders };
|
|
34949
|
+
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, rowBorders);
|
|
34950
|
+
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"] || {}, inlineBorders);
|
|
34951
|
+
const colspan = tableCellProperties.gridSpan;
|
|
34952
|
+
if (colspan && !isNaN(parseInt(colspan, 10))) attributes["colspan"] = parseInt(colspan, 10);
|
|
34953
|
+
let width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
|
|
34954
|
+
const widthType = tableCellProperties.cellWidth?.type;
|
|
34955
|
+
if (widthType) attributes["widthType"] = widthType;
|
|
34956
|
+
if (!width && columnWidth) width = columnWidth;
|
|
34957
|
+
if (width) {
|
|
34958
|
+
attributes["colwidth"] = [width];
|
|
34959
|
+
attributes["widthUnit"] = "px";
|
|
34960
|
+
const defaultColWidths = allColumnWidths;
|
|
34961
|
+
const hasDefaultColWidths = allColumnWidths && allColumnWidths.length > 0;
|
|
34962
|
+
const colspanNum = parseInt(colspan || 1, 10);
|
|
34963
|
+
if (colspanNum && colspanNum > 1 && hasDefaultColWidths) {
|
|
34964
|
+
let colwidth = [];
|
|
34965
|
+
for (let i2 = 0; i2 < colspanNum; i2++) {
|
|
34966
|
+
let colwidthValue = defaultColWidths[columnIndex + i2];
|
|
34967
|
+
let defaultColwidth = 100;
|
|
34968
|
+
if (typeof colwidthValue !== "undefined") {
|
|
34969
|
+
colwidth.push(colwidthValue);
|
|
34970
|
+
} else {
|
|
34971
|
+
colwidth.push(defaultColwidth);
|
|
34972
|
+
}
|
|
34973
|
+
}
|
|
34974
|
+
if (colwidth.length) {
|
|
34975
|
+
attributes["colwidth"] = [...colwidth];
|
|
34976
|
+
}
|
|
34977
|
+
}
|
|
35410
34978
|
}
|
|
35411
|
-
|
|
35412
|
-
|
|
34979
|
+
const background = {
|
|
34980
|
+
color: tableCellProperties.shading?.fill
|
|
34981
|
+
};
|
|
34982
|
+
if (background.color) attributes["background"] = background;
|
|
34983
|
+
const verticalAlign = tableCellProperties.vAlign;
|
|
34984
|
+
if (verticalAlign) attributes["verticalAlign"] = verticalAlign;
|
|
34985
|
+
attributes.cellMargins = getTableCellMargins(tableCellProperties.cellMargins, referencedStyles);
|
|
34986
|
+
const { fontSize: fontSize2, fonts = {} } = referencedStyles;
|
|
34987
|
+
const fontFamily2 = fonts["ascii"];
|
|
34988
|
+
if (fontSize2) attributes["fontSize"] = fontSize2;
|
|
34989
|
+
if (fontFamily2) attributes["fontFamily"] = fontFamily2;
|
|
34990
|
+
if (tableCellProperties.vMerge === "restart") {
|
|
34991
|
+
const rows = table.elements.filter((el) => el.name === "w:tr");
|
|
34992
|
+
const currentRowIndex = rows.findIndex((r2) => r2 === row);
|
|
34993
|
+
const remainingRows = rows.slice(currentRowIndex + 1);
|
|
34994
|
+
const cellsInRow = row.elements.filter((el) => el.name === "w:tc");
|
|
34995
|
+
let cellIndex = cellsInRow.findIndex((el) => el === node);
|
|
34996
|
+
let rowspan = 1;
|
|
34997
|
+
for (let remainingRow of remainingRows) {
|
|
34998
|
+
const firstCell = remainingRow.elements.findIndex((el) => el.name === "w:tc");
|
|
34999
|
+
const cellAtIndex = remainingRow.elements[firstCell + cellIndex];
|
|
35000
|
+
if (!cellAtIndex) break;
|
|
35001
|
+
const vMerge = getTableCellVMerge(cellAtIndex);
|
|
35002
|
+
if (!vMerge || vMerge === "restart") {
|
|
35003
|
+
break;
|
|
35004
|
+
}
|
|
35005
|
+
rowspan++;
|
|
35006
|
+
remainingRow.elements.splice(firstCell + cellIndex, 1);
|
|
35007
|
+
}
|
|
35008
|
+
attributes["rowspan"] = rowspan;
|
|
35413
35009
|
}
|
|
35414
|
-
const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
|
|
35415
|
-
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
|
|
35416
|
-
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
35417
35010
|
return {
|
|
35418
|
-
|
|
35419
|
-
|
|
35011
|
+
type: "tableCell",
|
|
35012
|
+
content: normalizeTableCellContent(
|
|
35013
|
+
nodeListHandler.handler({
|
|
35014
|
+
...params2,
|
|
35015
|
+
nodes: node.elements,
|
|
35016
|
+
path: [...params2.path || [], node]
|
|
35017
|
+
}),
|
|
35018
|
+
params2.editor
|
|
35019
|
+
),
|
|
35020
|
+
attrs: attributes
|
|
35420
35021
|
};
|
|
35421
|
-
}
|
|
35422
|
-
|
|
35423
|
-
|
|
35424
|
-
|
|
35425
|
-
const
|
|
35426
|
-
const
|
|
35427
|
-
const
|
|
35428
|
-
|
|
35429
|
-
const
|
|
35430
|
-
|
|
35431
|
-
|
|
35432
|
-
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
35433
|
-
if (tblGrid) {
|
|
35434
|
-
encodedAttrs["grid"] = translator$t.encode({ ...params2, nodes: [tblGrid] }).attributes;
|
|
35435
|
-
}
|
|
35436
|
-
[
|
|
35437
|
-
"tableStyleId",
|
|
35438
|
-
"justification",
|
|
35439
|
-
"tableLayout",
|
|
35440
|
-
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
35441
|
-
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
35442
|
-
].forEach((prop) => {
|
|
35443
|
-
let key2;
|
|
35444
|
-
let transform;
|
|
35445
|
-
if (Array.isArray(prop)) {
|
|
35446
|
-
[key2, transform] = prop;
|
|
35447
|
-
} else {
|
|
35448
|
-
key2 = prop;
|
|
35449
|
-
transform = (v2) => v2;
|
|
35022
|
+
}
|
|
35023
|
+
function normalizeTableCellContent(content, editor) {
|
|
35024
|
+
if (!Array.isArray(content) || content.length === 0) return content;
|
|
35025
|
+
const normalized = [];
|
|
35026
|
+
const pendingForNextBlock = [];
|
|
35027
|
+
const schema = editor?.schema;
|
|
35028
|
+
const cloneBlock = (node) => {
|
|
35029
|
+
if (!node) return node;
|
|
35030
|
+
const cloned = { ...node };
|
|
35031
|
+
if (Array.isArray(node.content)) {
|
|
35032
|
+
cloned.content = [...node.content];
|
|
35450
35033
|
}
|
|
35451
|
-
|
|
35452
|
-
|
|
35034
|
+
return cloned;
|
|
35035
|
+
};
|
|
35036
|
+
const ensureArray = (node) => {
|
|
35037
|
+
if (!Array.isArray(node.content)) {
|
|
35038
|
+
node.content = [];
|
|
35453
35039
|
}
|
|
35454
|
-
|
|
35455
|
-
|
|
35456
|
-
|
|
35457
|
-
|
|
35458
|
-
|
|
35459
|
-
|
|
35460
|
-
const
|
|
35461
|
-
if (
|
|
35462
|
-
|
|
35463
|
-
|
|
35464
|
-
|
|
35465
|
-
}
|
|
35466
|
-
} else if (tableWidthMeasurement.type === "auto") {
|
|
35467
|
-
encodedAttrs.tableWidth = {
|
|
35468
|
-
width: 0,
|
|
35469
|
-
type: tableWidthMeasurement.type
|
|
35470
|
-
};
|
|
35040
|
+
return node.content;
|
|
35041
|
+
};
|
|
35042
|
+
const isInlineNode = (node) => {
|
|
35043
|
+
if (!node || typeof node.type !== "string") return false;
|
|
35044
|
+
if (node.type === "text") return true;
|
|
35045
|
+
if (node.type === "bookmarkStart" || node.type === "bookmarkEnd") return true;
|
|
35046
|
+
const nodeType = schema?.nodes?.[node.type];
|
|
35047
|
+
if (nodeType) {
|
|
35048
|
+
if (typeof nodeType.isInline === "boolean") return nodeType.isInline;
|
|
35049
|
+
if (nodeType.spec?.group && typeof nodeType.spec.group === "string") {
|
|
35050
|
+
return nodeType.spec.group.split(" ").includes("inline");
|
|
35051
|
+
}
|
|
35471
35052
|
}
|
|
35472
|
-
|
|
35473
|
-
|
|
35474
|
-
const
|
|
35475
|
-
|
|
35476
|
-
|
|
35477
|
-
|
|
35478
|
-
cellMargins: referencedStyles.cellMargins
|
|
35479
|
-
};
|
|
35480
|
-
}
|
|
35481
|
-
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
35482
|
-
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
35483
|
-
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
35484
|
-
encodedAttrs["borders"] = borderData;
|
|
35485
|
-
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
35486
|
-
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
35487
|
-
if (!columnWidths.length) {
|
|
35488
|
-
const fallback = buildFallbackGridForTable({
|
|
35489
|
-
params: params2,
|
|
35490
|
-
rows,
|
|
35491
|
-
tableWidth: encodedAttrs.tableWidth,
|
|
35492
|
-
tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
|
|
35493
|
-
});
|
|
35494
|
-
if (fallback) {
|
|
35495
|
-
encodedAttrs.grid = fallback.grid;
|
|
35496
|
-
columnWidths = fallback.columnWidths;
|
|
35053
|
+
return false;
|
|
35054
|
+
};
|
|
35055
|
+
for (const node of content) {
|
|
35056
|
+
if (!node || typeof node.type !== "string") {
|
|
35057
|
+
normalized.push(node);
|
|
35058
|
+
continue;
|
|
35497
35059
|
}
|
|
35498
|
-
|
|
35499
|
-
|
|
35500
|
-
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
35506
|
-
extraParams: {
|
|
35507
|
-
row,
|
|
35508
|
-
table: node,
|
|
35509
|
-
rowBorders: borderRowData,
|
|
35510
|
-
styleTag: tblStyleTag,
|
|
35511
|
-
columnWidths,
|
|
35512
|
-
activeRowSpans: activeRowSpans.slice(),
|
|
35513
|
-
rowIndex
|
|
35514
|
-
}
|
|
35515
|
-
});
|
|
35516
|
-
if (result) {
|
|
35517
|
-
content.push(result);
|
|
35518
|
-
if (totalColumns > 0) {
|
|
35519
|
-
const activeRowSpansForCurrentRow = activeRowSpans.slice();
|
|
35520
|
-
for (let col = 0; col < totalColumns; col++) {
|
|
35521
|
-
if (activeRowSpans[col] > 0) {
|
|
35522
|
-
activeRowSpans[col] -= 1;
|
|
35523
|
-
}
|
|
35524
|
-
}
|
|
35525
|
-
let columnIndex = 0;
|
|
35526
|
-
const advanceColumnIndex = () => {
|
|
35527
|
-
while (columnIndex < totalColumns && activeRowSpansForCurrentRow[columnIndex] > 0) {
|
|
35528
|
-
columnIndex += 1;
|
|
35529
|
-
}
|
|
35530
|
-
};
|
|
35531
|
-
advanceColumnIndex();
|
|
35532
|
-
result.content?.forEach((cell) => {
|
|
35533
|
-
advanceColumnIndex();
|
|
35534
|
-
const colspan = Math.max(1, cell.attrs?.colspan || 1);
|
|
35535
|
-
const rowspan = Math.max(1, cell.attrs?.rowspan || 1);
|
|
35536
|
-
if (rowspan > 1) {
|
|
35537
|
-
for (let offset2 = 0; offset2 < colspan && columnIndex + offset2 < totalColumns; offset2++) {
|
|
35538
|
-
const targetIndex = columnIndex + offset2;
|
|
35539
|
-
const remainingRows = rowspan - 1;
|
|
35540
|
-
if (remainingRows > 0 && remainingRows > activeRowSpans[targetIndex]) {
|
|
35541
|
-
activeRowSpans[targetIndex] = remainingRows;
|
|
35542
|
-
}
|
|
35543
|
-
}
|
|
35544
|
-
}
|
|
35545
|
-
columnIndex += colspan;
|
|
35546
|
-
advanceColumnIndex();
|
|
35547
|
-
});
|
|
35548
|
-
}
|
|
35549
|
-
}
|
|
35550
|
-
});
|
|
35551
|
-
return {
|
|
35552
|
-
type: "table",
|
|
35553
|
-
content,
|
|
35554
|
-
attrs: encodedAttrs
|
|
35555
|
-
};
|
|
35556
|
-
};
|
|
35557
|
-
const decode$n = (params2, decodedAttrs) => {
|
|
35558
|
-
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
35559
|
-
const { node } = params2;
|
|
35560
|
-
const elements = translateChildNodes(params2);
|
|
35561
|
-
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
35562
|
-
const properties = node.attrs.grid;
|
|
35563
|
-
const element = translator$t.decode({
|
|
35564
|
-
...params2,
|
|
35565
|
-
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
35566
|
-
extraParams: {
|
|
35567
|
-
firstRow
|
|
35568
|
-
}
|
|
35569
|
-
});
|
|
35570
|
-
if (element) elements.unshift(element);
|
|
35571
|
-
if (node.attrs?.tableProperties) {
|
|
35572
|
-
const properties2 = { ...node.attrs.tableProperties };
|
|
35573
|
-
const element2 = translator$v.decode({
|
|
35574
|
-
...params2,
|
|
35575
|
-
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
35576
|
-
});
|
|
35577
|
-
if (element2) elements.unshift(element2);
|
|
35578
|
-
}
|
|
35579
|
-
return {
|
|
35580
|
-
name: "w:tbl",
|
|
35581
|
-
attributes: decodedAttrs || {},
|
|
35582
|
-
elements
|
|
35583
|
-
};
|
|
35584
|
-
};
|
|
35585
|
-
function _processTableBorders(rawBorders) {
|
|
35586
|
-
const borders = {};
|
|
35587
|
-
const rowBorders = {};
|
|
35588
|
-
Object.entries(rawBorders).forEach(([name, attributes]) => {
|
|
35589
|
-
const attrs = {};
|
|
35590
|
-
const color = attributes.color;
|
|
35591
|
-
const size2 = attributes.size;
|
|
35592
|
-
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
35593
|
-
if (size2 && size2 !== "auto") attrs["size"] = eighthPointsToPixels(size2);
|
|
35594
|
-
const rowBorderNames = ["insideH", "insideV"];
|
|
35595
|
-
if (rowBorderNames.includes(name)) rowBorders[name] = attrs;
|
|
35596
|
-
borders[name] = attrs;
|
|
35597
|
-
});
|
|
35598
|
-
return {
|
|
35599
|
-
borders,
|
|
35600
|
-
rowBorders
|
|
35601
|
-
};
|
|
35602
|
-
}
|
|
35603
|
-
function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
35604
|
-
if (!tableStyleReference) return null;
|
|
35605
|
-
const stylesToReturn = {};
|
|
35606
|
-
const { docx } = params2;
|
|
35607
|
-
const styles = docx["word/styles.xml"];
|
|
35608
|
-
const { elements } = styles.elements[0];
|
|
35609
|
-
const styleElements = elements.filter((el) => el.name === "w:style");
|
|
35610
|
-
const styleTag = styleElements.find((el) => el.attributes["w:styleId"] === tableStyleReference);
|
|
35611
|
-
if (!styleTag) return null;
|
|
35612
|
-
stylesToReturn.name = styleTag.elements.find((el) => el.name === "w:name");
|
|
35613
|
-
const basedOn = styleTag.elements.find((el) => el.name === "w:basedOn");
|
|
35614
|
-
let baseTblPr;
|
|
35615
|
-
if (basedOn?.attributes) {
|
|
35616
|
-
const baseStyles = styleElements.find((el) => el.attributes["w:styleId"] === basedOn.attributes["w:val"]);
|
|
35617
|
-
baseTblPr = baseStyles ? baseStyles.elements.find((el) => el.name === "w:tblPr") : {};
|
|
35618
|
-
}
|
|
35619
|
-
const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
|
|
35620
|
-
if (pPr) {
|
|
35621
|
-
const justification = pPr.elements.find((el) => el.name === "w:jc");
|
|
35622
|
-
if (justification?.attributes) stylesToReturn.justification = justification.attributes["w:val"];
|
|
35623
|
-
}
|
|
35624
|
-
const rPr = styleTag?.elements.find((el) => el.name === "w:rPr");
|
|
35625
|
-
if (rPr) {
|
|
35626
|
-
const fonts = rPr.elements.find((el) => el.name === "w:rFonts");
|
|
35627
|
-
if (fonts) {
|
|
35628
|
-
const { "w:ascii": ascii, "w:hAnsi": hAnsi, "w:cs": cs } = fonts.attributes;
|
|
35629
|
-
stylesToReturn.fonts = { ascii, hAnsi, cs };
|
|
35630
|
-
}
|
|
35631
|
-
const fontSize2 = rPr.elements.find((el) => el.name === "w:sz");
|
|
35632
|
-
if (fontSize2?.attributes) stylesToReturn.fontSize = halfPointToPoints(fontSize2.attributes["w:val"]) + "pt";
|
|
35633
|
-
}
|
|
35634
|
-
const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
|
|
35635
|
-
if (tblPr && tblPr.elements) {
|
|
35636
|
-
if (baseTblPr && baseTblPr.elements) {
|
|
35637
|
-
tblPr.elements.push(...baseTblPr.elements);
|
|
35638
|
-
}
|
|
35639
|
-
const tableProperties = translator$v.encode({ ...params2, nodes: [tblPr] });
|
|
35640
|
-
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
35641
|
-
if (borders) stylesToReturn.borders = borders;
|
|
35642
|
-
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
35643
|
-
const cellMargins = {};
|
|
35644
|
-
Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
|
|
35645
|
-
if (attrs?.value != null) {
|
|
35646
|
-
cellMargins[key2] = {
|
|
35647
|
-
value: attrs.value,
|
|
35648
|
-
type: attrs.type || "dxa"
|
|
35649
|
-
};
|
|
35650
|
-
}
|
|
35651
|
-
});
|
|
35652
|
-
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
35653
|
-
}
|
|
35654
|
-
return stylesToReturn;
|
|
35655
|
-
}
|
|
35656
|
-
const config$e = {
|
|
35657
|
-
xmlName: XML_NODE_NAME$f,
|
|
35658
|
-
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
35659
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
35660
|
-
encode: encode$l,
|
|
35661
|
-
decode: decode$n,
|
|
35662
|
-
attributes: []
|
|
35663
|
-
};
|
|
35664
|
-
const translator$s = NodeTranslator.from(config$e);
|
|
35665
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$s);
|
|
35666
|
-
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
35667
|
-
if (!tblStyleTag) return null;
|
|
35668
|
-
const stylesToReturn = {};
|
|
35669
|
-
const { attributes = {} } = tblStyleTag;
|
|
35670
|
-
const tableStyleReference = attributes["w:val"];
|
|
35671
|
-
if (!tableStyleReference) return null;
|
|
35672
|
-
const styles = docx["word/styles.xml"];
|
|
35673
|
-
const { elements } = styles.elements[0];
|
|
35674
|
-
const styleElements = elements.filter((el) => el.name === "w:style");
|
|
35675
|
-
const styleTag = styleElements.find((el) => el.attributes["w:styleId"] === tableStyleReference);
|
|
35676
|
-
if (!styleTag) return null;
|
|
35677
|
-
stylesToReturn.name = styleTag.elements.find((el) => el.name === "w:name");
|
|
35678
|
-
const basedOn = styleTag.elements.find((el) => el.name === "w:basedOn");
|
|
35679
|
-
let baseTblPr;
|
|
35680
|
-
if (basedOn?.attributes) {
|
|
35681
|
-
const baseStyles = styleElements.find((el) => el.attributes["w:styleId"] === basedOn.attributes["w:val"]);
|
|
35682
|
-
baseTblPr = baseStyles ? baseStyles.elements.find((el) => el.name === "w:tblPr") : {};
|
|
35683
|
-
}
|
|
35684
|
-
const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
|
|
35685
|
-
if (pPr) {
|
|
35686
|
-
const justification = pPr.elements.find((el) => el.name === "w:jc");
|
|
35687
|
-
if (justification?.attributes) stylesToReturn.justification = justification.attributes["w:val"];
|
|
35688
|
-
}
|
|
35689
|
-
const rPr = styleTag?.elements.find((el) => el.name === "w:rPr");
|
|
35690
|
-
if (rPr) {
|
|
35691
|
-
const fonts = rPr.elements.find((el) => el.name === "w:rFonts");
|
|
35692
|
-
if (fonts) {
|
|
35693
|
-
const { "w:ascii": ascii, "w:hAnsi": hAnsi, "w:cs": cs } = fonts.attributes;
|
|
35694
|
-
stylesToReturn.fonts = { ascii, hAnsi, cs };
|
|
35695
|
-
}
|
|
35696
|
-
const fontSize2 = rPr.elements.find((el) => el.name === "w:sz");
|
|
35697
|
-
if (fontSize2?.attributes) stylesToReturn.fontSize = halfPointToPoints(fontSize2.attributes["w:val"]) + "pt";
|
|
35698
|
-
}
|
|
35699
|
-
const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
|
|
35700
|
-
if (tblPr && tblPr.elements) {
|
|
35701
|
-
if (baseTblPr && baseTblPr.elements) {
|
|
35702
|
-
tblPr.elements.push(...baseTblPr.elements);
|
|
35703
|
-
}
|
|
35704
|
-
const tableBorders = tblPr?.elements?.find((el) => el.name === "w:tblBorders");
|
|
35705
|
-
const { elements: borderElements = [] } = tableBorders || {};
|
|
35706
|
-
const { borders, rowBorders } = processTableBorders(borderElements);
|
|
35707
|
-
if (borders) stylesToReturn.borders = borders;
|
|
35708
|
-
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
35709
|
-
const tableCellMargin = tblPr?.elements.find((el) => el.name === "w:tblCellMar");
|
|
35710
|
-
if (tableCellMargin) {
|
|
35711
|
-
const marginLeft = tableCellMargin.elements.find((el) => el.name === "w:left");
|
|
35712
|
-
const marginRight = tableCellMargin.elements.find((el) => el.name === "w:right");
|
|
35713
|
-
const marginTop = tableCellMargin.elements.find((el) => el.name === "w:top");
|
|
35714
|
-
const marginBottom = tableCellMargin.elements.find((el) => el.name === "w:bottom");
|
|
35715
|
-
stylesToReturn.cellMargins = {
|
|
35716
|
-
marginLeft: marginLeft?.attributes["w:w"],
|
|
35717
|
-
marginRight: marginRight?.attributes["w:w"],
|
|
35718
|
-
marginTop: marginTop?.attributes["w:w"],
|
|
35719
|
-
marginBottom: marginBottom?.attributes["w:w"]
|
|
35720
|
-
};
|
|
35721
|
-
}
|
|
35722
|
-
}
|
|
35723
|
-
return stylesToReturn;
|
|
35724
|
-
}
|
|
35725
|
-
function processTableBorders(borderElements) {
|
|
35726
|
-
const borders = {};
|
|
35727
|
-
const rowBorders = {};
|
|
35728
|
-
borderElements.forEach((borderElement) => {
|
|
35729
|
-
const { name } = borderElement;
|
|
35730
|
-
const borderName = name.split("w:")[1];
|
|
35731
|
-
const { attributes } = borderElement;
|
|
35732
|
-
const attrs = {};
|
|
35733
|
-
const color = attributes["w:color"];
|
|
35734
|
-
const size2 = attributes["w:sz"];
|
|
35735
|
-
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
35736
|
-
if (size2 && size2 !== "auto") attrs["size"] = eighthPointsToPixels(size2);
|
|
35737
|
-
const rowBorderNames = ["insideH", "insideV"];
|
|
35738
|
-
if (rowBorderNames.includes(borderName)) rowBorders[borderName] = attrs;
|
|
35739
|
-
borders[borderName] = attrs;
|
|
35740
|
-
});
|
|
35741
|
-
return {
|
|
35742
|
-
borders,
|
|
35743
|
-
rowBorders
|
|
35744
|
-
};
|
|
35745
|
-
}
|
|
35746
|
-
const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
35747
|
-
const translator$q = NodeTranslator.from(
|
|
35748
|
-
createSingleAttrPropertyHandler(
|
|
35749
|
-
"w:gridSpan",
|
|
35750
|
-
null,
|
|
35751
|
-
"w:val",
|
|
35752
|
-
(v2) => parseInteger(v2) ?? void 0,
|
|
35753
|
-
(v2) => integerToString(v2)
|
|
35754
|
-
)
|
|
35755
|
-
);
|
|
35756
|
-
const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
|
|
35757
|
-
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
|
|
35758
|
-
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
|
|
35759
|
-
const propertyTranslators$2 = [
|
|
35760
|
-
translator$z,
|
|
35761
|
-
translator$B,
|
|
35762
|
-
translator$F,
|
|
35763
|
-
translator$L,
|
|
35764
|
-
translator$J,
|
|
35765
|
-
translator$D,
|
|
35766
|
-
translator$H,
|
|
35767
|
-
translator$G,
|
|
35768
|
-
translator$o,
|
|
35769
|
-
translator$n
|
|
35770
|
-
];
|
|
35771
|
-
const translator$m = NodeTranslator.from(
|
|
35772
|
-
createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$2)
|
|
35773
|
-
);
|
|
35774
|
-
const translator$l = NodeTranslator.from(
|
|
35775
|
-
createSingleAttrPropertyHandler(
|
|
35776
|
-
"w:noWrap",
|
|
35777
|
-
null,
|
|
35778
|
-
"w:val",
|
|
35779
|
-
(v2) => parseBoolean(v2 ?? "true"),
|
|
35780
|
-
(v2) => booleanToString(v2)
|
|
35781
|
-
)
|
|
35782
|
-
);
|
|
35783
|
-
const propertyTranslators$1 = [
|
|
35784
|
-
translator$K,
|
|
35785
|
-
translator$I,
|
|
35786
|
-
translator$E,
|
|
35787
|
-
translator$C,
|
|
35788
|
-
translator$A,
|
|
35789
|
-
translator$y
|
|
35790
|
-
];
|
|
35791
|
-
const translator$k = NodeTranslator.from(
|
|
35792
|
-
createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$1)
|
|
35793
|
-
);
|
|
35794
|
-
const translator$j = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
|
|
35795
|
-
const translator$i = NodeTranslator.from(
|
|
35796
|
-
createSingleAttrPropertyHandler(
|
|
35797
|
-
"w:tcFitText",
|
|
35798
|
-
null,
|
|
35799
|
-
"w:val",
|
|
35800
|
-
(v2) => parseBoolean(v2 ?? "true"),
|
|
35801
|
-
(v2) => booleanToString(v2)
|
|
35802
|
-
)
|
|
35803
|
-
);
|
|
35804
|
-
const translator$h = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
|
|
35805
|
-
const translator$g = NodeTranslator.from(
|
|
35806
|
-
createSingleAttrPropertyHandler(
|
|
35807
|
-
"w:hideMark",
|
|
35808
|
-
null,
|
|
35809
|
-
"w:val",
|
|
35810
|
-
(v2) => parseBoolean(v2 ?? "true"),
|
|
35811
|
-
(v2) => booleanToString(v2)
|
|
35812
|
-
)
|
|
35813
|
-
);
|
|
35814
|
-
const translator$f = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
|
|
35815
|
-
const XML_NODE_NAME$e = "w:headers";
|
|
35816
|
-
const SD_ATTR_KEY$2 = "headers";
|
|
35817
|
-
const encode$k = (params2) => {
|
|
35818
|
-
const { nodes } = params2;
|
|
35819
|
-
const node = nodes[0];
|
|
35820
|
-
const attributes = encodeProperties(node, { [translator$f.xmlName]: translator$f }, true);
|
|
35821
|
-
return {
|
|
35822
|
-
xmlName: XML_NODE_NAME$e,
|
|
35823
|
-
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
35824
|
-
attributes
|
|
35825
|
-
};
|
|
35826
|
-
};
|
|
35827
|
-
const decode$m = (params2) => {
|
|
35828
|
-
const { headers = [] } = params2.node.attrs || {};
|
|
35829
|
-
const newNode = {
|
|
35830
|
-
name: XML_NODE_NAME$e,
|
|
35831
|
-
attributes: {},
|
|
35832
|
-
elements: headers.map(
|
|
35833
|
-
(header) => translator$f.decode({
|
|
35834
|
-
node: { type: "header", attrs: header }
|
|
35835
|
-
})
|
|
35836
|
-
)
|
|
35837
|
-
};
|
|
35838
|
-
return newNode;
|
|
35839
|
-
};
|
|
35840
|
-
const config$d = {
|
|
35841
|
-
xmlName: XML_NODE_NAME$e,
|
|
35842
|
-
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
35843
|
-
encode: encode$k,
|
|
35844
|
-
decode: decode$m
|
|
35845
|
-
};
|
|
35846
|
-
const translator$e = NodeTranslator.from(config$d);
|
|
35847
|
-
const propertyTranslators = [
|
|
35848
|
-
translator$19,
|
|
35849
|
-
translator$r,
|
|
35850
|
-
translator$q,
|
|
35851
|
-
translator$p,
|
|
35852
|
-
translator$m,
|
|
35853
|
-
translator$X,
|
|
35854
|
-
translator$l,
|
|
35855
|
-
translator$k,
|
|
35856
|
-
translator$j,
|
|
35857
|
-
translator$i,
|
|
35858
|
-
translator$h,
|
|
35859
|
-
translator$g,
|
|
35860
|
-
translator$e
|
|
35861
|
-
];
|
|
35862
|
-
const translator$d = NodeTranslator.from(
|
|
35863
|
-
createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators)
|
|
35864
|
-
);
|
|
35865
|
-
function handleTableCellNode({
|
|
35866
|
-
params: params2,
|
|
35867
|
-
node,
|
|
35868
|
-
table,
|
|
35869
|
-
row,
|
|
35870
|
-
rowBorders,
|
|
35871
|
-
styleTag,
|
|
35872
|
-
columnIndex,
|
|
35873
|
-
columnWidth = null,
|
|
35874
|
-
allColumnWidths = []
|
|
35875
|
-
}) {
|
|
35876
|
-
const { docx, nodeListHandler } = params2;
|
|
35877
|
-
const attributes = {};
|
|
35878
|
-
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
35879
|
-
const tableCellProperties = tcPr ? translator$d.encode({ ...params2, nodes: [tcPr] }) ?? {} : {};
|
|
35880
|
-
attributes["tableCellProperties"] = tableCellProperties;
|
|
35881
|
-
if (rowBorders?.insideH) {
|
|
35882
|
-
rowBorders["bottom"] = rowBorders.insideH;
|
|
35883
|
-
delete rowBorders.insideH;
|
|
35884
|
-
}
|
|
35885
|
-
if (rowBorders?.insideV) {
|
|
35886
|
-
rowBorders["right"] = rowBorders.insideV;
|
|
35887
|
-
delete rowBorders?.insideV;
|
|
35888
|
-
}
|
|
35889
|
-
if (rowBorders) attributes["borders"] = { ...rowBorders };
|
|
35890
|
-
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, rowBorders);
|
|
35891
|
-
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"] || {}, inlineBorders);
|
|
35892
|
-
const colspan = tableCellProperties.gridSpan;
|
|
35893
|
-
if (colspan && !isNaN(parseInt(colspan, 10))) attributes["colspan"] = parseInt(colspan, 10);
|
|
35894
|
-
let width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
|
|
35895
|
-
const widthType = tableCellProperties.cellWidth?.type;
|
|
35896
|
-
if (widthType) attributes["widthType"] = widthType;
|
|
35897
|
-
if (!width && columnWidth) width = columnWidth;
|
|
35898
|
-
if (width) {
|
|
35899
|
-
attributes["colwidth"] = [width];
|
|
35900
|
-
attributes["widthUnit"] = "px";
|
|
35901
|
-
const defaultColWidths = allColumnWidths;
|
|
35902
|
-
const hasDefaultColWidths = allColumnWidths && allColumnWidths.length > 0;
|
|
35903
|
-
const colspanNum = parseInt(colspan || 1, 10);
|
|
35904
|
-
if (colspanNum && colspanNum > 1 && hasDefaultColWidths) {
|
|
35905
|
-
let colwidth = [];
|
|
35906
|
-
for (let i2 = 0; i2 < colspanNum; i2++) {
|
|
35907
|
-
let colwidthValue = defaultColWidths[columnIndex + i2];
|
|
35908
|
-
let defaultColwidth = 100;
|
|
35909
|
-
if (typeof colwidthValue !== "undefined") {
|
|
35910
|
-
colwidth.push(colwidthValue);
|
|
35911
|
-
} else {
|
|
35912
|
-
colwidth.push(defaultColwidth);
|
|
35913
|
-
}
|
|
35914
|
-
}
|
|
35915
|
-
if (colwidth.length) {
|
|
35916
|
-
attributes["colwidth"] = [...colwidth];
|
|
35917
|
-
}
|
|
35918
|
-
}
|
|
35919
|
-
}
|
|
35920
|
-
const background = {
|
|
35921
|
-
color: tableCellProperties.shading?.fill
|
|
35922
|
-
};
|
|
35923
|
-
if (background.color) attributes["background"] = background;
|
|
35924
|
-
const verticalAlign = tableCellProperties.vAlign;
|
|
35925
|
-
if (verticalAlign) attributes["verticalAlign"] = verticalAlign;
|
|
35926
|
-
const referencedStyles = getReferencedTableStyles(styleTag, docx) || { fontSize: null, fonts: {}, cellMargins: {} };
|
|
35927
|
-
attributes.cellMargins = getTableCellMargins(tableCellProperties.cellMargins, referencedStyles);
|
|
35928
|
-
const { fontSize: fontSize2, fonts = {} } = referencedStyles;
|
|
35929
|
-
const fontFamily2 = fonts["ascii"];
|
|
35930
|
-
if (fontSize2) attributes["fontSize"] = fontSize2;
|
|
35931
|
-
if (fontFamily2) attributes["fontFamily"] = fontFamily2;
|
|
35932
|
-
if (tableCellProperties.vMerge === "restart") {
|
|
35933
|
-
const rows = table.elements.filter((el) => el.name === "w:tr");
|
|
35934
|
-
const currentRowIndex = rows.findIndex((r2) => r2 === row);
|
|
35935
|
-
const remainingRows = rows.slice(currentRowIndex + 1);
|
|
35936
|
-
const cellsInRow = row.elements.filter((el) => el.name === "w:tc");
|
|
35937
|
-
let cellIndex = cellsInRow.findIndex((el) => el === node);
|
|
35938
|
-
let rowspan = 1;
|
|
35939
|
-
for (let remainingRow of remainingRows) {
|
|
35940
|
-
const firstCell = remainingRow.elements.findIndex((el) => el.name === "w:tc");
|
|
35941
|
-
const cellAtIndex = remainingRow.elements[firstCell + cellIndex];
|
|
35942
|
-
if (!cellAtIndex) break;
|
|
35943
|
-
const vMerge = getTableCellVMerge(cellAtIndex);
|
|
35944
|
-
if (!vMerge || vMerge === "restart") {
|
|
35945
|
-
break;
|
|
35946
|
-
}
|
|
35947
|
-
rowspan++;
|
|
35948
|
-
remainingRow.elements.splice(firstCell + cellIndex, 1);
|
|
35949
|
-
}
|
|
35950
|
-
attributes["rowspan"] = rowspan;
|
|
35951
|
-
}
|
|
35952
|
-
return {
|
|
35953
|
-
type: "tableCell",
|
|
35954
|
-
content: normalizeTableCellContent(
|
|
35955
|
-
nodeListHandler.handler({
|
|
35956
|
-
...params2,
|
|
35957
|
-
nodes: node.elements,
|
|
35958
|
-
path: [...params2.path || [], node]
|
|
35959
|
-
}),
|
|
35960
|
-
params2.editor
|
|
35961
|
-
),
|
|
35962
|
-
attrs: attributes
|
|
35963
|
-
};
|
|
35964
|
-
}
|
|
35965
|
-
function normalizeTableCellContent(content, editor) {
|
|
35966
|
-
if (!Array.isArray(content) || content.length === 0) return content;
|
|
35967
|
-
const normalized = [];
|
|
35968
|
-
const pendingForNextBlock = [];
|
|
35969
|
-
const schema = editor?.schema;
|
|
35970
|
-
const cloneBlock = (node) => {
|
|
35971
|
-
if (!node) return node;
|
|
35972
|
-
const cloned = { ...node };
|
|
35973
|
-
if (Array.isArray(node.content)) {
|
|
35974
|
-
cloned.content = [...node.content];
|
|
35975
|
-
}
|
|
35976
|
-
return cloned;
|
|
35977
|
-
};
|
|
35978
|
-
const ensureArray = (node) => {
|
|
35979
|
-
if (!Array.isArray(node.content)) {
|
|
35980
|
-
node.content = [];
|
|
35981
|
-
}
|
|
35982
|
-
return node.content;
|
|
35983
|
-
};
|
|
35984
|
-
const isInlineNode = (node) => {
|
|
35985
|
-
if (!node || typeof node.type !== "string") return false;
|
|
35986
|
-
if (node.type === "text") return true;
|
|
35987
|
-
if (node.type === "bookmarkStart" || node.type === "bookmarkEnd") return true;
|
|
35988
|
-
const nodeType = schema?.nodes?.[node.type];
|
|
35989
|
-
if (nodeType) {
|
|
35990
|
-
if (typeof nodeType.isInline === "boolean") return nodeType.isInline;
|
|
35991
|
-
if (nodeType.spec?.group && typeof nodeType.spec.group === "string") {
|
|
35992
|
-
return nodeType.spec.group.split(" ").includes("inline");
|
|
35993
|
-
}
|
|
35994
|
-
}
|
|
35995
|
-
return false;
|
|
35996
|
-
};
|
|
35997
|
-
for (const node of content) {
|
|
35998
|
-
if (!node || typeof node.type !== "string") {
|
|
35999
|
-
normalized.push(node);
|
|
36000
|
-
continue;
|
|
36001
|
-
}
|
|
36002
|
-
if (!isInlineNode(node)) {
|
|
36003
|
-
const blockNode = cloneBlock(node);
|
|
36004
|
-
if (pendingForNextBlock.length) {
|
|
36005
|
-
const blockContent = ensureArray(blockNode);
|
|
36006
|
-
const leadingInline = pendingForNextBlock.splice(0);
|
|
36007
|
-
blockNode.content = [...leadingInline, ...blockContent];
|
|
36008
|
-
} else if (Array.isArray(blockNode.content)) {
|
|
36009
|
-
blockNode.content = [...blockNode.content];
|
|
35060
|
+
if (!isInlineNode(node)) {
|
|
35061
|
+
const blockNode = cloneBlock(node);
|
|
35062
|
+
if (pendingForNextBlock.length) {
|
|
35063
|
+
const blockContent = ensureArray(blockNode);
|
|
35064
|
+
const leadingInline = pendingForNextBlock.splice(0);
|
|
35065
|
+
blockNode.content = [...leadingInline, ...blockContent];
|
|
35066
|
+
} else if (Array.isArray(blockNode.content)) {
|
|
35067
|
+
blockNode.content = [...blockNode.content];
|
|
36010
35068
|
}
|
|
36011
35069
|
normalized.push(blockNode);
|
|
36012
35070
|
continue;
|
|
@@ -36189,22 +35247,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36189
35247
|
} else if (tableCellProperties?.borders) {
|
|
36190
35248
|
delete tableCellProperties.borders;
|
|
36191
35249
|
}
|
|
36192
|
-
const result = translator$
|
|
35250
|
+
const result = translator$I.decode({ node: { ...node, attrs: { ...node.attrs, tableCellProperties } } });
|
|
36193
35251
|
return result;
|
|
36194
35252
|
}
|
|
36195
|
-
const XML_NODE_NAME$
|
|
36196
|
-
const SD_NODE_NAME$
|
|
36197
|
-
const validXmlAttributes$
|
|
36198
|
-
function encode$
|
|
35253
|
+
const XML_NODE_NAME$g = "w:tc";
|
|
35254
|
+
const SD_NODE_NAME$d = "tableCell";
|
|
35255
|
+
const validXmlAttributes$b = [];
|
|
35256
|
+
function encode$m(params2, encodedAttrs) {
|
|
36199
35257
|
const {
|
|
36200
35258
|
node,
|
|
36201
35259
|
table,
|
|
36202
35260
|
row,
|
|
36203
35261
|
rowBorders,
|
|
36204
|
-
styleTag,
|
|
36205
35262
|
columnIndex,
|
|
36206
35263
|
columnWidth,
|
|
36207
|
-
columnWidths: allColumnWidths
|
|
35264
|
+
columnWidths: allColumnWidths,
|
|
35265
|
+
_referencedStyles
|
|
36208
35266
|
} = params2.extraParams;
|
|
36209
35267
|
const schemaNode = handleTableCellNode({
|
|
36210
35268
|
params: params2,
|
|
@@ -36212,96 +35270,388 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36212
35270
|
table,
|
|
36213
35271
|
row,
|
|
36214
35272
|
rowBorders,
|
|
36215
|
-
styleTag,
|
|
36216
35273
|
columnIndex,
|
|
36217
35274
|
columnWidth,
|
|
36218
|
-
allColumnWidths
|
|
35275
|
+
allColumnWidths,
|
|
35276
|
+
_referencedStyles
|
|
36219
35277
|
});
|
|
36220
35278
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
36221
35279
|
schemaNode.attrs = { ...schemaNode.attrs, ...encodedAttrs };
|
|
36222
35280
|
}
|
|
36223
35281
|
return schemaNode;
|
|
36224
35282
|
}
|
|
36225
|
-
function decode$
|
|
35283
|
+
function decode$o(params2, decodedAttrs) {
|
|
36226
35284
|
const translated = translateTableCell(params2);
|
|
36227
35285
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
36228
35286
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
36229
35287
|
}
|
|
36230
35288
|
return translated;
|
|
36231
35289
|
}
|
|
36232
|
-
const config$
|
|
36233
|
-
xmlName: XML_NODE_NAME$
|
|
36234
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
35290
|
+
const config$f = {
|
|
35291
|
+
xmlName: XML_NODE_NAME$g,
|
|
35292
|
+
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
36235
35293
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36236
|
-
encode: encode$
|
|
36237
|
-
decode: decode$
|
|
36238
|
-
attributes: validXmlAttributes$
|
|
35294
|
+
encode: encode$m,
|
|
35295
|
+
decode: decode$o,
|
|
35296
|
+
attributes: validXmlAttributes$b
|
|
36239
35297
|
};
|
|
36240
|
-
const translator$
|
|
36241
|
-
|
|
36242
|
-
|
|
36243
|
-
|
|
36244
|
-
}
|
|
36245
|
-
|
|
36246
|
-
|
|
36247
|
-
|
|
36248
|
-
|
|
36249
|
-
|
|
36250
|
-
|
|
36251
|
-
|
|
36252
|
-
|
|
36253
|
-
|
|
36254
|
-
|
|
36255
|
-
|
|
36256
|
-
|
|
36257
|
-
|
|
36258
|
-
|
|
36259
|
-
|
|
36260
|
-
|
|
36261
|
-
|
|
36262
|
-
|
|
36263
|
-
|
|
36264
|
-
|
|
36265
|
-
|
|
36266
|
-
|
|
36267
|
-
|
|
36268
|
-
|
|
36269
|
-
|
|
36270
|
-
|
|
36271
|
-
|
|
36272
|
-
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
36279
|
-
|
|
36280
|
-
|
|
36281
|
-
|
|
36282
|
-
|
|
36283
|
-
|
|
36284
|
-
|
|
36285
|
-
|
|
36286
|
-
|
|
36287
|
-
|
|
36288
|
-
}
|
|
36289
|
-
const initialDisplayLabel = getSafeString(attrs.displayLabel);
|
|
36290
|
-
const extractedContent = getTextFromSdtContent(sdtContent);
|
|
36291
|
-
if (!attrs.defaultDisplayLabel) {
|
|
36292
|
-
if (initialDisplayLabel) {
|
|
36293
|
-
attrs.defaultDisplayLabel = initialDisplayLabel;
|
|
36294
|
-
} else if (aliasLabel) {
|
|
36295
|
-
attrs.defaultDisplayLabel = aliasLabel;
|
|
35298
|
+
const translator$H = NodeTranslator.from(config$f);
|
|
35299
|
+
const translator$G = NodeTranslator.from({
|
|
35300
|
+
xmlName: "w:cantSplit",
|
|
35301
|
+
sdNodeOrKeyName: "cantSplit",
|
|
35302
|
+
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
35303
|
+
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
35304
|
+
});
|
|
35305
|
+
const translator$F = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
35306
|
+
const translator$E = NodeTranslator.from(
|
|
35307
|
+
createSingleAttrPropertyHandler(
|
|
35308
|
+
"w:gridAfter",
|
|
35309
|
+
null,
|
|
35310
|
+
"w:val",
|
|
35311
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
35312
|
+
(v2) => integerToString(v2)
|
|
35313
|
+
)
|
|
35314
|
+
);
|
|
35315
|
+
const translator$D = NodeTranslator.from(
|
|
35316
|
+
createSingleAttrPropertyHandler(
|
|
35317
|
+
"w:gridBefore",
|
|
35318
|
+
null,
|
|
35319
|
+
"w:val",
|
|
35320
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
35321
|
+
(v2) => integerToString(v2)
|
|
35322
|
+
)
|
|
35323
|
+
);
|
|
35324
|
+
const translator$C = NodeTranslator.from({
|
|
35325
|
+
xmlName: "w:hidden",
|
|
35326
|
+
sdNodeOrKeyName: "hidden",
|
|
35327
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
35328
|
+
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
35329
|
+
});
|
|
35330
|
+
const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
35331
|
+
const translator$A = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
35332
|
+
const translator$z = NodeTranslator.from({
|
|
35333
|
+
xmlName: "w:tblHeader",
|
|
35334
|
+
sdNodeOrKeyName: "repeatHeader",
|
|
35335
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
35336
|
+
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
35337
|
+
});
|
|
35338
|
+
const translator$y = NodeTranslator.from({
|
|
35339
|
+
xmlName: "w:trHeight",
|
|
35340
|
+
sdNodeOrKeyName: "rowHeight",
|
|
35341
|
+
encode: ({ nodes }) => {
|
|
35342
|
+
const heightAttrs = {};
|
|
35343
|
+
const val = nodes[0].attributes["w:val"];
|
|
35344
|
+
if (val) {
|
|
35345
|
+
heightAttrs["value"] = parseInt(val, 10);
|
|
36296
35346
|
}
|
|
36297
|
-
|
|
36298
|
-
|
|
36299
|
-
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
|
|
36304
|
-
attrs
|
|
35347
|
+
const rule = nodes[0].attributes["w:hRule"];
|
|
35348
|
+
if (rule) {
|
|
35349
|
+
heightAttrs["rule"] = rule;
|
|
35350
|
+
}
|
|
35351
|
+
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
35352
|
+
},
|
|
35353
|
+
decode: ({ node }) => {
|
|
35354
|
+
if (!node.attrs?.rowHeight) return;
|
|
35355
|
+
const heightAttrs = {};
|
|
35356
|
+
if (typeof node.attrs.rowHeight.value === "number" && !isNaN(node.attrs.rowHeight.value)) {
|
|
35357
|
+
heightAttrs["w:val"] = String(node.attrs.rowHeight.value);
|
|
35358
|
+
}
|
|
35359
|
+
if (node.attrs.rowHeight.rule) {
|
|
35360
|
+
heightAttrs["w:hRule"] = node.attrs.rowHeight.rule;
|
|
35361
|
+
}
|
|
35362
|
+
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
35363
|
+
}
|
|
35364
|
+
});
|
|
35365
|
+
const translator$x = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
35366
|
+
const translator$w = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
35367
|
+
const propertyTranslators$3 = [
|
|
35368
|
+
translator$G,
|
|
35369
|
+
translator$1a,
|
|
35370
|
+
translator$F,
|
|
35371
|
+
translator$E,
|
|
35372
|
+
translator$D,
|
|
35373
|
+
translator$C,
|
|
35374
|
+
translator$B,
|
|
35375
|
+
translator$A,
|
|
35376
|
+
translator$z,
|
|
35377
|
+
translator$y,
|
|
35378
|
+
translator$x,
|
|
35379
|
+
translator$w
|
|
35380
|
+
];
|
|
35381
|
+
const translator$v = NodeTranslator.from(
|
|
35382
|
+
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$3, {
|
|
35383
|
+
cantSplit: false,
|
|
35384
|
+
hidden: false,
|
|
35385
|
+
repeatHeader: false
|
|
35386
|
+
})
|
|
35387
|
+
);
|
|
35388
|
+
const createPlaceholderCell = (gridWidth, reason) => {
|
|
35389
|
+
const safeWidth = Number.isFinite(gridWidth) ? gridWidth : 0;
|
|
35390
|
+
const noBorder = { val: "none", size: 0 };
|
|
35391
|
+
return {
|
|
35392
|
+
type: "tableCell",
|
|
35393
|
+
attrs: {
|
|
35394
|
+
colspan: 1,
|
|
35395
|
+
rowspan: 1,
|
|
35396
|
+
colwidth: [safeWidth],
|
|
35397
|
+
__placeholder: reason,
|
|
35398
|
+
borders: {
|
|
35399
|
+
top: { ...noBorder },
|
|
35400
|
+
right: { ...noBorder },
|
|
35401
|
+
bottom: { ...noBorder },
|
|
35402
|
+
left: { ...noBorder }
|
|
35403
|
+
}
|
|
35404
|
+
},
|
|
35405
|
+
content: [{ type: "paragraph", content: [] }]
|
|
35406
|
+
};
|
|
35407
|
+
};
|
|
35408
|
+
const advancePastRowSpans = (pendingRowSpans, startIndex, totalColumns) => {
|
|
35409
|
+
let index2 = startIndex;
|
|
35410
|
+
while (index2 < totalColumns && pendingRowSpans[index2] > 0) {
|
|
35411
|
+
pendingRowSpans[index2] -= 1;
|
|
35412
|
+
index2 += 1;
|
|
35413
|
+
}
|
|
35414
|
+
return index2;
|
|
35415
|
+
};
|
|
35416
|
+
const fillPlaceholderColumns = ({
|
|
35417
|
+
content,
|
|
35418
|
+
pendingRowSpans,
|
|
35419
|
+
currentIndex,
|
|
35420
|
+
targetIndex,
|
|
35421
|
+
totalColumns,
|
|
35422
|
+
gridColumnWidths,
|
|
35423
|
+
reason
|
|
35424
|
+
}) => {
|
|
35425
|
+
let index2 = currentIndex;
|
|
35426
|
+
while (index2 < targetIndex && index2 < totalColumns) {
|
|
35427
|
+
if (pendingRowSpans[index2] > 0) {
|
|
35428
|
+
pendingRowSpans[index2] -= 1;
|
|
35429
|
+
index2 += 1;
|
|
35430
|
+
continue;
|
|
35431
|
+
}
|
|
35432
|
+
const width = Array.isArray(gridColumnWidths) ? gridColumnWidths[index2] ?? 0 : 0;
|
|
35433
|
+
content.push(createPlaceholderCell(width, reason));
|
|
35434
|
+
index2 += 1;
|
|
35435
|
+
}
|
|
35436
|
+
return index2;
|
|
35437
|
+
};
|
|
35438
|
+
const isPlaceholderCell = (cell) => {
|
|
35439
|
+
if (!cell) return false;
|
|
35440
|
+
if (cell.attrs?.__placeholder) return true;
|
|
35441
|
+
const widths = cell.attrs?.colwidth;
|
|
35442
|
+
if (Array.isArray(widths) && widths.length > 0) {
|
|
35443
|
+
const hasMeaningfulWidth = widths.some(
|
|
35444
|
+
(value) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) > 1
|
|
35445
|
+
);
|
|
35446
|
+
if (!hasMeaningfulWidth) return true;
|
|
35447
|
+
}
|
|
35448
|
+
return false;
|
|
35449
|
+
};
|
|
35450
|
+
const XML_NODE_NAME$f = "w:tr";
|
|
35451
|
+
const SD_NODE_NAME$c = "tableRow";
|
|
35452
|
+
const validXmlAttributes$a = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
35453
|
+
(xmlName) => createAttributeHandler(xmlName)
|
|
35454
|
+
);
|
|
35455
|
+
const encode$l = (params2, encodedAttrs) => {
|
|
35456
|
+
const { row } = params2.extraParams;
|
|
35457
|
+
let tableRowProperties = {};
|
|
35458
|
+
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
35459
|
+
if (tPr) {
|
|
35460
|
+
tableRowProperties = translator$v.encode({
|
|
35461
|
+
...params2,
|
|
35462
|
+
nodes: [tPr]
|
|
35463
|
+
});
|
|
35464
|
+
}
|
|
35465
|
+
const gridBeforeRaw = tableRowProperties?.["gridBefore"];
|
|
35466
|
+
const safeGridBefore = typeof gridBeforeRaw === "number" && Number.isFinite(gridBeforeRaw) && gridBeforeRaw > 0 ? gridBeforeRaw : 0;
|
|
35467
|
+
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
35468
|
+
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
35469
|
+
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
35470
|
+
const { columnWidths: gridColumnWidths, activeRowSpans = [] } = params2.extraParams;
|
|
35471
|
+
const totalColumns = Array.isArray(gridColumnWidths) ? gridColumnWidths.length : 0;
|
|
35472
|
+
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
35473
|
+
while (pendingRowSpans.length < totalColumns) pendingRowSpans.push(0);
|
|
35474
|
+
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
35475
|
+
const content = [];
|
|
35476
|
+
let currentColumnIndex = 0;
|
|
35477
|
+
const fillUntil = (target, reason) => {
|
|
35478
|
+
currentColumnIndex = fillPlaceholderColumns({
|
|
35479
|
+
content,
|
|
35480
|
+
pendingRowSpans,
|
|
35481
|
+
currentIndex: currentColumnIndex,
|
|
35482
|
+
targetIndex: target,
|
|
35483
|
+
totalColumns,
|
|
35484
|
+
gridColumnWidths,
|
|
35485
|
+
reason
|
|
35486
|
+
});
|
|
35487
|
+
};
|
|
35488
|
+
const skipOccupiedColumns = () => {
|
|
35489
|
+
currentColumnIndex = advancePastRowSpans(pendingRowSpans, currentColumnIndex, totalColumns);
|
|
35490
|
+
};
|
|
35491
|
+
fillUntil(safeGridBefore, "gridBefore");
|
|
35492
|
+
skipOccupiedColumns();
|
|
35493
|
+
cellNodes?.forEach((node) => {
|
|
35494
|
+
skipOccupiedColumns();
|
|
35495
|
+
const startColumn = currentColumnIndex;
|
|
35496
|
+
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
35497
|
+
const result = translator$H.encode({
|
|
35498
|
+
...params2,
|
|
35499
|
+
extraParams: {
|
|
35500
|
+
...params2.extraParams,
|
|
35501
|
+
node,
|
|
35502
|
+
columnIndex: startColumn,
|
|
35503
|
+
columnWidth
|
|
35504
|
+
}
|
|
35505
|
+
});
|
|
35506
|
+
if (result) {
|
|
35507
|
+
content.push(result);
|
|
35508
|
+
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
35509
|
+
const rowspan = Math.max(1, result.attrs?.rowspan || 1);
|
|
35510
|
+
if (rowspan > 1) {
|
|
35511
|
+
for (let offset2 = 0; offset2 < colspan; offset2 += 1) {
|
|
35512
|
+
const target = startColumn + offset2;
|
|
35513
|
+
if (target < pendingRowSpans.length) {
|
|
35514
|
+
pendingRowSpans[target] = Math.max(pendingRowSpans[target], rowspan - 1);
|
|
35515
|
+
}
|
|
35516
|
+
}
|
|
35517
|
+
}
|
|
35518
|
+
currentColumnIndex = startColumn + colspan;
|
|
35519
|
+
}
|
|
35520
|
+
});
|
|
35521
|
+
skipOccupiedColumns();
|
|
35522
|
+
fillUntil(totalColumns, "gridAfter");
|
|
35523
|
+
const newNode = {
|
|
35524
|
+
type: "tableRow",
|
|
35525
|
+
content,
|
|
35526
|
+
attrs: encodedAttrs
|
|
35527
|
+
};
|
|
35528
|
+
return newNode;
|
|
35529
|
+
};
|
|
35530
|
+
const decode$n = (params2, decodedAttrs) => {
|
|
35531
|
+
const { node } = params2;
|
|
35532
|
+
const cells = node.content || [];
|
|
35533
|
+
let leadingPlaceholders = 0;
|
|
35534
|
+
while (leadingPlaceholders < cells.length && isPlaceholderCell(cells[leadingPlaceholders])) {
|
|
35535
|
+
leadingPlaceholders += 1;
|
|
35536
|
+
}
|
|
35537
|
+
let trailingPlaceholders = 0;
|
|
35538
|
+
while (trailingPlaceholders < cells.length - leadingPlaceholders && isPlaceholderCell(cells[cells.length - 1 - trailingPlaceholders])) {
|
|
35539
|
+
trailingPlaceholders += 1;
|
|
35540
|
+
}
|
|
35541
|
+
const trimmedSlice = cells.slice(leadingPlaceholders, cells.length - trailingPlaceholders);
|
|
35542
|
+
const sanitizedCells = trimmedSlice.map((cell) => {
|
|
35543
|
+
if (cell?.attrs && "__placeholder" in cell.attrs) {
|
|
35544
|
+
const { __placeholder, ...rest } = cell.attrs;
|
|
35545
|
+
return { ...cell, attrs: rest };
|
|
35546
|
+
}
|
|
35547
|
+
return cell;
|
|
35548
|
+
});
|
|
35549
|
+
const trimmedContent = sanitizedCells.filter((_2, index2) => !isPlaceholderCell(trimmedSlice[index2]));
|
|
35550
|
+
const translateParams = {
|
|
35551
|
+
...params2,
|
|
35552
|
+
node: { ...node, content: trimmedContent }
|
|
35553
|
+
};
|
|
35554
|
+
const elements = translateChildNodes(translateParams);
|
|
35555
|
+
if (node.attrs?.tableRowProperties) {
|
|
35556
|
+
const tableRowProperties = { ...node.attrs.tableRowProperties };
|
|
35557
|
+
if (leadingPlaceholders > 0) {
|
|
35558
|
+
tableRowProperties.gridBefore = leadingPlaceholders;
|
|
35559
|
+
}
|
|
35560
|
+
if (trailingPlaceholders > 0) {
|
|
35561
|
+
tableRowProperties.gridAfter = trailingPlaceholders;
|
|
35562
|
+
}
|
|
35563
|
+
if (node.attrs.rowHeight != null) {
|
|
35564
|
+
const rowHeightPixels = twipsToPixels(node.attrs.tableRowProperties["rowHeight"]?.value);
|
|
35565
|
+
if (rowHeightPixels !== node.attrs.rowHeight) {
|
|
35566
|
+
tableRowProperties["rowHeight"] = { value: String(pixelsToTwips(node.attrs["rowHeight"])) };
|
|
35567
|
+
}
|
|
35568
|
+
}
|
|
35569
|
+
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
35570
|
+
const trPr = translator$v.decode({
|
|
35571
|
+
...params2,
|
|
35572
|
+
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
35573
|
+
});
|
|
35574
|
+
if (trPr) elements.unshift(trPr);
|
|
35575
|
+
}
|
|
35576
|
+
return {
|
|
35577
|
+
name: "w:tr",
|
|
35578
|
+
attributes: decodedAttrs || {},
|
|
35579
|
+
elements
|
|
35580
|
+
};
|
|
35581
|
+
};
|
|
35582
|
+
const config$e = {
|
|
35583
|
+
xmlName: XML_NODE_NAME$f,
|
|
35584
|
+
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
35585
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
35586
|
+
encode: encode$l,
|
|
35587
|
+
decode: decode$n,
|
|
35588
|
+
attributes: validXmlAttributes$a
|
|
35589
|
+
};
|
|
35590
|
+
const translator$u = NodeTranslator.from(config$e);
|
|
35591
|
+
function parseTagValueJSON(json) {
|
|
35592
|
+
if (typeof json !== "string") {
|
|
35593
|
+
return {};
|
|
35594
|
+
}
|
|
35595
|
+
const trimmed = json.trim();
|
|
35596
|
+
if (!trimmed) {
|
|
35597
|
+
return {};
|
|
35598
|
+
}
|
|
35599
|
+
try {
|
|
35600
|
+
return JSON.parse(trimmed);
|
|
35601
|
+
} catch {
|
|
35602
|
+
return {};
|
|
35603
|
+
}
|
|
35604
|
+
}
|
|
35605
|
+
function handleAnnotationNode(params2) {
|
|
35606
|
+
const { nodes } = params2;
|
|
35607
|
+
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
35608
|
+
return null;
|
|
35609
|
+
}
|
|
35610
|
+
const node = nodes[0];
|
|
35611
|
+
const sdtPr = node.elements.find((el) => el.name === "w:sdtPr");
|
|
35612
|
+
const sdtContent = node.elements.find((el) => el.name === "w:sdtContent");
|
|
35613
|
+
const sdtId = sdtPr?.elements?.find((el) => el.name === "w:id");
|
|
35614
|
+
const alias = sdtPr?.elements.find((el) => el.name === "w:alias");
|
|
35615
|
+
const tag = sdtPr?.elements.find((el) => el.name === "w:tag");
|
|
35616
|
+
const tagValue = tag?.attributes["w:val"];
|
|
35617
|
+
const shouldProcessAsJson = tagValue?.startsWith("{") && tagValue?.endsWith("}");
|
|
35618
|
+
let attrs = {};
|
|
35619
|
+
const aliasLabel = getSafeString(alias?.attributes?.["w:val"]);
|
|
35620
|
+
if (shouldProcessAsJson) {
|
|
35621
|
+
const parsedAttrs = parseTagValueJSON(tagValue);
|
|
35622
|
+
attrs = {
|
|
35623
|
+
type: parsedAttrs.fieldTypeShort,
|
|
35624
|
+
fieldId: parsedAttrs.fieldId,
|
|
35625
|
+
displayLabel: parsedAttrs.displayLabel,
|
|
35626
|
+
defaultDisplayLabel: parsedAttrs.defaultDisplayLabel,
|
|
35627
|
+
fieldType: parsedAttrs.fieldType,
|
|
35628
|
+
fieldColor: parsedAttrs.fieldColor,
|
|
35629
|
+
multipleImage: parsedAttrs.fieldMultipleImage,
|
|
35630
|
+
fontFamily: parsedAttrs.fieldFontFamily,
|
|
35631
|
+
fontSize: parsedAttrs.fieldFontSize,
|
|
35632
|
+
textColor: parsedAttrs.fieldTextColor,
|
|
35633
|
+
textHighlight: parsedAttrs.fieldTextHighlight,
|
|
35634
|
+
hash: parsedAttrs.hash
|
|
35635
|
+
};
|
|
35636
|
+
} else {
|
|
35637
|
+
attrs = getAttrsFromElements({ sdtPr, tag, alias, sdtId });
|
|
35638
|
+
}
|
|
35639
|
+
const initialDisplayLabel = getSafeString(attrs.displayLabel);
|
|
35640
|
+
const extractedContent = getTextFromSdtContent(sdtContent);
|
|
35641
|
+
if (!attrs.defaultDisplayLabel) {
|
|
35642
|
+
if (initialDisplayLabel) {
|
|
35643
|
+
attrs.defaultDisplayLabel = initialDisplayLabel;
|
|
35644
|
+
} else if (aliasLabel) {
|
|
35645
|
+
attrs.defaultDisplayLabel = aliasLabel;
|
|
35646
|
+
}
|
|
35647
|
+
}
|
|
35648
|
+
const placeholderLabel = getPlaceholderLabel(attrs, aliasLabel);
|
|
35649
|
+
const placeholderText = ensurePlaceholderFormat(placeholderLabel);
|
|
35650
|
+
const isAnnotationsEnabled = Boolean(params2.editor?.options?.annotations);
|
|
35651
|
+
const contentIsDistinct = shouldUseSdtContent(extractedContent, placeholderText);
|
|
35652
|
+
const shouldUseContent = !isAnnotationsEnabled && contentIsDistinct && (hasMoustache(extractedContent) || !placeholderText);
|
|
35653
|
+
if (contentIsDistinct) {
|
|
35654
|
+
attrs.displayLabel = extractedContent;
|
|
36305
35655
|
} else if (!attrs.displayLabel && placeholderLabel) {
|
|
36306
35656
|
attrs.displayLabel = placeholderLabel;
|
|
36307
35657
|
}
|
|
@@ -36643,11 +35993,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36643
35993
|
} else {
|
|
36644
35994
|
return hexColor;
|
|
36645
35995
|
}
|
|
36646
|
-
const
|
|
35996
|
+
const clamp2 = (n) => Math.max(0, Math.min(255, Math.round(n)));
|
|
36647
35997
|
const toHex2 = (n) => n.toString(16).padStart(2, "0");
|
|
36648
|
-
newR =
|
|
36649
|
-
newG =
|
|
36650
|
-
newB =
|
|
35998
|
+
newR = clamp2(newR);
|
|
35999
|
+
newG = clamp2(newG);
|
|
36000
|
+
newB = clamp2(newB);
|
|
36651
36001
|
const result = `#${toHex2(newR)}${toHex2(newG)}${toHex2(newB)}`;
|
|
36652
36002
|
return result;
|
|
36653
36003
|
}
|
|
@@ -37560,32 +36910,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37560
36910
|
elements: [...anchorElements, ...elementsWithWrap]
|
|
37561
36911
|
};
|
|
37562
36912
|
}
|
|
37563
|
-
const XML_NODE_NAME$
|
|
37564
|
-
const SD_NODE_NAME$
|
|
36913
|
+
const XML_NODE_NAME$e = "wp:anchor";
|
|
36914
|
+
const SD_NODE_NAME$b = ["image"];
|
|
37565
36915
|
const validXmlAttributes$9 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
37566
|
-
function encode$
|
|
36916
|
+
function encode$k(params2) {
|
|
37567
36917
|
const { node } = params2.extraParams;
|
|
37568
36918
|
if (!node || !node.type) {
|
|
37569
36919
|
return null;
|
|
37570
36920
|
}
|
|
37571
36921
|
return handleAnchorNode(params2);
|
|
37572
36922
|
}
|
|
37573
|
-
function decode$
|
|
36923
|
+
function decode$m(params2) {
|
|
37574
36924
|
const { node } = params2;
|
|
37575
36925
|
if (!node || !node.type) {
|
|
37576
36926
|
return null;
|
|
37577
36927
|
}
|
|
37578
36928
|
return translateAnchorNode(params2);
|
|
37579
36929
|
}
|
|
37580
|
-
const config$
|
|
37581
|
-
xmlName: XML_NODE_NAME$
|
|
37582
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
36930
|
+
const config$d = {
|
|
36931
|
+
xmlName: XML_NODE_NAME$e,
|
|
36932
|
+
sdNodeOrKeyName: SD_NODE_NAME$b,
|
|
37583
36933
|
type: NodeTranslator.translatorTypes.NODE,
|
|
37584
|
-
encode: encode$
|
|
37585
|
-
decode: decode$
|
|
36934
|
+
encode: encode$k,
|
|
36935
|
+
decode: decode$m,
|
|
37586
36936
|
attributes: validXmlAttributes$9
|
|
37587
36937
|
};
|
|
37588
|
-
const translator$
|
|
36938
|
+
const translator$t = NodeTranslator.from(config$d);
|
|
37589
36939
|
function handleInlineNode(params2) {
|
|
37590
36940
|
const { node } = params2.extraParams;
|
|
37591
36941
|
if (node.name !== "wp:inline") {
|
|
@@ -37601,41 +36951,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37601
36951
|
elements: nodeElements.elements
|
|
37602
36952
|
};
|
|
37603
36953
|
}
|
|
37604
|
-
const XML_NODE_NAME$
|
|
37605
|
-
const SD_NODE_NAME$
|
|
36954
|
+
const XML_NODE_NAME$d = "wp:inline";
|
|
36955
|
+
const SD_NODE_NAME$a = ["image"];
|
|
37606
36956
|
const validXmlAttributes$8 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
37607
|
-
function encode$
|
|
36957
|
+
function encode$j(params2) {
|
|
37608
36958
|
const { node } = params2.extraParams;
|
|
37609
36959
|
if (!node || !node.type) {
|
|
37610
36960
|
return null;
|
|
37611
36961
|
}
|
|
37612
36962
|
return handleInlineNode(params2);
|
|
37613
36963
|
}
|
|
37614
|
-
function decode$
|
|
36964
|
+
function decode$l(params2) {
|
|
37615
36965
|
const { node } = params2;
|
|
37616
36966
|
if (!node || !node.type) {
|
|
37617
36967
|
return null;
|
|
37618
36968
|
}
|
|
37619
36969
|
return translateInlineNode(params2);
|
|
37620
36970
|
}
|
|
37621
|
-
const config$
|
|
37622
|
-
xmlName: XML_NODE_NAME$
|
|
37623
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
36971
|
+
const config$c = {
|
|
36972
|
+
xmlName: XML_NODE_NAME$d,
|
|
36973
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
37624
36974
|
type: NodeTranslator.translatorTypes.NODE,
|
|
37625
|
-
encode: encode$
|
|
37626
|
-
decode: decode$
|
|
36975
|
+
encode: encode$j,
|
|
36976
|
+
decode: decode$l,
|
|
37627
36977
|
attributes: validXmlAttributes$8
|
|
37628
36978
|
};
|
|
37629
|
-
const translator$
|
|
37630
|
-
const XML_NODE_NAME$
|
|
37631
|
-
const SD_NODE_NAME$
|
|
36979
|
+
const translator$s = NodeTranslator.from(config$c);
|
|
36980
|
+
const XML_NODE_NAME$c = "w:drawing";
|
|
36981
|
+
const SD_NODE_NAME$9 = [];
|
|
37632
36982
|
const validXmlAttributes$7 = [];
|
|
37633
|
-
function encode$
|
|
36983
|
+
function encode$i(params2) {
|
|
37634
36984
|
const nodes = params2.nodes;
|
|
37635
36985
|
const node = nodes[0];
|
|
37636
36986
|
const translatorByChildName = {
|
|
37637
|
-
"wp:anchor": translator$
|
|
37638
|
-
"wp:inline": translator$
|
|
36987
|
+
"wp:anchor": translator$t,
|
|
36988
|
+
"wp:inline": translator$s
|
|
37639
36989
|
};
|
|
37640
36990
|
return node.elements.reduce((acc, child) => {
|
|
37641
36991
|
if (acc) return acc;
|
|
@@ -37644,12 +36994,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37644
36994
|
return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
|
|
37645
36995
|
}, null);
|
|
37646
36996
|
}
|
|
37647
|
-
function decode$
|
|
36997
|
+
function decode$k(params2) {
|
|
37648
36998
|
const { node } = params2;
|
|
37649
36999
|
if (!node || !node.type) {
|
|
37650
37000
|
return null;
|
|
37651
37001
|
}
|
|
37652
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
37002
|
+
const childTranslator = node.attrs.isAnchor ? translator$t : translator$s;
|
|
37653
37003
|
const resultNode = childTranslator.decode(params2);
|
|
37654
37004
|
return wrapTextInRun(
|
|
37655
37005
|
{
|
|
@@ -37659,15 +37009,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37659
37009
|
[]
|
|
37660
37010
|
);
|
|
37661
37011
|
}
|
|
37662
|
-
const config$
|
|
37663
|
-
xmlName: XML_NODE_NAME$
|
|
37664
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
37012
|
+
const config$b = {
|
|
37013
|
+
xmlName: XML_NODE_NAME$c,
|
|
37014
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
37665
37015
|
type: NodeTranslator.translatorTypes.NODE,
|
|
37666
|
-
encode: encode$
|
|
37667
|
-
decode: decode$
|
|
37016
|
+
encode: encode$i,
|
|
37017
|
+
decode: decode$k,
|
|
37668
37018
|
attributes: validXmlAttributes$7
|
|
37669
37019
|
};
|
|
37670
|
-
const translator$
|
|
37020
|
+
const translator$r = NodeTranslator.from(config$b);
|
|
37671
37021
|
class CommandService {
|
|
37672
37022
|
/**
|
|
37673
37023
|
* @param {import('./commands/types/index.js').CommandServiceOptions} props
|
|
@@ -39015,7 +38365,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39015
38365
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
|
|
39016
38366
|
}
|
|
39017
38367
|
function prepareImageAnnotation(params2, imageSize) {
|
|
39018
|
-
return translator$
|
|
38368
|
+
return translator$r.decode({
|
|
39019
38369
|
...params2,
|
|
39020
38370
|
imageSize
|
|
39021
38371
|
});
|
|
@@ -39079,287 +38429,864 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39079
38429
|
const linkTextNode = getTextNodeForExport(attrs.linkUrl, marks, params2);
|
|
39080
38430
|
const contentNode = processLinkContentNode(linkTextNode);
|
|
39081
38431
|
return {
|
|
39082
|
-
name: "w:hyperlink",
|
|
39083
|
-
type: "element",
|
|
39084
|
-
attributes: {
|
|
39085
|
-
"r:id": newId,
|
|
39086
|
-
"w:history": 1
|
|
39087
|
-
},
|
|
39088
|
-
elements: [contentNode]
|
|
38432
|
+
name: "w:hyperlink",
|
|
38433
|
+
type: "element",
|
|
38434
|
+
attributes: {
|
|
38435
|
+
"r:id": newId,
|
|
38436
|
+
"w:history": 1
|
|
38437
|
+
},
|
|
38438
|
+
elements: [contentNode]
|
|
38439
|
+
};
|
|
38440
|
+
}
|
|
38441
|
+
function translateFieldAttrsToMarks(attrs = {}) {
|
|
38442
|
+
const { fontFamily: fontFamily2, fontSize: fontSize2, bold, underline, italic, textColor, textHighlight } = attrs;
|
|
38443
|
+
const marks = [];
|
|
38444
|
+
if (fontFamily2) marks.push({ type: "fontFamily", attrs: { fontFamily: fontFamily2 } });
|
|
38445
|
+
if (fontSize2) marks.push({ type: "fontSize", attrs: { fontSize: fontSize2 } });
|
|
38446
|
+
if (bold) marks.push({ type: "bold", attrs: {} });
|
|
38447
|
+
if (underline) marks.push({ type: "underline", attrs: {} });
|
|
38448
|
+
if (italic) marks.push({ type: "italic", attrs: {} });
|
|
38449
|
+
if (textColor) marks.push({ type: "color", attrs: { color: textColor } });
|
|
38450
|
+
if (textHighlight) marks.push({ type: "highlight", attrs: { color: textHighlight } });
|
|
38451
|
+
return marks;
|
|
38452
|
+
}
|
|
38453
|
+
function applyMarksToHtmlAnnotation(state2, marks) {
|
|
38454
|
+
const { tr, doc: doc2, schema } = state2;
|
|
38455
|
+
const allowedMarks = ["fontFamily", "fontSize", "highlight"];
|
|
38456
|
+
if (!marks.some((m2) => allowedMarks.includes(m2.type))) {
|
|
38457
|
+
return state2;
|
|
38458
|
+
}
|
|
38459
|
+
const fontFamily2 = marks.find((m2) => m2.type === "fontFamily");
|
|
38460
|
+
const fontSize2 = marks.find((m2) => m2.type === "fontSize");
|
|
38461
|
+
const highlight = marks.find((m2) => m2.type === "highlight");
|
|
38462
|
+
const textStyleType = schema.marks.textStyle;
|
|
38463
|
+
const highlightType = schema.marks.highlight;
|
|
38464
|
+
doc2.descendants((node, pos) => {
|
|
38465
|
+
if (!node.isText) return;
|
|
38466
|
+
const foundTextStyle = node.marks.find((m2) => m2.type.name === "textStyle");
|
|
38467
|
+
const foundHighlight = node.marks.find((m2) => m2.type.name === "highlight");
|
|
38468
|
+
if (!foundTextStyle) {
|
|
38469
|
+
tr.addMark(
|
|
38470
|
+
pos,
|
|
38471
|
+
pos + node.nodeSize,
|
|
38472
|
+
textStyleType.create({
|
|
38473
|
+
...fontFamily2?.attrs,
|
|
38474
|
+
...fontSize2?.attrs
|
|
38475
|
+
})
|
|
38476
|
+
);
|
|
38477
|
+
} else if (!foundTextStyle?.attrs.fontFamily && fontFamily2) {
|
|
38478
|
+
tr.addMark(
|
|
38479
|
+
pos,
|
|
38480
|
+
pos + node.nodeSize,
|
|
38481
|
+
textStyleType.create({
|
|
38482
|
+
...foundTextStyle?.attrs,
|
|
38483
|
+
...fontFamily2.attrs
|
|
38484
|
+
})
|
|
38485
|
+
);
|
|
38486
|
+
} else if (!foundTextStyle?.attrs.fontSize && fontSize2) {
|
|
38487
|
+
tr.addMark(
|
|
38488
|
+
pos,
|
|
38489
|
+
pos + node.nodeSize,
|
|
38490
|
+
textStyleType.create({
|
|
38491
|
+
...foundTextStyle?.attrs,
|
|
38492
|
+
...fontSize2.attrs
|
|
38493
|
+
})
|
|
38494
|
+
);
|
|
38495
|
+
}
|
|
38496
|
+
if (!foundHighlight) {
|
|
38497
|
+
tr.addMark(
|
|
38498
|
+
pos,
|
|
38499
|
+
pos + node.nodeSize,
|
|
38500
|
+
highlightType.create({
|
|
38501
|
+
...highlight?.attrs
|
|
38502
|
+
})
|
|
38503
|
+
);
|
|
38504
|
+
}
|
|
38505
|
+
});
|
|
38506
|
+
return state2.apply(tr);
|
|
38507
|
+
}
|
|
38508
|
+
function getFieldHighlightJson(fieldsHighlightColor) {
|
|
38509
|
+
if (!fieldsHighlightColor) return null;
|
|
38510
|
+
let parsedColor = fieldsHighlightColor.trim();
|
|
38511
|
+
const hexRegex2 = /^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/;
|
|
38512
|
+
if (!hexRegex2.test(parsedColor)) {
|
|
38513
|
+
console.warn(`Invalid HEX color provided to fieldsHighlightColor export param: ${fieldsHighlightColor}`);
|
|
38514
|
+
return null;
|
|
38515
|
+
}
|
|
38516
|
+
if (parsedColor.startsWith("#")) {
|
|
38517
|
+
parsedColor = parsedColor.slice(1);
|
|
38518
|
+
}
|
|
38519
|
+
return {
|
|
38520
|
+
name: "w:rPr",
|
|
38521
|
+
elements: [
|
|
38522
|
+
{
|
|
38523
|
+
name: "w:shd",
|
|
38524
|
+
attributes: {
|
|
38525
|
+
"w:fill": `#${parsedColor}`,
|
|
38526
|
+
"w:color": "auto",
|
|
38527
|
+
"w:val": "clear"
|
|
38528
|
+
}
|
|
38529
|
+
}
|
|
38530
|
+
]
|
|
38531
|
+
};
|
|
38532
|
+
}
|
|
38533
|
+
function translateDocumentSection(params2) {
|
|
38534
|
+
const { node } = params2;
|
|
38535
|
+
const { attrs = {} } = node;
|
|
38536
|
+
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
38537
|
+
const nodeElements = [
|
|
38538
|
+
{
|
|
38539
|
+
name: "w:sdtContent",
|
|
38540
|
+
elements: childContent
|
|
38541
|
+
}
|
|
38542
|
+
];
|
|
38543
|
+
const exportedTag = JSON.stringify({
|
|
38544
|
+
type: "documentSection",
|
|
38545
|
+
description: attrs.description
|
|
38546
|
+
});
|
|
38547
|
+
const sdtPr = generateSdtPrTagForDocumentSection(attrs.id, attrs.title, exportedTag);
|
|
38548
|
+
const { isLocked } = attrs;
|
|
38549
|
+
if (isLocked) {
|
|
38550
|
+
sdtPr.elements.push({
|
|
38551
|
+
name: "w:lock",
|
|
38552
|
+
attributes: {
|
|
38553
|
+
"w:val": "sdtContentLocked"
|
|
38554
|
+
}
|
|
38555
|
+
});
|
|
38556
|
+
}
|
|
38557
|
+
nodeElements.unshift(sdtPr);
|
|
38558
|
+
const result = {
|
|
38559
|
+
name: "w:sdt",
|
|
38560
|
+
elements: nodeElements
|
|
38561
|
+
};
|
|
38562
|
+
return result;
|
|
38563
|
+
}
|
|
38564
|
+
const generateSdtPrTagForDocumentSection = (id, title, tag) => {
|
|
38565
|
+
return {
|
|
38566
|
+
name: "w:sdtPr",
|
|
38567
|
+
elements: [
|
|
38568
|
+
{
|
|
38569
|
+
name: "w:id",
|
|
38570
|
+
attributes: {
|
|
38571
|
+
"w:val": id
|
|
38572
|
+
}
|
|
38573
|
+
},
|
|
38574
|
+
{
|
|
38575
|
+
name: "w:alias",
|
|
38576
|
+
attributes: {
|
|
38577
|
+
"w:val": title
|
|
38578
|
+
}
|
|
38579
|
+
},
|
|
38580
|
+
{
|
|
38581
|
+
name: "w:tag",
|
|
38582
|
+
attributes: {
|
|
38583
|
+
"w:val": tag
|
|
38584
|
+
}
|
|
38585
|
+
}
|
|
38586
|
+
]
|
|
38587
|
+
};
|
|
38588
|
+
};
|
|
38589
|
+
function translateDocumentPartObj(params2) {
|
|
38590
|
+
const { node } = params2;
|
|
38591
|
+
const { attrs = {} } = node;
|
|
38592
|
+
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
38593
|
+
const nodeElements = [
|
|
38594
|
+
{
|
|
38595
|
+
name: "w:sdtPr",
|
|
38596
|
+
elements: [
|
|
38597
|
+
{
|
|
38598
|
+
name: "w:id",
|
|
38599
|
+
attributes: {
|
|
38600
|
+
"w:val": attrs.id
|
|
38601
|
+
}
|
|
38602
|
+
},
|
|
38603
|
+
{
|
|
38604
|
+
name: "w:docPartObj",
|
|
38605
|
+
elements: [
|
|
38606
|
+
{
|
|
38607
|
+
name: "w:docPartGallery",
|
|
38608
|
+
attributes: {
|
|
38609
|
+
"w:val": attrs.docPartGallery
|
|
38610
|
+
}
|
|
38611
|
+
},
|
|
38612
|
+
...attrs.docPartUnique ? [
|
|
38613
|
+
{
|
|
38614
|
+
name: "w:docPartUnique"
|
|
38615
|
+
}
|
|
38616
|
+
] : []
|
|
38617
|
+
]
|
|
38618
|
+
}
|
|
38619
|
+
]
|
|
38620
|
+
},
|
|
38621
|
+
{
|
|
38622
|
+
name: "w:sdtContent",
|
|
38623
|
+
elements: childContent
|
|
38624
|
+
}
|
|
38625
|
+
];
|
|
38626
|
+
const result = {
|
|
38627
|
+
name: "w:sdt",
|
|
38628
|
+
elements: nodeElements
|
|
38629
|
+
};
|
|
38630
|
+
return result;
|
|
38631
|
+
}
|
|
38632
|
+
function translateStructuredContent(params2) {
|
|
38633
|
+
const { node } = params2;
|
|
38634
|
+
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
38635
|
+
const sdtContent = { name: "w:sdtContent", elements: childContent };
|
|
38636
|
+
const sdtPr = generateSdtPrTagForStructuredContent({ node });
|
|
38637
|
+
const nodeElements = [sdtPr, sdtContent];
|
|
38638
|
+
const result = {
|
|
38639
|
+
name: "w:sdt",
|
|
38640
|
+
elements: nodeElements
|
|
38641
|
+
};
|
|
38642
|
+
return result;
|
|
38643
|
+
}
|
|
38644
|
+
function generateSdtPrTagForStructuredContent({ node }) {
|
|
38645
|
+
const { attrs = {} } = node;
|
|
38646
|
+
const id = {
|
|
38647
|
+
name: "w:id",
|
|
38648
|
+
type: "element",
|
|
38649
|
+
attributes: { "w:val": attrs.id }
|
|
38650
|
+
};
|
|
38651
|
+
const alias = {
|
|
38652
|
+
name: "w:alias",
|
|
38653
|
+
type: "element",
|
|
38654
|
+
attributes: { "w:val": attrs.alias }
|
|
38655
|
+
};
|
|
38656
|
+
const tag = {
|
|
38657
|
+
name: "w:tag",
|
|
38658
|
+
type: "element",
|
|
38659
|
+
attributes: { "w:val": attrs.tag }
|
|
38660
|
+
};
|
|
38661
|
+
const resultElements = [];
|
|
38662
|
+
if (attrs.id) resultElements.push(id);
|
|
38663
|
+
if (attrs.alias) resultElements.push(alias);
|
|
38664
|
+
if (attrs.tag) resultElements.push(tag);
|
|
38665
|
+
if (attrs.sdtPr) {
|
|
38666
|
+
const elements = attrs.sdtPr.elements || [];
|
|
38667
|
+
const elementsToExclude = ["w:id", "w:alias", "w:tag"];
|
|
38668
|
+
const restElements = elements.filter((el) => !elementsToExclude.includes(el.name));
|
|
38669
|
+
const result2 = {
|
|
38670
|
+
name: "w:sdtPr",
|
|
38671
|
+
type: "element",
|
|
38672
|
+
elements: [...resultElements, ...restElements]
|
|
38673
|
+
};
|
|
38674
|
+
return result2;
|
|
38675
|
+
}
|
|
38676
|
+
const result = {
|
|
38677
|
+
name: "w:sdtPr",
|
|
38678
|
+
type: "element",
|
|
38679
|
+
elements: resultElements
|
|
38680
|
+
};
|
|
38681
|
+
return result;
|
|
38682
|
+
}
|
|
38683
|
+
const XML_NODE_NAME$b = "w:sdt";
|
|
38684
|
+
const SD_NODE_NAME$8 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
38685
|
+
const validXmlAttributes$6 = [];
|
|
38686
|
+
function encode$h(params2) {
|
|
38687
|
+
const nodes = params2.nodes;
|
|
38688
|
+
const node = nodes[0];
|
|
38689
|
+
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
38690
|
+
if (!handler2 || sdtType === "unknown") {
|
|
38691
|
+
return void 0;
|
|
38692
|
+
}
|
|
38693
|
+
const result = handler2(params2);
|
|
38694
|
+
return result;
|
|
38695
|
+
}
|
|
38696
|
+
function decode$j(params2) {
|
|
38697
|
+
const { node } = params2;
|
|
38698
|
+
if (!node || !node.type) {
|
|
38699
|
+
return null;
|
|
38700
|
+
}
|
|
38701
|
+
const types2 = {
|
|
38702
|
+
fieldAnnotation: () => translateFieldAnnotation(params2),
|
|
38703
|
+
structuredContent: () => translateStructuredContent(params2),
|
|
38704
|
+
structuredContentBlock: () => translateStructuredContent(params2),
|
|
38705
|
+
documentSection: () => translateDocumentSection(params2),
|
|
38706
|
+
documentPartObject: () => translateDocumentPartObj(params2),
|
|
38707
|
+
// Handled in doc-part-obj translator
|
|
38708
|
+
default: () => null
|
|
38709
|
+
};
|
|
38710
|
+
const decoder = types2[node.type] ?? types2.default;
|
|
38711
|
+
const result = decoder();
|
|
38712
|
+
return result;
|
|
38713
|
+
}
|
|
38714
|
+
const config$a = {
|
|
38715
|
+
xmlName: XML_NODE_NAME$b,
|
|
38716
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
38717
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
38718
|
+
encode: encode$h,
|
|
38719
|
+
decode: decode$j,
|
|
38720
|
+
attributes: validXmlAttributes$6
|
|
38721
|
+
};
|
|
38722
|
+
const translator$q = NodeTranslator.from(config$a);
|
|
38723
|
+
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
38724
|
+
if (!table || !Array.isArray(table.content)) {
|
|
38725
|
+
return table;
|
|
38726
|
+
}
|
|
38727
|
+
const rows = table.content;
|
|
38728
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
38729
|
+
const row = rows[rowIndex];
|
|
38730
|
+
if (!row) continue;
|
|
38731
|
+
if (!Array.isArray(row.content)) {
|
|
38732
|
+
row.content = [];
|
|
38733
|
+
}
|
|
38734
|
+
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
38735
|
+
const cell = row.content[cellIndex];
|
|
38736
|
+
if (!cell) continue;
|
|
38737
|
+
const attrs = cell.attrs || {};
|
|
38738
|
+
if (!attrs.rowspan || attrs.rowspan <= 1) continue;
|
|
38739
|
+
const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
|
|
38740
|
+
for (let offset2 = 1; offset2 < maxRowspan; offset2++) {
|
|
38741
|
+
const rowToChange = rows[rowIndex + offset2];
|
|
38742
|
+
if (!rowToChange) continue;
|
|
38743
|
+
if (!Array.isArray(rowToChange.content)) {
|
|
38744
|
+
rowToChange.content = [];
|
|
38745
|
+
}
|
|
38746
|
+
const existingCell = rowToChange.content[cellIndex];
|
|
38747
|
+
if (existingCell?.attrs?.continueMerge) continue;
|
|
38748
|
+
const mergedCell = {
|
|
38749
|
+
type: cell.type,
|
|
38750
|
+
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
38751
|
+
attrs: {
|
|
38752
|
+
...cell.attrs,
|
|
38753
|
+
rowspan: null,
|
|
38754
|
+
continueMerge: true
|
|
38755
|
+
}
|
|
38756
|
+
};
|
|
38757
|
+
rowToChange.content.splice(cellIndex, 0, mergedCell);
|
|
38758
|
+
}
|
|
38759
|
+
}
|
|
38760
|
+
}
|
|
38761
|
+
return table;
|
|
38762
|
+
}
|
|
38763
|
+
const translator$p = NodeTranslator.from({
|
|
38764
|
+
xmlName: "w:bidiVisual",
|
|
38765
|
+
sdNodeOrKeyName: "rightToLeft",
|
|
38766
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
38767
|
+
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
38768
|
+
});
|
|
38769
|
+
const translator$o = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
38770
|
+
const translator$n = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
38771
|
+
const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
38772
|
+
const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
38773
|
+
const translator$k = NodeTranslator.from({
|
|
38774
|
+
xmlName: "w:tblLook",
|
|
38775
|
+
sdNodeOrKeyName: "tblLook",
|
|
38776
|
+
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
38777
|
+
encode: (params2, encodedAttrs) => {
|
|
38778
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
38779
|
+
},
|
|
38780
|
+
decode: function({ node }, context) {
|
|
38781
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
38782
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
38783
|
+
}
|
|
38784
|
+
});
|
|
38785
|
+
const translator$j = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
38786
|
+
const translator$i = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
38787
|
+
const translator$h = NodeTranslator.from(
|
|
38788
|
+
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
38789
|
+
);
|
|
38790
|
+
const translator$g = NodeTranslator.from(
|
|
38791
|
+
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
38792
|
+
);
|
|
38793
|
+
const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
38794
|
+
const translator$e = NodeTranslator.from({
|
|
38795
|
+
xmlName: "w:tblpPr",
|
|
38796
|
+
sdNodeOrKeyName: "floatingTableProperties",
|
|
38797
|
+
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
38798
|
+
encode: (params2, encodedAttrs) => {
|
|
38799
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
38800
|
+
},
|
|
38801
|
+
decode: function({ node }, context) {
|
|
38802
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
|
|
38803
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
38804
|
+
}
|
|
38805
|
+
});
|
|
38806
|
+
const propertyTranslators$2 = [
|
|
38807
|
+
translator$15,
|
|
38808
|
+
translator$13,
|
|
38809
|
+
translator$11,
|
|
38810
|
+
translator$10,
|
|
38811
|
+
translator$$,
|
|
38812
|
+
translator$Z,
|
|
38813
|
+
translator$X,
|
|
38814
|
+
translator$V
|
|
38815
|
+
];
|
|
38816
|
+
const translator$d = NodeTranslator.from(
|
|
38817
|
+
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$2)
|
|
38818
|
+
);
|
|
38819
|
+
const propertyTranslators$1 = [
|
|
38820
|
+
translator$14,
|
|
38821
|
+
translator$12,
|
|
38822
|
+
translator$_,
|
|
38823
|
+
translator$Y,
|
|
38824
|
+
translator$W,
|
|
38825
|
+
translator$U
|
|
38826
|
+
];
|
|
38827
|
+
const translator$c = NodeTranslator.from(
|
|
38828
|
+
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$1)
|
|
38829
|
+
);
|
|
38830
|
+
const propertyTranslators = [
|
|
38831
|
+
translator$p,
|
|
38832
|
+
translator$B,
|
|
38833
|
+
translator$19,
|
|
38834
|
+
translator$o,
|
|
38835
|
+
translator$A,
|
|
38836
|
+
translator$n,
|
|
38837
|
+
translator$m,
|
|
38838
|
+
translator$l,
|
|
38839
|
+
translator$k,
|
|
38840
|
+
translator$j,
|
|
38841
|
+
translator$i,
|
|
38842
|
+
translator$h,
|
|
38843
|
+
translator$g,
|
|
38844
|
+
translator$f,
|
|
38845
|
+
translator$e,
|
|
38846
|
+
translator$d,
|
|
38847
|
+
translator$c
|
|
38848
|
+
];
|
|
38849
|
+
const translator$b = NodeTranslator.from(
|
|
38850
|
+
createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators)
|
|
38851
|
+
);
|
|
38852
|
+
const translator$a = NodeTranslator.from(
|
|
38853
|
+
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
38854
|
+
);
|
|
38855
|
+
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
38856
|
+
const normalizeTwipWidth = (value) => {
|
|
38857
|
+
if (value == null) return null;
|
|
38858
|
+
const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
|
|
38859
|
+
if (!Number.isFinite(numericValue) || Number.isNaN(numericValue) || numericValue <= 0) {
|
|
38860
|
+
return null;
|
|
38861
|
+
}
|
|
38862
|
+
return numericValue;
|
|
38863
|
+
};
|
|
38864
|
+
const getSchemaDefaultColumnWidthPx = (params2) => {
|
|
38865
|
+
const defaultValue = params2?.editor?.schema?.nodes?.tableCell?.spec?.attrs?.colwidth?.default;
|
|
38866
|
+
if (Array.isArray(defaultValue)) {
|
|
38867
|
+
const numericWidth = defaultValue.find((width) => typeof width === "number" && Number.isFinite(width) && width > 0);
|
|
38868
|
+
if (numericWidth != null) return numericWidth;
|
|
38869
|
+
} else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
|
|
38870
|
+
return defaultValue;
|
|
38871
|
+
}
|
|
38872
|
+
return DEFAULT_COLUMN_WIDTH_PX;
|
|
38873
|
+
};
|
|
38874
|
+
const getTableWidthPx = (params2) => {
|
|
38875
|
+
const explicitWidth = params2?.node?.attrs?.tableWidth?.width;
|
|
38876
|
+
if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
|
|
38877
|
+
const tableWidth = params2?.node?.attrs?.tableProperties?.tableWidth;
|
|
38878
|
+
if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
|
|
38879
|
+
const { value, type: type2 } = tableWidth;
|
|
38880
|
+
if (!type2 || type2 === "auto" || type2 === "dxa") {
|
|
38881
|
+
return twipsToPixels(value);
|
|
38882
|
+
}
|
|
38883
|
+
}
|
|
38884
|
+
return null;
|
|
38885
|
+
};
|
|
38886
|
+
const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwips) => {
|
|
38887
|
+
const columnCount = Math.max(totalColumns, 1);
|
|
38888
|
+
const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params2);
|
|
38889
|
+
const tableWidthPx = getTableWidthPx(params2);
|
|
38890
|
+
const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
38891
|
+
let fallbackWidthPx = safeDefaultPx;
|
|
38892
|
+
if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
|
|
38893
|
+
fallbackWidthPx = tableWidthPx / columnCount;
|
|
38894
|
+
}
|
|
38895
|
+
const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
|
|
38896
|
+
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
|
|
38897
|
+
const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
38898
|
+
return safeDefault;
|
|
38899
|
+
}
|
|
38900
|
+
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
38901
|
+
};
|
|
38902
|
+
const XML_NODE_NAME$a = "w:tblGrid";
|
|
38903
|
+
const SD_ATTR_KEY$2 = "grid";
|
|
38904
|
+
const cellMinWidth = pixelsToTwips(10);
|
|
38905
|
+
const encode$g = (params2) => {
|
|
38906
|
+
const { nodes } = params2;
|
|
38907
|
+
const node = nodes[0];
|
|
38908
|
+
const attributes = encodeProperties(node, { [translator$a.xmlName]: translator$a }, true);
|
|
38909
|
+
return {
|
|
38910
|
+
xmlName: XML_NODE_NAME$a,
|
|
38911
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
38912
|
+
attributes
|
|
38913
|
+
};
|
|
38914
|
+
};
|
|
38915
|
+
const decode$i = (params2) => {
|
|
38916
|
+
const { grid: rawGrid } = params2.node.attrs || {};
|
|
38917
|
+
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
38918
|
+
const { firstRow = {} } = params2.extraParams || {};
|
|
38919
|
+
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
38920
|
+
const columnCountFromCells = cellNodes.reduce((count, cell) => {
|
|
38921
|
+
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
38922
|
+
return count + spanCount;
|
|
38923
|
+
}, 0);
|
|
38924
|
+
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
38925
|
+
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
|
|
38926
|
+
const elements = [];
|
|
38927
|
+
let columnIndex = 0;
|
|
38928
|
+
const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
|
|
38929
|
+
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
38930
|
+
let shouldEnforceMinimum = enforceMinimum;
|
|
38931
|
+
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
38932
|
+
numericWidth = fallbackColumnWidthTwips;
|
|
38933
|
+
shouldEnforceMinimum = true;
|
|
38934
|
+
}
|
|
38935
|
+
const roundedWidth = Math.round(numericWidth);
|
|
38936
|
+
const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
|
|
38937
|
+
const safeWidth = Math.max(roundedWidth, minimumWidth);
|
|
38938
|
+
const decoded = translator$a.decode({
|
|
38939
|
+
node: { type: (
|
|
38940
|
+
/** @type {string} */
|
|
38941
|
+
translator$a.sdNodeOrKeyName
|
|
38942
|
+
), attrs: { col: safeWidth } }
|
|
38943
|
+
});
|
|
38944
|
+
if (decoded) elements.push(decoded);
|
|
38945
|
+
};
|
|
38946
|
+
cellNodes.forEach((cell) => {
|
|
38947
|
+
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
38948
|
+
const spanCount = Math.max(1, colspan);
|
|
38949
|
+
for (let span = 0; span < spanCount; span++) {
|
|
38950
|
+
const rawWidth = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
38951
|
+
const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
|
|
38952
|
+
const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
|
|
38953
|
+
const colGridAttrs = grid?.[columnIndex] || {};
|
|
38954
|
+
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
38955
|
+
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
38956
|
+
let cellWidthTwips;
|
|
38957
|
+
let enforceMinimum = false;
|
|
38958
|
+
if (hasCellWidth) {
|
|
38959
|
+
const tolerance = 0.5;
|
|
38960
|
+
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
38961
|
+
cellWidthTwips = gridWidthTwips;
|
|
38962
|
+
} else {
|
|
38963
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
38964
|
+
}
|
|
38965
|
+
} else if (gridWidthTwips != null) {
|
|
38966
|
+
cellWidthTwips = gridWidthTwips;
|
|
38967
|
+
} else {
|
|
38968
|
+
cellWidthTwips = fallbackColumnWidthTwips;
|
|
38969
|
+
enforceMinimum = true;
|
|
38970
|
+
}
|
|
38971
|
+
pushColumn(cellWidthTwips, { enforceMinimum });
|
|
38972
|
+
columnIndex++;
|
|
38973
|
+
}
|
|
38974
|
+
});
|
|
38975
|
+
while (columnIndex < grid.length) {
|
|
38976
|
+
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
38977
|
+
pushColumn(gridWidthTwips);
|
|
38978
|
+
columnIndex++;
|
|
38979
|
+
}
|
|
38980
|
+
const newNode = {
|
|
38981
|
+
name: XML_NODE_NAME$a,
|
|
38982
|
+
attributes: {},
|
|
38983
|
+
elements
|
|
38984
|
+
};
|
|
38985
|
+
return newNode;
|
|
38986
|
+
};
|
|
38987
|
+
const config$9 = {
|
|
38988
|
+
xmlName: XML_NODE_NAME$a,
|
|
38989
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
38990
|
+
encode: encode$g,
|
|
38991
|
+
decode: decode$i
|
|
38992
|
+
};
|
|
38993
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
38994
|
+
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
38995
|
+
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
38996
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
38997
|
+
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
38998
|
+
const pctToPercent = (value) => {
|
|
38999
|
+
if (value == null) return null;
|
|
39000
|
+
return value / 50;
|
|
39001
|
+
};
|
|
39002
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
39003
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
39004
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
39005
|
+
const { value, type: type2 } = measurement;
|
|
39006
|
+
if (!type2 || type2 === "auto") return null;
|
|
39007
|
+
if (type2 === "dxa") return twipsToPixels(value);
|
|
39008
|
+
if (type2 === "pct") {
|
|
39009
|
+
const percent2 = pctToPercent(value);
|
|
39010
|
+
if (percent2 == null || percent2 <= 0) return null;
|
|
39011
|
+
const widthTwips = resolveContentWidthTwips() * percent2 / 100;
|
|
39012
|
+
return twipsToPixels(widthTwips);
|
|
39013
|
+
}
|
|
39014
|
+
return null;
|
|
39015
|
+
};
|
|
39016
|
+
const countColumnsInRow = (row) => {
|
|
39017
|
+
if (!row?.elements?.length) return 0;
|
|
39018
|
+
return row.elements.reduce((count, element) => {
|
|
39019
|
+
if (element.name !== "w:tc") return count;
|
|
39020
|
+
const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
|
|
39021
|
+
const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
39022
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
39023
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
39024
|
+
}, 0);
|
|
39025
|
+
};
|
|
39026
|
+
const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
39027
|
+
const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
39028
|
+
const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWidthMeasurement }) => {
|
|
39029
|
+
const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
|
|
39030
|
+
const columnCount = countColumnsInRow(firstRow);
|
|
39031
|
+
if (!columnCount) return null;
|
|
39032
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
|
|
39033
|
+
/** @type {any} */
|
|
39034
|
+
params2
|
|
39035
|
+
);
|
|
39036
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
39037
|
+
let totalWidthPx;
|
|
39038
|
+
if (tableWidthMeasurement) {
|
|
39039
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
39040
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
39041
|
+
}
|
|
39042
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
|
|
39043
|
+
totalWidthPx = tableWidth.width;
|
|
39044
|
+
}
|
|
39045
|
+
if (totalWidthPx == null) {
|
|
39046
|
+
totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
39047
|
+
}
|
|
39048
|
+
const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
|
|
39049
|
+
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
|
|
39050
|
+
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
39051
|
+
return {
|
|
39052
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
39053
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
39089
39054
|
};
|
|
39090
|
-
}
|
|
39091
|
-
|
|
39092
|
-
|
|
39093
|
-
|
|
39094
|
-
|
|
39095
|
-
|
|
39096
|
-
|
|
39097
|
-
if (
|
|
39098
|
-
|
|
39099
|
-
|
|
39100
|
-
if (textHighlight) marks.push({ type: "highlight", attrs: { color: textHighlight } });
|
|
39101
|
-
return marks;
|
|
39102
|
-
}
|
|
39103
|
-
function applyMarksToHtmlAnnotation(state2, marks) {
|
|
39104
|
-
const { tr, doc: doc2, schema } = state2;
|
|
39105
|
-
const allowedMarks = ["fontFamily", "fontSize", "highlight"];
|
|
39106
|
-
if (!marks.some((m2) => allowedMarks.includes(m2.type))) {
|
|
39107
|
-
return state2;
|
|
39055
|
+
};
|
|
39056
|
+
const XML_NODE_NAME$9 = "w:tbl";
|
|
39057
|
+
const SD_NODE_NAME$7 = "table";
|
|
39058
|
+
const encode$f = (params2, encodedAttrs) => {
|
|
39059
|
+
const { nodes } = params2;
|
|
39060
|
+
const node = nodes[0];
|
|
39061
|
+
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
39062
|
+
if (tblPr) {
|
|
39063
|
+
const encodedProperties = translator$b.encode({ ...params2, nodes: [tblPr] });
|
|
39064
|
+
encodedAttrs["tableProperties"] = encodedProperties || {};
|
|
39108
39065
|
}
|
|
39109
|
-
const
|
|
39110
|
-
|
|
39111
|
-
|
|
39112
|
-
|
|
39113
|
-
|
|
39114
|
-
|
|
39115
|
-
|
|
39116
|
-
|
|
39117
|
-
|
|
39118
|
-
|
|
39119
|
-
|
|
39120
|
-
|
|
39121
|
-
|
|
39122
|
-
|
|
39123
|
-
|
|
39124
|
-
|
|
39125
|
-
|
|
39126
|
-
);
|
|
39127
|
-
} else if (!foundTextStyle?.attrs.fontFamily && fontFamily2) {
|
|
39128
|
-
tr.addMark(
|
|
39129
|
-
pos,
|
|
39130
|
-
pos + node.nodeSize,
|
|
39131
|
-
textStyleType.create({
|
|
39132
|
-
...foundTextStyle?.attrs,
|
|
39133
|
-
...fontFamily2.attrs
|
|
39134
|
-
})
|
|
39135
|
-
);
|
|
39136
|
-
} else if (!foundTextStyle?.attrs.fontSize && fontSize2) {
|
|
39137
|
-
tr.addMark(
|
|
39138
|
-
pos,
|
|
39139
|
-
pos + node.nodeSize,
|
|
39140
|
-
textStyleType.create({
|
|
39141
|
-
...foundTextStyle?.attrs,
|
|
39142
|
-
...fontSize2.attrs
|
|
39143
|
-
})
|
|
39144
|
-
);
|
|
39066
|
+
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
39067
|
+
if (tblGrid) {
|
|
39068
|
+
encodedAttrs["grid"] = translator$9.encode({ ...params2, nodes: [tblGrid] }).attributes;
|
|
39069
|
+
}
|
|
39070
|
+
[
|
|
39071
|
+
"tableStyleId",
|
|
39072
|
+
"justification",
|
|
39073
|
+
"tableLayout",
|
|
39074
|
+
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
39075
|
+
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
39076
|
+
].forEach((prop) => {
|
|
39077
|
+
let key2;
|
|
39078
|
+
let transform;
|
|
39079
|
+
if (Array.isArray(prop)) {
|
|
39080
|
+
[key2, transform] = prop;
|
|
39081
|
+
} else {
|
|
39082
|
+
key2 = prop;
|
|
39083
|
+
transform = (v2) => v2;
|
|
39145
39084
|
}
|
|
39146
|
-
if (
|
|
39147
|
-
|
|
39148
|
-
pos,
|
|
39149
|
-
pos + node.nodeSize,
|
|
39150
|
-
highlightType.create({
|
|
39151
|
-
...highlight?.attrs
|
|
39152
|
-
})
|
|
39153
|
-
);
|
|
39085
|
+
if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key2]) {
|
|
39086
|
+
encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
|
|
39154
39087
|
}
|
|
39155
39088
|
});
|
|
39156
|
-
|
|
39157
|
-
|
|
39158
|
-
function getFieldHighlightJson(fieldsHighlightColor) {
|
|
39159
|
-
if (!fieldsHighlightColor) return null;
|
|
39160
|
-
let parsedColor = fieldsHighlightColor.trim();
|
|
39161
|
-
const hexRegex2 = /^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/;
|
|
39162
|
-
if (!hexRegex2.test(parsedColor)) {
|
|
39163
|
-
console.warn(`Invalid HEX color provided to fieldsHighlightColor export param: ${fieldsHighlightColor}`);
|
|
39164
|
-
return null;
|
|
39089
|
+
if (encodedAttrs.tableCellSpacing) {
|
|
39090
|
+
encodedAttrs["borderCollapse"] = "separate";
|
|
39165
39091
|
}
|
|
39166
|
-
if (
|
|
39167
|
-
|
|
39092
|
+
if (encodedAttrs.tableProperties?.tableWidth) {
|
|
39093
|
+
const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
|
|
39094
|
+
const widthPx = twipsToPixels(tableWidthMeasurement.value);
|
|
39095
|
+
if (widthPx != null) {
|
|
39096
|
+
encodedAttrs.tableWidth = {
|
|
39097
|
+
width: widthPx,
|
|
39098
|
+
type: tableWidthMeasurement.type
|
|
39099
|
+
};
|
|
39100
|
+
} else if (tableWidthMeasurement.type === "auto") {
|
|
39101
|
+
encodedAttrs.tableWidth = {
|
|
39102
|
+
width: 0,
|
|
39103
|
+
type: tableWidthMeasurement.type
|
|
39104
|
+
};
|
|
39105
|
+
}
|
|
39168
39106
|
}
|
|
39169
|
-
|
|
39170
|
-
|
|
39171
|
-
|
|
39172
|
-
|
|
39173
|
-
|
|
39174
|
-
|
|
39175
|
-
|
|
39176
|
-
|
|
39177
|
-
|
|
39107
|
+
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
39108
|
+
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
39109
|
+
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
39110
|
+
encodedAttrs.tableProperties = {
|
|
39111
|
+
...encodedAttrs.tableProperties || {},
|
|
39112
|
+
cellMargins: referencedStyles.cellMargins
|
|
39113
|
+
};
|
|
39114
|
+
}
|
|
39115
|
+
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
39116
|
+
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
39117
|
+
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
39118
|
+
encodedAttrs["borders"] = borderData;
|
|
39119
|
+
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
39120
|
+
if (!columnWidths.length) {
|
|
39121
|
+
const fallback = buildFallbackGridForTable({
|
|
39122
|
+
params: params2,
|
|
39123
|
+
rows,
|
|
39124
|
+
tableWidth: encodedAttrs.tableWidth,
|
|
39125
|
+
tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
|
|
39126
|
+
});
|
|
39127
|
+
if (fallback) {
|
|
39128
|
+
encodedAttrs.grid = fallback.grid;
|
|
39129
|
+
columnWidths = fallback.columnWidths;
|
|
39130
|
+
}
|
|
39131
|
+
}
|
|
39132
|
+
const content = [];
|
|
39133
|
+
const totalColumns = columnWidths.length;
|
|
39134
|
+
const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
|
|
39135
|
+
rows.forEach((row, rowIndex) => {
|
|
39136
|
+
const result = translator$u.encode({
|
|
39137
|
+
...params2,
|
|
39138
|
+
nodes: [row],
|
|
39139
|
+
extraParams: {
|
|
39140
|
+
row,
|
|
39141
|
+
table: node,
|
|
39142
|
+
rowBorders: borderRowData,
|
|
39143
|
+
columnWidths,
|
|
39144
|
+
activeRowSpans: activeRowSpans.slice(),
|
|
39145
|
+
rowIndex,
|
|
39146
|
+
_referencedStyles: referencedStyles
|
|
39147
|
+
}
|
|
39148
|
+
});
|
|
39149
|
+
if (result) {
|
|
39150
|
+
content.push(result);
|
|
39151
|
+
if (totalColumns > 0) {
|
|
39152
|
+
const activeRowSpansForCurrentRow = activeRowSpans.slice();
|
|
39153
|
+
for (let col = 0; col < totalColumns; col++) {
|
|
39154
|
+
if (activeRowSpans[col] > 0) {
|
|
39155
|
+
activeRowSpans[col] -= 1;
|
|
39156
|
+
}
|
|
39178
39157
|
}
|
|
39158
|
+
let columnIndex = 0;
|
|
39159
|
+
const advanceColumnIndex = () => {
|
|
39160
|
+
while (columnIndex < totalColumns && activeRowSpansForCurrentRow[columnIndex] > 0) {
|
|
39161
|
+
columnIndex += 1;
|
|
39162
|
+
}
|
|
39163
|
+
};
|
|
39164
|
+
advanceColumnIndex();
|
|
39165
|
+
result.content?.forEach((cell) => {
|
|
39166
|
+
advanceColumnIndex();
|
|
39167
|
+
const colspan = Math.max(1, cell.attrs?.colspan || 1);
|
|
39168
|
+
const rowspan = Math.max(1, cell.attrs?.rowspan || 1);
|
|
39169
|
+
if (rowspan > 1) {
|
|
39170
|
+
for (let offset2 = 0; offset2 < colspan && columnIndex + offset2 < totalColumns; offset2++) {
|
|
39171
|
+
const targetIndex = columnIndex + offset2;
|
|
39172
|
+
const remainingRows = rowspan - 1;
|
|
39173
|
+
if (remainingRows > 0 && remainingRows > activeRowSpans[targetIndex]) {
|
|
39174
|
+
activeRowSpans[targetIndex] = remainingRows;
|
|
39175
|
+
}
|
|
39176
|
+
}
|
|
39177
|
+
}
|
|
39178
|
+
columnIndex += colspan;
|
|
39179
|
+
advanceColumnIndex();
|
|
39180
|
+
});
|
|
39179
39181
|
}
|
|
39180
|
-
|
|
39182
|
+
}
|
|
39183
|
+
});
|
|
39184
|
+
return {
|
|
39185
|
+
type: "table",
|
|
39186
|
+
content,
|
|
39187
|
+
attrs: encodedAttrs
|
|
39181
39188
|
};
|
|
39182
|
-
}
|
|
39183
|
-
|
|
39189
|
+
};
|
|
39190
|
+
const decode$h = (params2, decodedAttrs) => {
|
|
39191
|
+
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
39184
39192
|
const { node } = params2;
|
|
39185
|
-
const
|
|
39186
|
-
const
|
|
39187
|
-
const
|
|
39188
|
-
|
|
39189
|
-
|
|
39190
|
-
|
|
39193
|
+
const elements = translateChildNodes(params2);
|
|
39194
|
+
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
39195
|
+
const properties = node.attrs.grid;
|
|
39196
|
+
const element = translator$9.decode({
|
|
39197
|
+
...params2,
|
|
39198
|
+
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
39199
|
+
extraParams: {
|
|
39200
|
+
firstRow
|
|
39191
39201
|
}
|
|
39192
|
-
];
|
|
39193
|
-
const exportedTag = JSON.stringify({
|
|
39194
|
-
type: "documentSection",
|
|
39195
|
-
description: attrs.description
|
|
39196
39202
|
});
|
|
39197
|
-
|
|
39198
|
-
|
|
39199
|
-
|
|
39200
|
-
|
|
39201
|
-
|
|
39202
|
-
|
|
39203
|
-
"w:val": "sdtContentLocked"
|
|
39204
|
-
}
|
|
39203
|
+
if (element) elements.unshift(element);
|
|
39204
|
+
if (node.attrs?.tableProperties) {
|
|
39205
|
+
const properties2 = { ...node.attrs.tableProperties };
|
|
39206
|
+
const element2 = translator$b.decode({
|
|
39207
|
+
...params2,
|
|
39208
|
+
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
39205
39209
|
});
|
|
39210
|
+
if (element2) elements.unshift(element2);
|
|
39206
39211
|
}
|
|
39207
|
-
nodeElements.unshift(sdtPr);
|
|
39208
|
-
const result = {
|
|
39209
|
-
name: "w:sdt",
|
|
39210
|
-
elements: nodeElements
|
|
39211
|
-
};
|
|
39212
|
-
return result;
|
|
39213
|
-
}
|
|
39214
|
-
const generateSdtPrTagForDocumentSection = (id, title, tag) => {
|
|
39215
39212
|
return {
|
|
39216
|
-
name: "w:
|
|
39217
|
-
|
|
39218
|
-
|
|
39219
|
-
name: "w:id",
|
|
39220
|
-
attributes: {
|
|
39221
|
-
"w:val": id
|
|
39222
|
-
}
|
|
39223
|
-
},
|
|
39224
|
-
{
|
|
39225
|
-
name: "w:alias",
|
|
39226
|
-
attributes: {
|
|
39227
|
-
"w:val": title
|
|
39228
|
-
}
|
|
39229
|
-
},
|
|
39230
|
-
{
|
|
39231
|
-
name: "w:tag",
|
|
39232
|
-
attributes: {
|
|
39233
|
-
"w:val": tag
|
|
39234
|
-
}
|
|
39235
|
-
}
|
|
39236
|
-
]
|
|
39213
|
+
name: "w:tbl",
|
|
39214
|
+
attributes: decodedAttrs || {},
|
|
39215
|
+
elements
|
|
39237
39216
|
};
|
|
39238
39217
|
};
|
|
39239
|
-
function
|
|
39240
|
-
const
|
|
39241
|
-
const
|
|
39242
|
-
|
|
39243
|
-
|
|
39244
|
-
|
|
39245
|
-
|
|
39246
|
-
|
|
39247
|
-
|
|
39248
|
-
|
|
39249
|
-
|
|
39250
|
-
|
|
39251
|
-
|
|
39252
|
-
|
|
39253
|
-
|
|
39254
|
-
|
|
39255
|
-
elements: [
|
|
39256
|
-
{
|
|
39257
|
-
name: "w:docPartGallery",
|
|
39258
|
-
attributes: {
|
|
39259
|
-
"w:val": attrs.docPartGallery
|
|
39260
|
-
}
|
|
39261
|
-
},
|
|
39262
|
-
...attrs.docPartUnique ? [
|
|
39263
|
-
{
|
|
39264
|
-
name: "w:docPartUnique"
|
|
39265
|
-
}
|
|
39266
|
-
] : []
|
|
39267
|
-
]
|
|
39268
|
-
}
|
|
39269
|
-
]
|
|
39270
|
-
},
|
|
39271
|
-
{
|
|
39272
|
-
name: "w:sdtContent",
|
|
39273
|
-
elements: childContent
|
|
39274
|
-
}
|
|
39275
|
-
];
|
|
39276
|
-
const result = {
|
|
39277
|
-
name: "w:sdt",
|
|
39278
|
-
elements: nodeElements
|
|
39279
|
-
};
|
|
39280
|
-
return result;
|
|
39281
|
-
}
|
|
39282
|
-
function translateStructuredContent(params2) {
|
|
39283
|
-
const { node } = params2;
|
|
39284
|
-
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
39285
|
-
const sdtContent = { name: "w:sdtContent", elements: childContent };
|
|
39286
|
-
const sdtPr = generateSdtPrTagForStructuredContent({ node });
|
|
39287
|
-
const nodeElements = [sdtPr, sdtContent];
|
|
39288
|
-
const result = {
|
|
39289
|
-
name: "w:sdt",
|
|
39290
|
-
elements: nodeElements
|
|
39218
|
+
function _processTableBorders(rawBorders) {
|
|
39219
|
+
const borders = {};
|
|
39220
|
+
const rowBorders = {};
|
|
39221
|
+
Object.entries(rawBorders).forEach(([name, attributes]) => {
|
|
39222
|
+
const attrs = {};
|
|
39223
|
+
const color = attributes.color;
|
|
39224
|
+
const size2 = attributes.size;
|
|
39225
|
+
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
39226
|
+
if (size2 && size2 !== "auto") attrs["size"] = eighthPointsToPixels(size2);
|
|
39227
|
+
const rowBorderNames = ["insideH", "insideV"];
|
|
39228
|
+
if (rowBorderNames.includes(name)) rowBorders[name] = attrs;
|
|
39229
|
+
borders[name] = attrs;
|
|
39230
|
+
});
|
|
39231
|
+
return {
|
|
39232
|
+
borders,
|
|
39233
|
+
rowBorders
|
|
39291
39234
|
};
|
|
39292
|
-
return result;
|
|
39293
39235
|
}
|
|
39294
|
-
function
|
|
39295
|
-
|
|
39296
|
-
const
|
|
39297
|
-
|
|
39298
|
-
|
|
39299
|
-
|
|
39300
|
-
|
|
39301
|
-
const
|
|
39302
|
-
|
|
39303
|
-
|
|
39304
|
-
|
|
39305
|
-
|
|
39306
|
-
|
|
39307
|
-
|
|
39308
|
-
|
|
39309
|
-
attributes: { "w:val": attrs.tag }
|
|
39310
|
-
};
|
|
39311
|
-
const resultElements = [];
|
|
39312
|
-
if (attrs.id) resultElements.push(id);
|
|
39313
|
-
if (attrs.alias) resultElements.push(alias);
|
|
39314
|
-
if (attrs.tag) resultElements.push(tag);
|
|
39315
|
-
if (attrs.sdtPr) {
|
|
39316
|
-
const elements = attrs.sdtPr.elements || [];
|
|
39317
|
-
const elementsToExclude = ["w:id", "w:alias", "w:tag"];
|
|
39318
|
-
const restElements = elements.filter((el) => !elementsToExclude.includes(el.name));
|
|
39319
|
-
const result2 = {
|
|
39320
|
-
name: "w:sdtPr",
|
|
39321
|
-
type: "element",
|
|
39322
|
-
elements: [...resultElements, ...restElements]
|
|
39323
|
-
};
|
|
39324
|
-
return result2;
|
|
39236
|
+
function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
39237
|
+
if (!tableStyleReference) return null;
|
|
39238
|
+
const stylesToReturn = {};
|
|
39239
|
+
const { docx } = params2;
|
|
39240
|
+
const styles = docx["word/styles.xml"];
|
|
39241
|
+
const { elements } = styles.elements[0];
|
|
39242
|
+
const styleElements = elements.filter((el) => el.name === "w:style");
|
|
39243
|
+
const styleTag = styleElements.find((el) => el.attributes["w:styleId"] === tableStyleReference);
|
|
39244
|
+
if (!styleTag) return null;
|
|
39245
|
+
stylesToReturn.name = styleTag.elements.find((el) => el.name === "w:name");
|
|
39246
|
+
const basedOn = styleTag.elements.find((el) => el.name === "w:basedOn");
|
|
39247
|
+
let baseTblPr;
|
|
39248
|
+
if (basedOn?.attributes) {
|
|
39249
|
+
const baseStyles = styleElements.find((el) => el.attributes["w:styleId"] === basedOn.attributes["w:val"]);
|
|
39250
|
+
baseTblPr = baseStyles ? baseStyles.elements.find((el) => el.name === "w:tblPr") : {};
|
|
39325
39251
|
}
|
|
39326
|
-
const
|
|
39327
|
-
|
|
39328
|
-
|
|
39329
|
-
|
|
39330
|
-
};
|
|
39331
|
-
return result;
|
|
39332
|
-
}
|
|
39333
|
-
const XML_NODE_NAME$9 = "w:sdt";
|
|
39334
|
-
const SD_NODE_NAME$7 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
39335
|
-
const validXmlAttributes$6 = [];
|
|
39336
|
-
function encode$f(params2) {
|
|
39337
|
-
const nodes = params2.nodes;
|
|
39338
|
-
const node = nodes[0];
|
|
39339
|
-
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
39340
|
-
if (!handler2 || sdtType === "unknown") {
|
|
39341
|
-
return void 0;
|
|
39252
|
+
const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
|
|
39253
|
+
if (pPr) {
|
|
39254
|
+
const justification = pPr.elements.find((el) => el.name === "w:jc");
|
|
39255
|
+
if (justification?.attributes) stylesToReturn.justification = justification.attributes["w:val"];
|
|
39342
39256
|
}
|
|
39343
|
-
const
|
|
39344
|
-
|
|
39345
|
-
|
|
39346
|
-
|
|
39347
|
-
|
|
39348
|
-
|
|
39349
|
-
|
|
39257
|
+
const rPr = styleTag?.elements.find((el) => el.name === "w:rPr");
|
|
39258
|
+
if (rPr) {
|
|
39259
|
+
const fonts = rPr.elements.find((el) => el.name === "w:rFonts");
|
|
39260
|
+
if (fonts) {
|
|
39261
|
+
const { "w:ascii": ascii, "w:hAnsi": hAnsi, "w:cs": cs } = fonts.attributes;
|
|
39262
|
+
stylesToReturn.fonts = { ascii, hAnsi, cs };
|
|
39263
|
+
}
|
|
39264
|
+
const fontSize2 = rPr.elements.find((el) => el.name === "w:sz");
|
|
39265
|
+
if (fontSize2?.attributes) stylesToReturn.fontSize = halfPointToPoints(fontSize2.attributes["w:val"]) + "pt";
|
|
39350
39266
|
}
|
|
39351
|
-
const
|
|
39352
|
-
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
|
|
39362
|
-
|
|
39267
|
+
const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
|
|
39268
|
+
if (tblPr && tblPr.elements) {
|
|
39269
|
+
if (baseTblPr && baseTblPr.elements) {
|
|
39270
|
+
tblPr.elements.push(...baseTblPr.elements);
|
|
39271
|
+
}
|
|
39272
|
+
const tableProperties = translator$b.encode({ ...params2, nodes: [tblPr] });
|
|
39273
|
+
if (tableProperties) {
|
|
39274
|
+
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
39275
|
+
if (borders) stylesToReturn.borders = borders;
|
|
39276
|
+
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
39277
|
+
const cellMargins = {};
|
|
39278
|
+
Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
|
|
39279
|
+
if (attrs?.value != null) {
|
|
39280
|
+
cellMargins[key2] = {
|
|
39281
|
+
value: attrs.value,
|
|
39282
|
+
type: attrs.type || "dxa"
|
|
39283
|
+
};
|
|
39284
|
+
}
|
|
39285
|
+
});
|
|
39286
|
+
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
39287
|
+
}
|
|
39288
|
+
}
|
|
39289
|
+
return stylesToReturn;
|
|
39363
39290
|
}
|
|
39364
39291
|
const config$8 = {
|
|
39365
39292
|
xmlName: XML_NODE_NAME$9,
|
|
@@ -39367,7 +39294,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39367
39294
|
type: NodeTranslator.translatorTypes.NODE,
|
|
39368
39295
|
encode: encode$f,
|
|
39369
39296
|
decode: decode$h,
|
|
39370
|
-
attributes:
|
|
39297
|
+
attributes: []
|
|
39371
39298
|
};
|
|
39372
39299
|
const translator$8 = NodeTranslator.from(config$8);
|
|
39373
39300
|
const encode$e = (attributes) => {
|
|
@@ -39882,7 +39809,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39882
39809
|
if (mainNode.name === "w:drawing") node = mainNode;
|
|
39883
39810
|
else node = mainNode.elements.find((el) => el.name === "w:drawing");
|
|
39884
39811
|
if (!node) return { nodes: [], consumed: 0 };
|
|
39885
|
-
const schemaNode = translator$
|
|
39812
|
+
const schemaNode = translator$r.encode(params2);
|
|
39886
39813
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
39887
39814
|
return { nodes: newNodes, consumed: 1 };
|
|
39888
39815
|
};
|
|
@@ -40191,7 +40118,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40191
40118
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
40192
40119
|
return { nodes: [], consumed: 0 };
|
|
40193
40120
|
}
|
|
40194
|
-
const result = translator$
|
|
40121
|
+
const result = translator$q.encode(params2);
|
|
40195
40122
|
if (!result) {
|
|
40196
40123
|
return { nodes: [], consumed: 0 };
|
|
40197
40124
|
}
|
|
@@ -40958,6 +40885,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40958
40885
|
handlerName: "w:tabTranslator",
|
|
40959
40886
|
handler: handleTabNode
|
|
40960
40887
|
};
|
|
40888
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$8);
|
|
40961
40889
|
const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$4);
|
|
40962
40890
|
function preProcessPageInstruction(nodesToCombine) {
|
|
40963
40891
|
const pageNumNode = {
|
|
@@ -41967,14 +41895,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41967
41895
|
bulletList: translateList,
|
|
41968
41896
|
orderedList: translateList,
|
|
41969
41897
|
lineBreak: translator$1r,
|
|
41970
|
-
table: translator$
|
|
41971
|
-
tableRow: translator$
|
|
41972
|
-
tableCell: translator$
|
|
41898
|
+
table: translator$8,
|
|
41899
|
+
tableRow: translator$u,
|
|
41900
|
+
tableCell: translator$H,
|
|
41973
41901
|
bookmarkStart: translator$7,
|
|
41974
41902
|
bookmarkEnd: translator$6,
|
|
41975
|
-
fieldAnnotation: translator$
|
|
41903
|
+
fieldAnnotation: translator$q,
|
|
41976
41904
|
tab: translator$1p,
|
|
41977
|
-
image: translator$
|
|
41905
|
+
image: translator$r,
|
|
41978
41906
|
hardBreak: translator$1r,
|
|
41979
41907
|
commentRangeStart: commentRangeStartTranslator,
|
|
41980
41908
|
commentRangeEnd: commentRangeEndTranslator,
|
|
@@ -41983,10 +41911,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41983
41911
|
shapeTextbox: translator,
|
|
41984
41912
|
contentBlock: translator,
|
|
41985
41913
|
vectorShape: translateVectorShape,
|
|
41986
|
-
structuredContent: translator$
|
|
41987
|
-
structuredContentBlock: translator$
|
|
41988
|
-
documentPartObject: translator$
|
|
41989
|
-
documentSection: translator$
|
|
41914
|
+
structuredContent: translator$q,
|
|
41915
|
+
structuredContentBlock: translator$q,
|
|
41916
|
+
documentPartObject: translator$q,
|
|
41917
|
+
documentSection: translator$q,
|
|
41990
41918
|
"page-number": translatePageNumberNode,
|
|
41991
41919
|
"total-page-number": translateTotalPageNumberNode,
|
|
41992
41920
|
pageReference: translator$5,
|
|
@@ -43720,7 +43648,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
43720
43648
|
});
|
|
43721
43649
|
relationships.elements = [...relationships.elements, ...newRels];
|
|
43722
43650
|
};
|
|
43723
|
-
exportProcessMediaFiles_fn = async function(media = {}
|
|
43651
|
+
exportProcessMediaFiles_fn = async function(media = {}) {
|
|
43724
43652
|
const processedData = {
|
|
43725
43653
|
...this.convertedXml.media || {}
|
|
43726
43654
|
};
|
|
@@ -51487,6 +51415,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
51487
51415
|
let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
|
|
51488
51416
|
if (!view.someProp("handleTextInput", (f2) => f2(view, chFrom, chTo, text, deflt)))
|
|
51489
51417
|
view.dispatch(deflt());
|
|
51418
|
+
} else {
|
|
51419
|
+
view.dispatch(mkTr());
|
|
51490
51420
|
}
|
|
51491
51421
|
} else {
|
|
51492
51422
|
view.dispatch(mkTr());
|
|
@@ -56684,6 +56614,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56684
56614
|
editor.view.dispatch(selectionTr);
|
|
56685
56615
|
}
|
|
56686
56616
|
};
|
|
56617
|
+
const clamp = (value, min2, max2) => Math.max(min2, Math.min(value, max2));
|
|
56618
|
+
const setTextSelection = ({ from: from2, to }) => ({ state: state2, dispatch, editor }) => {
|
|
56619
|
+
if (typeof from2 !== "number" && typeof to !== "number") {
|
|
56620
|
+
return false;
|
|
56621
|
+
}
|
|
56622
|
+
const doc2 = state2.doc;
|
|
56623
|
+
const docSize = doc2.content.size;
|
|
56624
|
+
const nextFrom = clamp(typeof from2 === "number" ? from2 : state2.selection.from, 0, docSize);
|
|
56625
|
+
const nextToBase = typeof to === "number" ? to : nextFrom;
|
|
56626
|
+
const nextTo = clamp(nextToBase, 0, docSize);
|
|
56627
|
+
const [head, anchor] = nextFrom <= nextTo ? [nextFrom, nextTo] : [nextTo, nextFrom];
|
|
56628
|
+
const selection = TextSelection$1.create(doc2, head, anchor);
|
|
56629
|
+
if (dispatch) {
|
|
56630
|
+
const transaction = state2.tr.setSelection(selection);
|
|
56631
|
+
dispatch(transaction);
|
|
56632
|
+
}
|
|
56633
|
+
if (editor?.view?.focus) {
|
|
56634
|
+
editor.view.focus();
|
|
56635
|
+
}
|
|
56636
|
+
return true;
|
|
56637
|
+
};
|
|
56638
|
+
const getSelectionMarks = () => ({ state: state2, tr }) => {
|
|
56639
|
+
tr.setMeta("preventDispatch", true);
|
|
56640
|
+
const marks = getMarksFromSelection(state2) ?? [];
|
|
56641
|
+
const uniqueByType = /* @__PURE__ */ new Map();
|
|
56642
|
+
for (const mark of marks) {
|
|
56643
|
+
const typeName = typeof mark?.type === "string" ? mark.type : mark?.type?.name;
|
|
56644
|
+
if (!typeName) continue;
|
|
56645
|
+
const existing = uniqueByType.get(typeName);
|
|
56646
|
+
if (!existing) {
|
|
56647
|
+
uniqueByType.set(typeName, mark);
|
|
56648
|
+
continue;
|
|
56649
|
+
}
|
|
56650
|
+
const existingAttrs = existing?.attrs ?? {};
|
|
56651
|
+
const nextAttrs = mark?.attrs ?? {};
|
|
56652
|
+
const existingHasValues = Object.values(existingAttrs).some((value) => value != null);
|
|
56653
|
+
const nextHasValues = Object.values(nextAttrs).some((value) => value != null);
|
|
56654
|
+
if (!existingHasValues && nextHasValues) {
|
|
56655
|
+
uniqueByType.set(typeName, mark);
|
|
56656
|
+
}
|
|
56657
|
+
}
|
|
56658
|
+
return Array.from(uniqueByType.values());
|
|
56659
|
+
};
|
|
56687
56660
|
const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
56688
56661
|
__proto__: null,
|
|
56689
56662
|
atVisualParaEnd,
|
|
@@ -56699,6 +56672,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56699
56672
|
first,
|
|
56700
56673
|
getEffectiveStyleId,
|
|
56701
56674
|
getParaCtx,
|
|
56675
|
+
getSelectionMarks,
|
|
56702
56676
|
getStyleIdFromMarks,
|
|
56703
56677
|
handleBackspaceNextToList,
|
|
56704
56678
|
handleDeleteNextToList,
|
|
@@ -56730,6 +56704,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56730
56704
|
setMark,
|
|
56731
56705
|
setMeta,
|
|
56732
56706
|
setNode,
|
|
56707
|
+
setTextSelection,
|
|
56733
56708
|
sinkListItem,
|
|
56734
56709
|
splitBlock: splitBlock$1,
|
|
56735
56710
|
splitListItem,
|
|
@@ -57007,11 +56982,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57007
56982
|
};
|
|
57008
56983
|
var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
|
|
57009
56984
|
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
57010
|
-
for (var i
|
|
57011
|
-
for (var i
|
|
57012
|
-
for (var i
|
|
57013
|
-
base$2[i
|
|
57014
|
-
shift[i
|
|
56985
|
+
for (var i = 0; i < 10; i++) base$2[48 + i] = base$2[96 + i] = String(i);
|
|
56986
|
+
for (var i = 1; i <= 24; i++) base$2[i + 111] = "F" + i;
|
|
56987
|
+
for (var i = 65; i <= 90; i++) {
|
|
56988
|
+
base$2[i] = String.fromCharCode(i + 32);
|
|
56989
|
+
shift[i] = String.fromCharCode(i);
|
|
57015
56990
|
}
|
|
57016
56991
|
for (var code in base$2) if (!shift.hasOwnProperty(code)) shift[code] = base$2[code];
|
|
57017
56992
|
function keyName(event) {
|
|
@@ -57394,6 +57369,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57394
57369
|
id,
|
|
57395
57370
|
author: user.name,
|
|
57396
57371
|
authorEmail: user.email,
|
|
57372
|
+
authorImage: user.image,
|
|
57397
57373
|
date
|
|
57398
57374
|
});
|
|
57399
57375
|
tr.addMark(from2, to, insertionMark);
|
|
@@ -57430,6 +57406,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57430
57406
|
id,
|
|
57431
57407
|
author: user.name,
|
|
57432
57408
|
authorEmail: user.email,
|
|
57409
|
+
authorImage: user.image,
|
|
57433
57410
|
date
|
|
57434
57411
|
});
|
|
57435
57412
|
const deletionMap = new Mapping();
|
|
@@ -58126,6 +58103,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58126
58103
|
if (!normalized.creatorEmail && user?.email) {
|
|
58127
58104
|
normalized.creatorEmail = user.email;
|
|
58128
58105
|
}
|
|
58106
|
+
if (!normalized.creatorImage && user?.image) {
|
|
58107
|
+
normalized.creatorImage = user.image;
|
|
58108
|
+
}
|
|
58129
58109
|
if (!normalized.createdTime) {
|
|
58130
58110
|
normalized.createdTime = Date.now();
|
|
58131
58111
|
}
|
|
@@ -58584,7 +58564,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58584
58564
|
const trackedMark = marks.insertedMark || marks.deletionMark || marks.formatMark;
|
|
58585
58565
|
const { type: type2, attrs } = trackedMark;
|
|
58586
58566
|
const { name: trackedChangeType } = type2;
|
|
58587
|
-
const { author, authorEmail, date, importedAuthor } = attrs;
|
|
58567
|
+
const { author, authorEmail, authorImage, date, importedAuthor } = attrs;
|
|
58588
58568
|
const id = attrs.id;
|
|
58589
58569
|
const node = nodes[0];
|
|
58590
58570
|
const isDeletionInsertion = !!(marks.insertedMark && marks.deletionMark);
|
|
@@ -58615,6 +58595,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58615
58595
|
deletedText: marks.deletionMark ? deletionText : null,
|
|
58616
58596
|
author,
|
|
58617
58597
|
authorEmail,
|
|
58598
|
+
...authorImage && { authorImage },
|
|
58618
58599
|
date,
|
|
58619
58600
|
...importedAuthor && {
|
|
58620
58601
|
importedAuthor: {
|
|
@@ -58759,6 +58740,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58759
58740
|
id: wid,
|
|
58760
58741
|
author: user.name,
|
|
58761
58742
|
authorEmail: user.email,
|
|
58743
|
+
authorImage: user.image,
|
|
58762
58744
|
date,
|
|
58763
58745
|
before,
|
|
58764
58746
|
after
|
|
@@ -58824,6 +58806,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58824
58806
|
id: v4$1(),
|
|
58825
58807
|
author: user.name,
|
|
58826
58808
|
authorEmail: user.email,
|
|
58809
|
+
authorImage: user.image,
|
|
58827
58810
|
date,
|
|
58828
58811
|
before,
|
|
58829
58812
|
after
|
|
@@ -62823,6 +62806,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62823
62806
|
return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
|
|
62824
62807
|
}
|
|
62825
62808
|
}
|
|
62809
|
+
function needsGap(type2) {
|
|
62810
|
+
return type2.isAtom || type2.spec.isolating || type2.spec.createGapCursor;
|
|
62811
|
+
}
|
|
62826
62812
|
function closedBefore($pos) {
|
|
62827
62813
|
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
62828
62814
|
let index2 = $pos.index(d2), parent = $pos.node(d2);
|
|
@@ -62832,7 +62818,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62832
62818
|
continue;
|
|
62833
62819
|
}
|
|
62834
62820
|
for (let before = parent.child(index2 - 1); ; before = before.lastChild) {
|
|
62835
|
-
if (before.childCount == 0 && !before.inlineContent || before.
|
|
62821
|
+
if (before.childCount == 0 && !before.inlineContent || needsGap(before.type))
|
|
62836
62822
|
return true;
|
|
62837
62823
|
if (before.inlineContent)
|
|
62838
62824
|
return false;
|
|
@@ -62849,7 +62835,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62849
62835
|
continue;
|
|
62850
62836
|
}
|
|
62851
62837
|
for (let after = parent.child(index2); ; after = after.firstChild) {
|
|
62852
|
-
if (after.childCount == 0 && !after.inlineContent || after.
|
|
62838
|
+
if (after.childCount == 0 && !after.inlineContent || needsGap(after.type))
|
|
62853
62839
|
return true;
|
|
62854
62840
|
if (after.inlineContent)
|
|
62855
62841
|
return false;
|
|
@@ -77734,6 +77720,16 @@ ${l}
|
|
|
77734
77720
|
};
|
|
77735
77721
|
}
|
|
77736
77722
|
},
|
|
77723
|
+
authorImage: {
|
|
77724
|
+
default: "",
|
|
77725
|
+
parseDOM: (elem) => elem.getAttribute("data-authorimage"),
|
|
77726
|
+
renderDOM: (attrs) => {
|
|
77727
|
+
if (!attrs.authorImage) return {};
|
|
77728
|
+
return {
|
|
77729
|
+
"data-authorimage": attrs.authorImage
|
|
77730
|
+
};
|
|
77731
|
+
}
|
|
77732
|
+
},
|
|
77737
77733
|
date: {
|
|
77738
77734
|
default: "",
|
|
77739
77735
|
parseDOM: (elem) => elem.getAttribute("data-date"),
|
|
@@ -77801,6 +77797,16 @@ ${l}
|
|
|
77801
77797
|
};
|
|
77802
77798
|
}
|
|
77803
77799
|
},
|
|
77800
|
+
authorImage: {
|
|
77801
|
+
default: "",
|
|
77802
|
+
parseDOM: (elem) => elem.getAttribute("data-authorimage"),
|
|
77803
|
+
renderDOM: (attrs) => {
|
|
77804
|
+
if (!attrs.authorImage) return {};
|
|
77805
|
+
return {
|
|
77806
|
+
"data-authorimage": attrs.authorImage
|
|
77807
|
+
};
|
|
77808
|
+
}
|
|
77809
|
+
},
|
|
77804
77810
|
date: {
|
|
77805
77811
|
default: "",
|
|
77806
77812
|
parseDOM: (elem) => elem.getAttribute("data-date"),
|
|
@@ -77900,6 +77906,16 @@ ${l}
|
|
|
77900
77906
|
};
|
|
77901
77907
|
}
|
|
77902
77908
|
},
|
|
77909
|
+
authorImage: {
|
|
77910
|
+
default: "",
|
|
77911
|
+
parseDOM: (elem) => elem.getAttribute("data-authorimage"),
|
|
77912
|
+
renderDOM: (attrs) => {
|
|
77913
|
+
if (!attrs.authorImage) return {};
|
|
77914
|
+
return {
|
|
77915
|
+
"data-authorimage": attrs.authorImage
|
|
77916
|
+
};
|
|
77917
|
+
}
|
|
77918
|
+
},
|
|
77903
77919
|
date: {
|
|
77904
77920
|
default: "",
|
|
77905
77921
|
parseDOM: (elem) => elem.getAttribute("data-date"),
|
|
@@ -99553,86 +99569,86 @@ ${style2}
|
|
|
99553
99569
|
"sd:pageReference": translator$5,
|
|
99554
99570
|
"sd:tableOfContents": translator$4,
|
|
99555
99571
|
"w:b": translator$1n,
|
|
99556
|
-
"w:bidiVisual": translator$
|
|
99572
|
+
"w:bidiVisual": translator$p,
|
|
99557
99573
|
"w:bookmarkEnd": translator$6,
|
|
99558
99574
|
"w:bookmarkStart": translator$7,
|
|
99559
|
-
"w:bottom": translator$
|
|
99575
|
+
"w:bottom": translator$15,
|
|
99560
99576
|
"w:br": translator$1r,
|
|
99561
|
-
"w:cantSplit": translator$
|
|
99562
|
-
"w:cnfStyle": translator$
|
|
99577
|
+
"w:cantSplit": translator$G,
|
|
99578
|
+
"w:cnfStyle": translator$1a,
|
|
99563
99579
|
"w:color": translator$1j,
|
|
99564
|
-
"w:divId": translator$
|
|
99565
|
-
"w:drawing": translator$
|
|
99566
|
-
"w:end": translator$
|
|
99567
|
-
"w:gridAfter": translator$
|
|
99568
|
-
"w:gridBefore": translator$
|
|
99569
|
-
"w:gridCol": translator$
|
|
99570
|
-
"w:hidden": translator$
|
|
99580
|
+
"w:divId": translator$F,
|
|
99581
|
+
"w:drawing": translator$r,
|
|
99582
|
+
"w:end": translator$13,
|
|
99583
|
+
"w:gridAfter": translator$E,
|
|
99584
|
+
"w:gridBefore": translator$D,
|
|
99585
|
+
"w:gridCol": translator$a,
|
|
99586
|
+
"w:hidden": translator$C,
|
|
99571
99587
|
"w:highlight": translator$1q,
|
|
99572
99588
|
"w:hyperlink": translator$1c,
|
|
99573
99589
|
"w:i": translator$1m,
|
|
99574
|
-
"w:insideH": translator$
|
|
99575
|
-
"w:insideV": translator$
|
|
99576
|
-
"w:jc": translator$
|
|
99577
|
-
"w:left": translator
|
|
99590
|
+
"w:insideH": translator$11,
|
|
99591
|
+
"w:insideV": translator$10,
|
|
99592
|
+
"w:jc": translator$B,
|
|
99593
|
+
"w:left": translator$$,
|
|
99578
99594
|
"w:p": translator$1o,
|
|
99579
99595
|
"w:r": translator$1b,
|
|
99580
99596
|
"w:rFonts": translator$1i,
|
|
99581
99597
|
"w:rPr": translator$1d,
|
|
99582
99598
|
"w:rStyle": translator$1h,
|
|
99583
|
-
"w:right": translator$
|
|
99584
|
-
"w:sdt": translator$
|
|
99585
|
-
"w:shd": translator$
|
|
99586
|
-
"w:start": translator$
|
|
99599
|
+
"w:right": translator$Z,
|
|
99600
|
+
"w:sdt": translator$q,
|
|
99601
|
+
"w:shd": translator$19,
|
|
99602
|
+
"w:start": translator$X,
|
|
99587
99603
|
"w:strike": translator$1k,
|
|
99588
99604
|
"w:sz": translator$1g,
|
|
99589
99605
|
"w:szCs": translator$1f,
|
|
99590
99606
|
"w:tab": translator$1p,
|
|
99591
|
-
"w:tbl": translator$
|
|
99592
|
-
"w:tblBorders": translator$
|
|
99593
|
-
"w:tblCaption": translator$
|
|
99594
|
-
"w:tblCellMar": translator$
|
|
99595
|
-
"w:tblCellSpacing": translator$
|
|
99596
|
-
"w:tblDescription": translator$
|
|
99597
|
-
"w:tblGrid": translator$
|
|
99598
|
-
"w:tblHeader": translator$
|
|
99599
|
-
"w:tblInd": translator$
|
|
99600
|
-
"w:tblLayout": translator$
|
|
99601
|
-
"w:tblLook": translator$
|
|
99602
|
-
"w:tblOverlap": translator$
|
|
99603
|
-
"w:tblPr": translator$
|
|
99604
|
-
"w:tblStyle": translator$
|
|
99605
|
-
"w:tblStyleColBandSize": translator$
|
|
99606
|
-
"w:tblStyleRowBandSize": translator$
|
|
99607
|
-
"w:tblW": translator$
|
|
99608
|
-
"w:tblpPr": translator$
|
|
99609
|
-
"w:tc": translator$
|
|
99610
|
-
"w:top": translator$
|
|
99611
|
-
"w:tr": translator$
|
|
99612
|
-
"w:trHeight": translator$
|
|
99613
|
-
"w:trPr": translator$
|
|
99607
|
+
"w:tbl": translator$8,
|
|
99608
|
+
"w:tblBorders": translator$d,
|
|
99609
|
+
"w:tblCaption": translator$o,
|
|
99610
|
+
"w:tblCellMar": translator$c,
|
|
99611
|
+
"w:tblCellSpacing": translator$A,
|
|
99612
|
+
"w:tblDescription": translator$n,
|
|
99613
|
+
"w:tblGrid": translator$9,
|
|
99614
|
+
"w:tblHeader": translator$z,
|
|
99615
|
+
"w:tblInd": translator$m,
|
|
99616
|
+
"w:tblLayout": translator$l,
|
|
99617
|
+
"w:tblLook": translator$k,
|
|
99618
|
+
"w:tblOverlap": translator$j,
|
|
99619
|
+
"w:tblPr": translator$b,
|
|
99620
|
+
"w:tblStyle": translator$i,
|
|
99621
|
+
"w:tblStyleColBandSize": translator$h,
|
|
99622
|
+
"w:tblStyleRowBandSize": translator$g,
|
|
99623
|
+
"w:tblW": translator$f,
|
|
99624
|
+
"w:tblpPr": translator$e,
|
|
99625
|
+
"w:tc": translator$H,
|
|
99626
|
+
"w:top": translator$V,
|
|
99627
|
+
"w:tr": translator$u,
|
|
99628
|
+
"w:trHeight": translator$y,
|
|
99629
|
+
"w:trPr": translator$v,
|
|
99614
99630
|
"w:u": translator$1l,
|
|
99615
|
-
"w:wAfter": translator$
|
|
99616
|
-
"w:wBefore": translator
|
|
99617
|
-
"wp:anchor": translator$
|
|
99618
|
-
"wp:inline": translator$
|
|
99631
|
+
"w:wAfter": translator$x,
|
|
99632
|
+
"w:wBefore": translator$w,
|
|
99633
|
+
"wp:anchor": translator$t,
|
|
99634
|
+
"wp:inline": translator$s,
|
|
99619
99635
|
"w:commentRangeStart": commentRangeStartTranslator,
|
|
99620
99636
|
"w:commentRangeEnd": commentRangeEndTranslator,
|
|
99621
|
-
"w:vMerge": translator$
|
|
99622
|
-
"w:gridSpan": translator$
|
|
99623
|
-
"w:vAlign": translator$
|
|
99624
|
-
"w:noWrap": translator$
|
|
99625
|
-
"w:tcFitText": translator$
|
|
99626
|
-
"w:tcW": translator$
|
|
99627
|
-
"w:hideMark": translator$
|
|
99628
|
-
"w:textDirection": translator$
|
|
99629
|
-
"w:tl2br": translator$
|
|
99630
|
-
"w:tr2bl": translator$
|
|
99631
|
-
"w:header": translator$
|
|
99632
|
-
"w:headers": translator$
|
|
99633
|
-
"w:tcBorders": translator$
|
|
99634
|
-
"w:tcMar": translator$
|
|
99635
|
-
"w:tcPr": translator$
|
|
99637
|
+
"w:vMerge": translator$16,
|
|
99638
|
+
"w:gridSpan": translator$17,
|
|
99639
|
+
"w:vAlign": translator$M,
|
|
99640
|
+
"w:noWrap": translator$Q,
|
|
99641
|
+
"w:tcFitText": translator$N,
|
|
99642
|
+
"w:tcW": translator$18,
|
|
99643
|
+
"w:hideMark": translator$L,
|
|
99644
|
+
"w:textDirection": translator$O,
|
|
99645
|
+
"w:tl2br": translator$T,
|
|
99646
|
+
"w:tr2bl": translator$S,
|
|
99647
|
+
"w:header": translator$K,
|
|
99648
|
+
"w:headers": translator$J,
|
|
99649
|
+
"w:tcBorders": translator$R,
|
|
99650
|
+
"w:tcMar": translator$P,
|
|
99651
|
+
"w:tcPr": translator$I
|
|
99636
99652
|
});
|
|
99637
99653
|
const baseHandlers = {
|
|
99638
99654
|
...runPropertyTranslators,
|
|
@@ -100157,39 +100173,37 @@ ${style2}
|
|
|
100157
100173
|
}
|
|
100158
100174
|
var eventemitter3Exports = requireEventemitter3();
|
|
100159
100175
|
const EventEmitter = /* @__PURE__ */ getDefaultExportFromCjs(eventemitter3Exports);
|
|
100160
|
-
|
|
100161
|
-
|
|
100176
|
+
let getRandomValues;
|
|
100177
|
+
const rnds8 = new Uint8Array(16);
|
|
100162
100178
|
function rng() {
|
|
100163
100179
|
if (!getRandomValues) {
|
|
100164
|
-
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)
|
|
100180
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
100165
100181
|
if (!getRandomValues) {
|
|
100166
100182
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
100167
100183
|
}
|
|
100168
100184
|
}
|
|
100169
100185
|
return getRandomValues(rnds8);
|
|
100170
100186
|
}
|
|
100171
|
-
const
|
|
100172
|
-
|
|
100173
|
-
|
|
100187
|
+
const byteToHex = [];
|
|
100188
|
+
for (let i2 = 0; i2 < 256; ++i2) {
|
|
100189
|
+
byteToHex.push((i2 + 256).toString(16).slice(1));
|
|
100174
100190
|
}
|
|
100175
|
-
|
|
100176
|
-
|
|
100177
|
-
byteToHex.push((i + 256).toString(16).substr(1));
|
|
100178
|
-
}
|
|
100179
|
-
function stringify(arr) {
|
|
100180
|
-
var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
100181
|
-
var uuid = (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
|
|
100182
|
-
if (!validate(uuid)) {
|
|
100183
|
-
throw TypeError("Stringified UUID is invalid");
|
|
100184
|
-
}
|
|
100185
|
-
return uuid;
|
|
100191
|
+
function unsafeStringify(arr, offset2 = 0) {
|
|
100192
|
+
return byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]];
|
|
100186
100193
|
}
|
|
100194
|
+
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
100195
|
+
const native = {
|
|
100196
|
+
randomUUID
|
|
100197
|
+
};
|
|
100187
100198
|
function v4(options, buf, offset2) {
|
|
100199
|
+
if (native.randomUUID && true && !options) {
|
|
100200
|
+
return native.randomUUID();
|
|
100201
|
+
}
|
|
100188
100202
|
options = options || {};
|
|
100189
|
-
|
|
100203
|
+
const rnds = options.random || (options.rng || rng)();
|
|
100190
100204
|
rnds[6] = rnds[6] & 15 | 64;
|
|
100191
100205
|
rnds[8] = rnds[8] & 63 | 128;
|
|
100192
|
-
return
|
|
100206
|
+
return unsafeStringify(rnds);
|
|
100193
100207
|
}
|
|
100194
100208
|
let activePinia;
|
|
100195
100209
|
const setActivePinia = (pinia) => activePinia = pinia;
|
|
@@ -102153,6 +102167,7 @@ ${reason}`);
|
|
|
102153
102167
|
const isFocused = ref$1(params2.isFocused || false);
|
|
102154
102168
|
const creatorEmail = params2.creatorEmail;
|
|
102155
102169
|
const creatorName = params2.creatorName;
|
|
102170
|
+
const creatorImage = params2.creatorImage;
|
|
102156
102171
|
const createdTime = params2.createdTime || Date.now();
|
|
102157
102172
|
const importedAuthor = ref$1(params2.importedAuthor || null);
|
|
102158
102173
|
const commentText = ref$1(params2.commentText || "");
|
|
@@ -102245,7 +102260,7 @@ ${reason}`);
|
|
|
102245
102260
|
selection.selectionBounds = newCoords;
|
|
102246
102261
|
};
|
|
102247
102262
|
const getCommentUser = () => {
|
|
102248
|
-
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail };
|
|
102263
|
+
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
102249
102264
|
return user;
|
|
102250
102265
|
};
|
|
102251
102266
|
const propagateUpdate = (superdoc2, event) => {
|
|
@@ -102266,6 +102281,7 @@ ${reason}`);
|
|
|
102266
102281
|
createdAtVersionNumber,
|
|
102267
102282
|
creatorEmail,
|
|
102268
102283
|
creatorName,
|
|
102284
|
+
creatorImage,
|
|
102269
102285
|
createdTime,
|
|
102270
102286
|
importedAuthor: importedAuthor.value,
|
|
102271
102287
|
isInternal: isInternal.value,
|
|
@@ -102292,6 +102308,7 @@ ${reason}`);
|
|
|
102292
102308
|
isFocused,
|
|
102293
102309
|
creatorEmail,
|
|
102294
102310
|
creatorName,
|
|
102311
|
+
creatorImage,
|
|
102295
102312
|
createdTime,
|
|
102296
102313
|
isInternal,
|
|
102297
102314
|
commentText,
|
|
@@ -102688,6 +102705,7 @@ ${reason}`);
|
|
|
102688
102705
|
trackedChangeType,
|
|
102689
102706
|
deletedText,
|
|
102690
102707
|
authorEmail,
|
|
102708
|
+
authorImage,
|
|
102691
102709
|
date,
|
|
102692
102710
|
author: authorName,
|
|
102693
102711
|
importedAuthor,
|
|
@@ -102704,6 +102722,7 @@ ${reason}`);
|
|
|
102704
102722
|
createdTime: date,
|
|
102705
102723
|
creatorName: authorName,
|
|
102706
102724
|
creatorEmail: authorEmail,
|
|
102725
|
+
creatorImage: authorImage,
|
|
102707
102726
|
isInternal: false,
|
|
102708
102727
|
importedAuthor,
|
|
102709
102728
|
selection: {
|
|
@@ -102813,6 +102832,7 @@ ${reason}`);
|
|
|
102813
102832
|
parentCommentId,
|
|
102814
102833
|
creatorEmail: superdocStore.user.email,
|
|
102815
102834
|
creatorName: superdocStore.user.name,
|
|
102835
|
+
creatorImage: superdocStore.user.image,
|
|
102816
102836
|
commentText: currentCommentText.value,
|
|
102817
102837
|
selection,
|
|
102818
102838
|
...options
|