@yudaocode/univer-docs 1.6.210 → 1.6.211
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/WORD_TEMPLATE_PROTOCOL.md +176 -0
- package/fixtures/word-template-protocol-v1.json +9135 -0
- package/lib/cjs/index.js +737 -134
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +745 -144
- package/lib/es/index.js.map +1 -1
- package/lib/types/index.d.ts +51 -7
- package/package.json +5 -2
package/lib/es/index.js
CHANGED
|
@@ -10096,17 +10096,19 @@ function serializeSpanToRunsAndSdtXml(body, spanStart, spanEndExclusive, exportC
|
|
|
10096
10096
|
const sdtSliceRaw = stream.slice(sdtAtCursor.startIndex, sdtAtCursor.endIndex + 1);
|
|
10097
10097
|
const rawTs = findStyleAtBody(body, sdtAtCursor.startIndex);
|
|
10098
10098
|
let sdtRunStyle = rawTs;
|
|
10099
|
-
if (resolved && !resolved.matchedHighlight) {
|
|
10099
|
+
if (resolved && !resolved.matchedHighlight && !resolved.invalidHighlight) {
|
|
10100
10100
|
if (resolved.visualChrome === "underline") {
|
|
10101
10101
|
sdtRunStyle = {
|
|
10102
10102
|
...rawTs ?? {},
|
|
10103
10103
|
bg: void 0,
|
|
10104
10104
|
ul: rawTs?.ul?.s ? rawTs.ul : { s: 1 }
|
|
10105
10105
|
};
|
|
10106
|
-
} else if (resolved.visualChrome === "brackets" || resolved.visualChrome === "clean") {
|
|
10106
|
+
} else if (resolved.visualChrome === "brackets" || resolved.visualChrome === "clean" || !resolved.showingPlaceholder && resolved.visualChrome !== "highlight") {
|
|
10107
|
+
const rawBgLower = rawTs?.bg?.rgb?.trim().toLowerCase();
|
|
10108
|
+
const isEditorChromeBg = rawBgLower === "#f3f5ff" || rawBgLower === "#eeeff1" || rawBgLower === "#eff6ff";
|
|
10107
10109
|
sdtRunStyle = {
|
|
10108
10110
|
...rawTs ?? {},
|
|
10109
|
-
bg: void 0,
|
|
10111
|
+
bg: resolved.visualChrome === "brackets" || resolved.visualChrome === "clean" || isEditorChromeBg ? void 0 : rawTs?.bg,
|
|
10110
10112
|
ul: resolved.visualChrome === "clean" ? void 0 : rawTs?.ul
|
|
10111
10113
|
};
|
|
10112
10114
|
}
|
|
@@ -11116,7 +11118,7 @@ ${commentsItemsXml}
|
|
|
11116
11118
|
const liveSdtControls = listDocSdtControls(snapshot);
|
|
11117
11119
|
const serializedSdtExtendedSpecs = {};
|
|
11118
11120
|
for (const ctrl of liveSdtControls) {
|
|
11119
|
-
if (ctrl.kind === "cascader" || ctrl.kind === "checkbox" || ctrl.kind === "radio" || ctrl.kind === "multiSelect" || ctrl.kind === "number" || ctrl.kind === "dateRange" || ctrl.kind === "picture" || ctrl.kind === "group" || ctrl.kind === "signature" || ctrl.segmentId || ctrl.conceptId || ctrl.deletable !== void 0 || ctrl.cascaderOptions?.length || ctrl.cascaderSeparator !== void 0 || ctrl.preText !== void 0 || ctrl.postText !== void 0 || ctrl.minWidthPt !== void 0 || ctrl.underlineBlank !== void 0 || ctrl.pasteDisabled !== void 0 || ctrl.hint !== void 0 || ctrl.calculatorEnabled !== void 0 || ctrl.checkboxMarkType !== void 0 || ctrl.layoutDirection !== void 0 || ctrl.options?.length) {
|
|
11121
|
+
if (ctrl.kind === "cascader" || ctrl.kind === "checkbox" || ctrl.kind === "radio" || ctrl.kind === "multiSelect" || ctrl.kind === "number" || ctrl.kind === "dateRange" || ctrl.kind === "picture" || ctrl.kind === "group" || ctrl.kind === "signature" || ctrl.segmentId || ctrl.conceptId || ctrl.deletable !== void 0 || ctrl.cascaderOptions?.length || ctrl.cascaderSeparator !== void 0 || ctrl.visualChrome !== void 0 || ctrl.prefix !== void 0 || ctrl.postfix !== void 0 || ctrl.preText !== void 0 || ctrl.postText !== void 0 || ctrl.minWidthPt !== void 0 || ctrl.underlineBlank !== void 0 || ctrl.pasteDisabled !== void 0 || ctrl.hint !== void 0 || ctrl.calculatorEnabled !== void 0 || ctrl.checkboxMarkType !== void 0 || ctrl.layoutDirection !== void 0 || ctrl.options?.length) {
|
|
11120
11122
|
serializedSdtExtendedSpecs[ctrl.id] = {
|
|
11121
11123
|
id: ctrl.id,
|
|
11122
11124
|
tag: ctrl.tag,
|
|
@@ -11129,6 +11131,9 @@ ${commentsItemsXml}
|
|
|
11129
11131
|
...ctrl.options?.length ? { options: ctrl.options } : {},
|
|
11130
11132
|
...ctrl.checkboxMarkType ? { checkboxMarkType: ctrl.checkboxMarkType } : {},
|
|
11131
11133
|
...ctrl.layoutDirection ? { layoutDirection: ctrl.layoutDirection } : {},
|
|
11134
|
+
...ctrl.visualChrome ? { visualChrome: ctrl.visualChrome } : {},
|
|
11135
|
+
...ctrl.prefix !== void 0 ? { prefix: ctrl.prefix } : {},
|
|
11136
|
+
...ctrl.postfix !== void 0 ? { postfix: ctrl.postfix } : {},
|
|
11132
11137
|
...ctrl.preText !== void 0 ? { preText: ctrl.preText } : {},
|
|
11133
11138
|
...ctrl.postText !== void 0 ? { postText: ctrl.postText } : {},
|
|
11134
11139
|
...ctrl.minWidthPt !== void 0 ? { minWidthPt: ctrl.minWidthPt } : {},
|
|
@@ -11163,7 +11168,7 @@ ${commentsItemsXml}
|
|
|
11163
11168
|
levels: def?.levels
|
|
11164
11169
|
});
|
|
11165
11170
|
}
|
|
11166
|
-
if (templateMeta.medicalFormulas && Object.keys(templateMeta.medicalFormulas).length > 0 || templateMeta.barcodeBlocks && Object.keys(templateMeta.barcodeBlocks).length > 0 || Boolean(templateMeta.codeBlocks?.length) || Boolean(templateMeta.activeRole) || liveCallouts.length > 0 || liveQuotes.length > 0 || liveBookmarks.length > 0 || Boolean(serializedLatexMap && Object.keys(serializedLatexMap).length > 0) || Boolean(serializedChartMap && Object.keys(serializedChartMap).length > 0) || Boolean(serializedShapeMap && Object.keys(serializedShapeMap).length > 0) || Boolean(serializedSmartArtMap && Object.keys(serializedSmartArtMap).length > 0) || Boolean(serializedInlineFmlMap && Object.keys(serializedInlineFmlMap).length > 0) || Boolean(serializedFieldsMap && Object.keys(serializedFieldsMap).length > 0) || Boolean(templateMeta.tableRepeatHeaders && Object.keys(templateMeta.tableRepeatHeaders).length > 0) || Boolean(templateMeta.repeatingSections && Object.keys(templateMeta.repeatingSections).length > 0) || Boolean(templateMeta.tocConfig) || Boolean(templateMeta.imageTransforms && Object.keys(templateMeta.imageTransforms).length > 0) || Boolean(templateMeta.printConfig && Object.keys(templateMeta.printConfig).length > 0) || Boolean(templateMeta.columnGroupConfig) || liveCaptions.length > 0 || liveCitations.length > 0 || Boolean(templateMeta.buildingBlocks?.length) || liveAreas.length > 0 || Boolean(liveMainBadge) || Boolean(serializedLabelBadgesMap && Object.keys(serializedLabelBadgesMap).length > 0) || Boolean(templateMeta.cascadeRules?.length) || Boolean(templateMeta.cascadeBaselines && Object.keys(templateMeta.cascadeBaselines).length > 0) || Boolean(serializedStyledSepsMap && Object.keys(serializedStyledSepsMap).length > 0) || Boolean(serializedEmbedBlocksMap && Object.keys(serializedEmbedBlocksMap).length > 0) || Boolean(templateMeta.macros && Object.keys(templateMeta.macros).length > 0) || Boolean(templateMeta.graffitiStrokes?.length) || Boolean(templateMeta.noteSettings) || Boolean(templateMeta.company) || Boolean(templateMeta.customProperties && Object.keys(templateMeta.customProperties).length > 0) || Boolean(templateMeta.copyPastePolicy) || Boolean(templateMeta.sectionOrientations && Object.keys(templateMeta.sectionOrientations).length > 0) || Boolean(templateMeta.paragraphDirections && Object.keys(templateMeta.paragraphDirections).length > 0) || Boolean(templateMeta.tableDirections && Object.keys(templateMeta.tableDirections).length > 0) || Boolean(templateMeta.tableBorderPresets && Object.keys(templateMeta.tableBorderPresets).length > 0) || Boolean(templateMeta.tableCellProperties && Object.keys(templateMeta.tableCellProperties).length > 0) || Boolean(templateMeta.listDefinitions && Object.keys(templateMeta.listDefinitions).length > 0) || Boolean(templateMeta.listParagraphChecks && Object.keys(templateMeta.listParagraphChecks).length > 0) || liveComments.length > 0 || Boolean(templateMeta.titleProperties && Object.keys(templateMeta.titleProperties).length > 0) || Object.keys(serializedSdtExtendedSpecs).length > 0) {
|
|
11171
|
+
if (templateMeta.medicalFormulas && Object.keys(templateMeta.medicalFormulas).length > 0 || templateMeta.barcodeBlocks && Object.keys(templateMeta.barcodeBlocks).length > 0 || Boolean(templateMeta.codeBlocks?.length) || Boolean(templateMeta.activeRole) || liveCallouts.length > 0 || liveQuotes.length > 0 || liveBookmarks.length > 0 || Boolean(serializedLatexMap && Object.keys(serializedLatexMap).length > 0) || Boolean(serializedChartMap && Object.keys(serializedChartMap).length > 0) || Boolean(serializedShapeMap && Object.keys(serializedShapeMap).length > 0) || Boolean(serializedSmartArtMap && Object.keys(serializedSmartArtMap).length > 0) || Boolean(serializedInlineFmlMap && Object.keys(serializedInlineFmlMap).length > 0) || Boolean(serializedFieldsMap && Object.keys(serializedFieldsMap).length > 0) || Boolean(templateMeta.tableRowLoops && Object.keys(templateMeta.tableRowLoops).length > 0) || Boolean(templateMeta.tableRepeatHeaders && Object.keys(templateMeta.tableRepeatHeaders).length > 0) || Boolean(templateMeta.repeatingSections && Object.keys(templateMeta.repeatingSections).length > 0) || Boolean(templateMeta.tocConfig) || Boolean(templateMeta.imageTransforms && Object.keys(templateMeta.imageTransforms).length > 0) || Boolean(templateMeta.printConfig && Object.keys(templateMeta.printConfig).length > 0) || Boolean(templateMeta.columnGroupConfig) || liveCaptions.length > 0 || liveCitations.length > 0 || Boolean(templateMeta.buildingBlocks?.length) || liveAreas.length > 0 || Boolean(liveMainBadge) || Boolean(serializedLabelBadgesMap && Object.keys(serializedLabelBadgesMap).length > 0) || Boolean(templateMeta.cascadeRules?.length) || Boolean(templateMeta.cascadeBaselines && Object.keys(templateMeta.cascadeBaselines).length > 0) || Boolean(serializedStyledSepsMap && Object.keys(serializedStyledSepsMap).length > 0) || Boolean(serializedEmbedBlocksMap && Object.keys(serializedEmbedBlocksMap).length > 0) || Boolean(templateMeta.macros && Object.keys(templateMeta.macros).length > 0) || Boolean(templateMeta.graffitiStrokes?.length) || Boolean(templateMeta.noteSettings) || Boolean(templateMeta.company) || Boolean(templateMeta.customProperties && Object.keys(templateMeta.customProperties).length > 0) || Boolean(templateMeta.copyPastePolicy) || Boolean(templateMeta.sectionOrientations && Object.keys(templateMeta.sectionOrientations).length > 0) || Boolean(templateMeta.paragraphDirections && Object.keys(templateMeta.paragraphDirections).length > 0) || Boolean(templateMeta.tableDirections && Object.keys(templateMeta.tableDirections).length > 0) || Boolean(templateMeta.tableBorderPresets && Object.keys(templateMeta.tableBorderPresets).length > 0) || Boolean(templateMeta.tableCellProperties && Object.keys(templateMeta.tableCellProperties).length > 0) || Boolean(templateMeta.listDefinitions && Object.keys(templateMeta.listDefinitions).length > 0) || Boolean(templateMeta.listParagraphChecks && Object.keys(templateMeta.listParagraphChecks).length > 0) || liveComments.length > 0 || Boolean(templateMeta.titleProperties && Object.keys(templateMeta.titleProperties).length > 0) || Object.keys(serializedSdtExtendedSpecs).length > 0) {
|
|
11167
11172
|
extraZipFiles.push({
|
|
11168
11173
|
name: "docProps/yudao-meta.json",
|
|
11169
11174
|
content: JSON.stringify({
|
|
@@ -11189,6 +11194,7 @@ ${commentsItemsXml}
|
|
|
11189
11194
|
imageTransforms: templateMeta.imageTransforms,
|
|
11190
11195
|
printConfig: templateMeta.printConfig,
|
|
11191
11196
|
columnGroupConfig: templateMeta.columnGroupConfig,
|
|
11197
|
+
tableRowLoops: templateMeta.tableRowLoops,
|
|
11192
11198
|
tableRepeatHeaders: templateMeta.tableRepeatHeaders,
|
|
11193
11199
|
repeatingSections: templateMeta.repeatingSections,
|
|
11194
11200
|
tocConfig: templateMeta.tocConfig,
|
|
@@ -14175,6 +14181,9 @@ async function parseDocxBytesWithReport(bytes, title = "Imported Word Document")
|
|
|
14175
14181
|
...hit.options ? { options: hit.options } : {},
|
|
14176
14182
|
...hit.checkboxMarkType ? { checkboxMarkType: hit.checkboxMarkType } : {},
|
|
14177
14183
|
...hit.layoutDirection ? { layoutDirection: hit.layoutDirection } : {},
|
|
14184
|
+
...hit.visualChrome ? { visualChrome: hit.visualChrome } : {},
|
|
14185
|
+
...hit.prefix !== void 0 ? { prefix: hit.prefix } : {},
|
|
14186
|
+
...hit.postfix !== void 0 ? { postfix: hit.postfix } : {},
|
|
14178
14187
|
...hit.preText !== void 0 ? { preText: hit.preText } : {},
|
|
14179
14188
|
...hit.postText !== void 0 ? { postText: hit.postText } : {},
|
|
14180
14189
|
...hit.minWidthPt !== void 0 ? { minWidthPt: hit.minWidthPt } : {},
|
|
@@ -14233,6 +14242,44 @@ async function parseDocxBytesWithReport(bytes, title = "Imported Word Document")
|
|
|
14233
14242
|
oldToNewTblId.set(oldId, liveTables[idx].tableId);
|
|
14234
14243
|
}
|
|
14235
14244
|
});
|
|
14245
|
+
const remappedRowLoops = {
|
|
14246
|
+
...curMeta.tableRowLoops ?? {}
|
|
14247
|
+
};
|
|
14248
|
+
if (extraMeta.tableRowLoops && typeof extraMeta.tableRowLoops === "object") {
|
|
14249
|
+
for (const [k, cfg] of Object.entries(
|
|
14250
|
+
extraMeta.tableRowLoops
|
|
14251
|
+
)) {
|
|
14252
|
+
if (!cfg || typeof cfg !== "object") continue;
|
|
14253
|
+
const colonIdx = k.lastIndexOf(":");
|
|
14254
|
+
const rawTblId = cfg.tableId || (colonIdx > 0 ? k.slice(0, colonIdx) : k);
|
|
14255
|
+
const rawRowIdx = typeof cfg.rowIndex === "number" ? cfg.rowIndex : colonIdx > 0 ? Number(k.slice(colonIdx + 1)) : 0;
|
|
14256
|
+
const mappedTblId = oldToNewTblId.get(rawTblId) ?? (liveTables.length === 1 ? liveTables[0].tableId : rawTblId);
|
|
14257
|
+
const mappedKey = `${mappedTblId}:${rawRowIdx}`;
|
|
14258
|
+
remappedRowLoops[mappedKey] = {
|
|
14259
|
+
...cfg,
|
|
14260
|
+
tableId: mappedTblId,
|
|
14261
|
+
rowIndex: rawRowIdx
|
|
14262
|
+
};
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
const remappedRepeatHeaders = {
|
|
14266
|
+
...curMeta.tableRepeatHeaders ?? {}
|
|
14267
|
+
};
|
|
14268
|
+
if (extraMeta.tableRepeatHeaders && typeof extraMeta.tableRepeatHeaders === "object") {
|
|
14269
|
+
for (const [oldTblId, hdrCount] of Object.entries(
|
|
14270
|
+
extraMeta.tableRepeatHeaders
|
|
14271
|
+
)) {
|
|
14272
|
+
if (typeof hdrCount !== "number") continue;
|
|
14273
|
+
const mappedTblId = oldToNewTblId.get(oldTblId) ?? (liveTables.length === 1 ? liveTables[0].tableId : oldTblId);
|
|
14274
|
+
remappedRepeatHeaders[mappedTblId] = hdrCount;
|
|
14275
|
+
const rows = docData.tableSource?.[mappedTblId]?.tableRows;
|
|
14276
|
+
if (rows) {
|
|
14277
|
+
rows.forEach((r, idx) => {
|
|
14278
|
+
r.repeatHeaderRow = idx < hdrCount ? BooleanNumber2.TRUE : BooleanNumber2.FALSE;
|
|
14279
|
+
});
|
|
14280
|
+
}
|
|
14281
|
+
}
|
|
14282
|
+
}
|
|
14236
14283
|
const remappedCellProps = {
|
|
14237
14284
|
...curMeta.tableCellProperties ?? {}
|
|
14238
14285
|
};
|
|
@@ -14317,6 +14364,8 @@ async function parseDocxBytesWithReport(bytes, title = "Imported Word Document")
|
|
|
14317
14364
|
...extraMeta.imageTransforms ? { imageTransforms: { ...curMeta.imageTransforms ?? {}, ...extraMeta.imageTransforms } } : {},
|
|
14318
14365
|
...extraMeta.printConfig ? { printConfig: { ...curMeta.printConfig ?? {}, ...extraMeta.printConfig } } : {},
|
|
14319
14366
|
...extraMeta.columnGroupConfig ? { columnGroupConfig: extraMeta.columnGroupConfig } : {},
|
|
14367
|
+
...Object.keys(remappedRowLoops).length > 0 ? { tableRowLoops: remappedRowLoops } : {},
|
|
14368
|
+
...Object.keys(remappedRepeatHeaders).length > 0 ? { tableRepeatHeaders: remappedRepeatHeaders } : {},
|
|
14320
14369
|
...extraMeta.repeatingSections ? { repeatingSections: extraMeta.repeatingSections } : {},
|
|
14321
14370
|
...extraMeta.tocConfig ? { tocConfig: extraMeta.tocConfig } : {},
|
|
14322
14371
|
...Array.isArray(extraMeta.docAreas) ? { docAreas: extraMeta.docAreas } : {},
|
|
@@ -21071,7 +21120,8 @@ var YUDAO_SDT_STORE_ID = "yudao-dataset-store";
|
|
|
21071
21120
|
var IDENT_PART = "[\\p{L}\\p{N}_-]+";
|
|
21072
21121
|
var PATH_PART = "[\\p{L}\\p{N}_.\\[\\]-]+";
|
|
21073
21122
|
var EXPLICIT_LIST_TOKEN_RE = new RegExp(`(?:\\$|#)\\{#(${IDENT_PART})\\.(${PATH_PART})\\}`, "gu");
|
|
21074
|
-
var
|
|
21123
|
+
var EXPLICIT_NESTED_LIST_TOKEN_RE = new RegExp(`(?:\\$|#)\\{#(${PATH_PART})\\}`, "gu");
|
|
21124
|
+
var ANY_CELL_TOKEN_RE = new RegExp(`(?:\\$|#)\\{(#?)(${PATH_PART})\\}`, "gu");
|
|
21075
21125
|
var INLINE_VALUE_TOKEN_RE = new RegExp(`(?:\\$|#)\\{(${PATH_PART})\\}`, "gu");
|
|
21076
21126
|
function resolvePathValue(source, path) {
|
|
21077
21127
|
if (!source || !path) return void 0;
|
|
@@ -21197,7 +21247,56 @@ function stripSdtAffixes(rawText, spec) {
|
|
|
21197
21247
|
}
|
|
21198
21248
|
return text;
|
|
21199
21249
|
}
|
|
21200
|
-
var SDT_CHROME_TEXT_COLORS = /* @__PURE__ */ new Set(["#7d8698", "#4e5565", "#2c53f1", "#1b1c1f"]);
|
|
21250
|
+
var SDT_CHROME_TEXT_COLORS = /* @__PURE__ */ new Set(["#7d8698", "#9ca3af", "#4e5565", "#2c53f1", "#1b1c1f"]);
|
|
21251
|
+
var SDT_CHROME_BG_COLORS = /* @__PURE__ */ new Set(["#f3f5ff", "#eeeff1", "#eff6ff"]);
|
|
21252
|
+
function sanitizeLoopCellRunStyle(ts, anchorTypo) {
|
|
21253
|
+
if (!ts && !anchorTypo) return void 0;
|
|
21254
|
+
const out = {
|
|
21255
|
+
...ts ? Tools10.deepClone(ts) : {},
|
|
21256
|
+
...anchorTypo ? Tools10.deepClone(anchorTypo) : {}
|
|
21257
|
+
};
|
|
21258
|
+
const bgRgb = out.bg?.rgb?.trim().toLowerCase();
|
|
21259
|
+
if (bgRgb && SDT_CHROME_BG_COLORS.has(bgRgb)) {
|
|
21260
|
+
delete out.bg;
|
|
21261
|
+
}
|
|
21262
|
+
const clRgb = out.cl?.rgb?.trim().toLowerCase();
|
|
21263
|
+
if (clRgb && !anchorTypo?.cl?.rgb && SDT_CHROME_TEXT_COLORS.has(clRgb) && clRgb !== "#1b1c1f") {
|
|
21264
|
+
delete out.cl;
|
|
21265
|
+
}
|
|
21266
|
+
if (out.bl === 0 && anchorTypo?.bl === void 0 && (!ts || ts.bl === 0)) {
|
|
21267
|
+
delete out.bl;
|
|
21268
|
+
}
|
|
21269
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
21270
|
+
}
|
|
21271
|
+
function stripDocEditorChromeForView(snapshot) {
|
|
21272
|
+
const cloned = Tools10.deepClone(snapshot);
|
|
21273
|
+
const cleanBody = (body) => {
|
|
21274
|
+
if (!body?.customRanges?.length || !body.textRuns?.length) return;
|
|
21275
|
+
for (const r of body.customRanges) {
|
|
21276
|
+
if (r.rangeType !== CustomRangeType11.SDT) continue;
|
|
21277
|
+
const resolved = parseSdtRangeToResolved(body, r);
|
|
21278
|
+
if (!resolved || resolved.showingPlaceholder || resolved.matchedHighlight || resolved.invalidHighlight) {
|
|
21279
|
+
continue;
|
|
21280
|
+
}
|
|
21281
|
+
if (resolved.visualChrome === "highlight") continue;
|
|
21282
|
+
for (const tr of body.textRuns) {
|
|
21283
|
+
if (tr.ed <= r.startIndex || tr.st > r.endIndex || !tr.ts) continue;
|
|
21284
|
+
const bgRgb = tr.ts.bg?.rgb?.trim().toLowerCase();
|
|
21285
|
+
if (bgRgb && SDT_CHROME_BG_COLORS.has(bgRgb)) {
|
|
21286
|
+
delete tr.ts.bg;
|
|
21287
|
+
}
|
|
21288
|
+
const clRgb = tr.ts.cl?.rgb?.trim().toLowerCase();
|
|
21289
|
+
if (clRgb === "#7d8698" || clRgb === "#9ca3af") {
|
|
21290
|
+
tr.ts.cl = { rgb: "#1b1c1f" };
|
|
21291
|
+
}
|
|
21292
|
+
}
|
|
21293
|
+
}
|
|
21294
|
+
};
|
|
21295
|
+
cleanBody(cloned.body);
|
|
21296
|
+
for (const h of Object.values(cloned.headers ?? {})) cleanBody(h?.body);
|
|
21297
|
+
for (const f of Object.values(cloned.footers ?? {})) cleanBody(f?.body);
|
|
21298
|
+
return cloned;
|
|
21299
|
+
}
|
|
21201
21300
|
function extractAnchorTypography(ts) {
|
|
21202
21301
|
if (!ts) return void 0;
|
|
21203
21302
|
const out = {};
|
|
@@ -22601,21 +22700,178 @@ function listDocTables(snapshot) {
|
|
|
22601
22700
|
};
|
|
22602
22701
|
});
|
|
22603
22702
|
}
|
|
22604
|
-
function
|
|
22605
|
-
|
|
22606
|
-
|
|
22703
|
+
function resolveCandidateListPrefix(expr, data, fallbackFirstSegment) {
|
|
22704
|
+
const clean = expr.replace(/^#/, "");
|
|
22705
|
+
const dotPositions = [];
|
|
22706
|
+
for (let i = clean.length - 1; i > 0; i--) {
|
|
22707
|
+
if (clean[i] === ".") dotPositions.push(i);
|
|
22708
|
+
}
|
|
22709
|
+
if (dotPositions.length === 0) return "";
|
|
22710
|
+
for (const pos of dotPositions) {
|
|
22711
|
+
const cand = clean.slice(0, pos);
|
|
22712
|
+
const val = resolvePathValue(data, cand) ?? data?.[cand];
|
|
22713
|
+
if (Array.isArray(val)) return cand;
|
|
22714
|
+
}
|
|
22715
|
+
if (fallbackFirstSegment) {
|
|
22716
|
+
for (const pos of dotPositions) {
|
|
22717
|
+
const cand = clean.slice(0, pos);
|
|
22718
|
+
const val = resolvePathValue(data, cand);
|
|
22719
|
+
if (val === null || val === void 0 && Object.prototype.hasOwnProperty.call(data, cand)) {
|
|
22720
|
+
return cand;
|
|
22721
|
+
}
|
|
22722
|
+
const dotInCand = cand.lastIndexOf(".");
|
|
22723
|
+
if (dotInCand > 0) {
|
|
22724
|
+
const parentObj = resolvePathValue(data, cand.slice(0, dotInCand));
|
|
22725
|
+
const leafKey = cand.slice(dotInCand + 1);
|
|
22726
|
+
if (parentObj && typeof parentObj === "object" && Object.prototype.hasOwnProperty.call(parentObj, leafKey) && !(typeof parentObj[leafKey] === "object" && parentObj[leafKey] !== null && !Array.isArray(parentObj[leafKey]))) {
|
|
22727
|
+
return cand;
|
|
22728
|
+
}
|
|
22729
|
+
}
|
|
22730
|
+
}
|
|
22731
|
+
return clean.slice(0, dotPositions[dotPositions.length - 1]);
|
|
22732
|
+
}
|
|
22733
|
+
return "";
|
|
22734
|
+
}
|
|
22735
|
+
function replaceRowCellTokens(rawCellText, listKey, itemObj, rowSeqIndex, rootData, hasExplicitListKey = false) {
|
|
22736
|
+
return rawCellText.replace(ANY_CELL_TOKEN_RE, (full, hashPrefix, expr) => {
|
|
22737
|
+
const cleanExpr = expr.trim();
|
|
22738
|
+
if (cleanExpr === `${listKey}._index`) {
|
|
22739
|
+
return itemObj ? String(rowSeqIndex + 1) : "";
|
|
22740
|
+
}
|
|
22741
|
+
if (cleanExpr.startsWith(`${listKey}.`)) {
|
|
22607
22742
|
if (!itemObj) return "";
|
|
22743
|
+
const fieldPath = cleanExpr.slice(listKey.length + 1);
|
|
22608
22744
|
if (fieldPath === "_index") return String(rowSeqIndex + 1);
|
|
22609
22745
|
const val = resolvePathValue(itemObj, fieldPath);
|
|
22610
22746
|
return val == null ? "" : String(val);
|
|
22611
22747
|
}
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
return String(
|
|
22748
|
+
if (hasExplicitListKey) {
|
|
22749
|
+
if (!itemObj) return "";
|
|
22750
|
+
if (cleanExpr === "_index") return String(rowSeqIndex + 1);
|
|
22751
|
+
const itemVal = resolvePathValue(itemObj, cleanExpr);
|
|
22752
|
+
if (itemVal !== void 0) {
|
|
22753
|
+
return itemVal == null ? "" : String(itemVal);
|
|
22754
|
+
}
|
|
22755
|
+
const rootVal = resolvePathValue(rootData, cleanExpr);
|
|
22756
|
+
if (rootVal !== void 0 && rootVal !== null && typeof rootVal !== "object") {
|
|
22757
|
+
return String(rootVal);
|
|
22758
|
+
}
|
|
22759
|
+
return "";
|
|
22760
|
+
}
|
|
22761
|
+
if (!hashPrefix) {
|
|
22762
|
+
const rootVal = resolvePathValue(rootData, cleanExpr);
|
|
22763
|
+
if (rootVal !== void 0 && rootVal !== null && typeof rootVal !== "object") {
|
|
22764
|
+
return String(rootVal);
|
|
22765
|
+
}
|
|
22615
22766
|
}
|
|
22616
22767
|
return full;
|
|
22617
22768
|
});
|
|
22618
22769
|
}
|
|
22770
|
+
function renderLoopCellContent(body, cell, cellSdts, detectedListKey, itemObj, rowSeqIndex, rootData, hasExplicitListKey) {
|
|
22771
|
+
if (cellSdts.length === 0) {
|
|
22772
|
+
return replaceRowCellTokens(
|
|
22773
|
+
cell.rawText,
|
|
22774
|
+
detectedListKey,
|
|
22775
|
+
itemObj,
|
|
22776
|
+
rowSeqIndex,
|
|
22777
|
+
rootData,
|
|
22778
|
+
hasExplicitListKey
|
|
22779
|
+
);
|
|
22780
|
+
}
|
|
22781
|
+
let out = "";
|
|
22782
|
+
let cursor = cell.contentStart;
|
|
22783
|
+
for (const { range, resolved } of cellSdts) {
|
|
22784
|
+
if (range.startIndex < cursor) continue;
|
|
22785
|
+
if (range.startIndex > cursor) {
|
|
22786
|
+
const pre = body.dataStream.slice(cursor, range.startIndex);
|
|
22787
|
+
out += replaceRowCellTokens(
|
|
22788
|
+
pre,
|
|
22789
|
+
detectedListKey,
|
|
22790
|
+
itemObj,
|
|
22791
|
+
rowSeqIndex,
|
|
22792
|
+
rootData,
|
|
22793
|
+
hasExplicitListKey
|
|
22794
|
+
);
|
|
22795
|
+
}
|
|
22796
|
+
if (itemObj === null) {
|
|
22797
|
+
out += "";
|
|
22798
|
+
} else {
|
|
22799
|
+
const candidates = [resolved.bindingPath, resolved.tag].filter(
|
|
22800
|
+
(c) => typeof c === "string" && c.trim().length > 0
|
|
22801
|
+
);
|
|
22802
|
+
let matched = false;
|
|
22803
|
+
let rawVal = void 0;
|
|
22804
|
+
for (const rawCand of candidates) {
|
|
22805
|
+
const cand = rawCand.trim().replace(/^#/, "");
|
|
22806
|
+
if (cand === `${detectedListKey}._index`) {
|
|
22807
|
+
rawVal = String(rowSeqIndex + 1);
|
|
22808
|
+
matched = true;
|
|
22809
|
+
break;
|
|
22810
|
+
}
|
|
22811
|
+
if (cand.startsWith(`${detectedListKey}.`)) {
|
|
22812
|
+
const subPath = cand.slice(detectedListKey.length + 1);
|
|
22813
|
+
rawVal = subPath === "_index" ? String(rowSeqIndex + 1) : resolvePathValue(itemObj, subPath);
|
|
22814
|
+
matched = true;
|
|
22815
|
+
break;
|
|
22816
|
+
}
|
|
22817
|
+
}
|
|
22818
|
+
if (!matched) {
|
|
22819
|
+
for (const rawCand of candidates) {
|
|
22820
|
+
const cand = rawCand.trim().replace(/^#/, "");
|
|
22821
|
+
if (cand === "_index") {
|
|
22822
|
+
rawVal = String(rowSeqIndex + 1);
|
|
22823
|
+
matched = true;
|
|
22824
|
+
break;
|
|
22825
|
+
}
|
|
22826
|
+
const directItemVal = resolvePathValue(itemObj, cand);
|
|
22827
|
+
if (directItemVal !== void 0) {
|
|
22828
|
+
rawVal = directItemVal;
|
|
22829
|
+
matched = true;
|
|
22830
|
+
break;
|
|
22831
|
+
}
|
|
22832
|
+
}
|
|
22833
|
+
}
|
|
22834
|
+
if (!matched) {
|
|
22835
|
+
for (const rawCand of candidates) {
|
|
22836
|
+
const cand = rawCand.trim().replace(/^#/, "");
|
|
22837
|
+
const rootVal = resolvePathValue(rootData, cand);
|
|
22838
|
+
if (rootVal !== void 0 && rootVal !== null && typeof rootVal !== "object") {
|
|
22839
|
+
rawVal = rootVal;
|
|
22840
|
+
matched = true;
|
|
22841
|
+
break;
|
|
22842
|
+
}
|
|
22843
|
+
}
|
|
22844
|
+
}
|
|
22845
|
+
if (!matched && hasExplicitListKey) {
|
|
22846
|
+
rawVal = "";
|
|
22847
|
+
matched = true;
|
|
22848
|
+
}
|
|
22849
|
+
if (!matched) {
|
|
22850
|
+
out += resolved.showingPlaceholder ? "" : resolved.displayText;
|
|
22851
|
+
} else if (typeof rawVal === "boolean") {
|
|
22852
|
+
out += formatSdtDisplayText(resolved, rawVal).text;
|
|
22853
|
+
} else if (rawVal == null || String(rawVal) === "") {
|
|
22854
|
+
out += "";
|
|
22855
|
+
} else {
|
|
22856
|
+
const strVal = Array.isArray(rawVal) ? rawVal.join(",") : String(rawVal);
|
|
22857
|
+
out += formatSdtDisplayText(resolved, strVal).text;
|
|
22858
|
+
}
|
|
22859
|
+
}
|
|
22860
|
+
cursor = Math.min(cell.textEndExclusive, range.endIndex + 1);
|
|
22861
|
+
}
|
|
22862
|
+
if (cursor < cell.textEndExclusive) {
|
|
22863
|
+
const tail = body.dataStream.slice(cursor, cell.textEndExclusive);
|
|
22864
|
+
out += replaceRowCellTokens(
|
|
22865
|
+
tail,
|
|
22866
|
+
detectedListKey,
|
|
22867
|
+
itemObj,
|
|
22868
|
+
rowSeqIndex,
|
|
22869
|
+
rootData,
|
|
22870
|
+
hasExplicitListKey
|
|
22871
|
+
);
|
|
22872
|
+
}
|
|
22873
|
+
return out;
|
|
22874
|
+
}
|
|
22619
22875
|
function expandDocTableRowLoopsInPlace(nextSnapshot, data, explicitLoops) {
|
|
22620
22876
|
const body = nextSnapshot.body;
|
|
22621
22877
|
if (!body?.tables?.length) return;
|
|
@@ -22624,92 +22880,196 @@ function expandDocTableRowLoopsInPlace(nextSnapshot, data, explicitLoops) {
|
|
|
22624
22880
|
...snapMeta.tableRowLoops ?? {},
|
|
22625
22881
|
...explicitLoops ?? {}
|
|
22626
22882
|
};
|
|
22883
|
+
const consumedLoopKeys = /* @__PURE__ */ new Set();
|
|
22884
|
+
let metaChanged = false;
|
|
22627
22885
|
for (let tIdx = body.tables.length - 1; tIdx >= 0; tIdx--) {
|
|
22628
22886
|
const tblRef = body.tables[tIdx];
|
|
22629
22887
|
const parsedRows = parseTableRowsInStream(body.dataStream, tblRef.startIndex, tblRef.endIndex);
|
|
22630
22888
|
if (parsedRows.length === 0) continue;
|
|
22631
22889
|
const tblSource = nextSnapshot.tableSource?.[tblRef.tableId];
|
|
22890
|
+
let remainingRowCount = parsedRows.length;
|
|
22632
22891
|
for (let rIdx = parsedRows.length - 1; rIdx >= 0; rIdx--) {
|
|
22633
22892
|
const rowSpan = parsedRows[rIdx];
|
|
22634
|
-
const
|
|
22635
|
-
|
|
22893
|
+
const loopKey = `${tblRef.tableId}:${rIdx}`;
|
|
22894
|
+
const explicitCfg = loopMap[loopKey];
|
|
22895
|
+
const hasExplicitListKey = Boolean(explicitCfg?.listKey?.trim());
|
|
22896
|
+
const rowCellSdts = rowSpan.cells.map((cell) => {
|
|
22897
|
+
const hits = [];
|
|
22898
|
+
for (const r of body.customRanges ?? []) {
|
|
22899
|
+
if (r.rangeType === CustomRangeType11.SDT && r.startIndex >= cell.contentStart && r.endIndex < cell.textEndExclusive) {
|
|
22900
|
+
const parsed = parseSdtRangeToResolved(body, r);
|
|
22901
|
+
if (parsed && parsed.kind !== "group") {
|
|
22902
|
+
hits.push({ range: r, resolved: parsed });
|
|
22903
|
+
}
|
|
22904
|
+
}
|
|
22905
|
+
}
|
|
22906
|
+
return hits.sort((a, b) => a.range.startIndex - b.range.startIndex);
|
|
22907
|
+
});
|
|
22908
|
+
let detectedListKey = explicitCfg?.listKey?.trim() ?? "";
|
|
22636
22909
|
if (!detectedListKey) {
|
|
22637
22910
|
const joinedCells = rowSpan.cells.map((c) => c.rawText).join(" ");
|
|
22638
|
-
|
|
22639
|
-
const explicitMatch =
|
|
22640
|
-
if (explicitMatch) {
|
|
22641
|
-
detectedListKey = explicitMatch[1];
|
|
22642
|
-
}
|
|
22643
|
-
|
|
22911
|
+
EXPLICIT_NESTED_LIST_TOKEN_RE.lastIndex = 0;
|
|
22912
|
+
const explicitMatch = EXPLICIT_NESTED_LIST_TOKEN_RE.exec(joinedCells);
|
|
22913
|
+
if (explicitMatch && explicitMatch[1].includes(".")) {
|
|
22914
|
+
detectedListKey = resolveCandidateListPrefix(explicitMatch[1], data, true);
|
|
22915
|
+
}
|
|
22916
|
+
if (!detectedListKey) {
|
|
22917
|
+
ANY_CELL_TOKEN_RE.lastIndex = 0;
|
|
22644
22918
|
let tokMatch;
|
|
22645
|
-
while ((tokMatch =
|
|
22646
|
-
const
|
|
22647
|
-
if (
|
|
22648
|
-
|
|
22919
|
+
while ((tokMatch = ANY_CELL_TOKEN_RE.exec(joinedCells)) !== null) {
|
|
22920
|
+
const expr = tokMatch[2];
|
|
22921
|
+
if (!expr.includes(".")) continue;
|
|
22922
|
+
const cand = resolveCandidateListPrefix(expr, data, false);
|
|
22923
|
+
if (cand) {
|
|
22924
|
+
detectedListKey = cand;
|
|
22649
22925
|
break;
|
|
22650
22926
|
}
|
|
22651
22927
|
}
|
|
22652
22928
|
}
|
|
22929
|
+
if (!detectedListKey) {
|
|
22930
|
+
for (const cellSdts of rowCellSdts) {
|
|
22931
|
+
for (const { resolved } of cellSdts) {
|
|
22932
|
+
for (const rawCand of [resolved.bindingPath, resolved.tag]) {
|
|
22933
|
+
if (rawCand && rawCand.includes(".")) {
|
|
22934
|
+
const cand = resolveCandidateListPrefix(rawCand, data, false);
|
|
22935
|
+
if (cand) {
|
|
22936
|
+
detectedListKey = cand;
|
|
22937
|
+
break;
|
|
22938
|
+
}
|
|
22939
|
+
}
|
|
22940
|
+
}
|
|
22941
|
+
if (detectedListKey) break;
|
|
22942
|
+
}
|
|
22943
|
+
if (detectedListKey) break;
|
|
22944
|
+
}
|
|
22945
|
+
}
|
|
22653
22946
|
}
|
|
22654
22947
|
if (!detectedListKey) continue;
|
|
22655
|
-
|
|
22948
|
+
consumedLoopKeys.add(loopKey);
|
|
22949
|
+
const rawItems = resolvePathValue(data, detectedListKey) ?? data?.[detectedListKey];
|
|
22656
22950
|
const items = Array.isArray(rawItems) ? rawItems : [];
|
|
22657
22951
|
const emptyStrategy = explicitCfg?.emptyStrategy ?? "keep-blank";
|
|
22658
22952
|
const repeatHeader = explicitCfg?.repeatHeaderRow ?? true;
|
|
22659
|
-
if (
|
|
22660
|
-
tblSource
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22953
|
+
if (explicitCfg?.repeatHeaderRow === false) {
|
|
22954
|
+
if (tblSource?.tableRows) {
|
|
22955
|
+
const upper = Math.max(1, rIdx);
|
|
22956
|
+
for (let h = 0; h < upper && h < tblSource.tableRows.length; h++) {
|
|
22957
|
+
tblSource.tableRows[h] = {
|
|
22958
|
+
...tblSource.tableRows[h],
|
|
22959
|
+
repeatHeaderRow: BooleanNumber5.FALSE
|
|
22960
|
+
};
|
|
22961
|
+
}
|
|
22962
|
+
}
|
|
22963
|
+
if (snapMeta.tableRepeatHeaders && tblRef.tableId in snapMeta.tableRepeatHeaders) {
|
|
22964
|
+
delete snapMeta.tableRepeatHeaders[tblRef.tableId];
|
|
22965
|
+
metaChanged = true;
|
|
22966
|
+
}
|
|
22967
|
+
} else if (repeatHeader && rIdx > 0 && tblSource?.tableRows) {
|
|
22968
|
+
for (let h = 0; h < rIdx && h < tblSource.tableRows.length; h++) {
|
|
22969
|
+
tblSource.tableRows[h] = {
|
|
22970
|
+
...tblSource.tableRows[h],
|
|
22971
|
+
...h === 0 ? { isFirstRow: BooleanNumber5.TRUE } : {},
|
|
22972
|
+
repeatHeaderRow: BooleanNumber5.TRUE
|
|
22973
|
+
};
|
|
22974
|
+
}
|
|
22665
22975
|
}
|
|
22666
|
-
if (items.length === 0 && emptyStrategy === "remove" &&
|
|
22976
|
+
if (items.length === 0 && emptyStrategy === "remove" && remainingRowCount > 1) {
|
|
22977
|
+
remainingRowCount--;
|
|
22667
22978
|
const removeStart = rowSpan.rowStart;
|
|
22668
22979
|
const removeEnd = rowSpan.rowEndInclusive;
|
|
22669
|
-
const
|
|
22670
|
-
|
|
22671
|
-
body.
|
|
22980
|
+
const rowEndExclusive2 = removeEnd + 1;
|
|
22981
|
+
const removedLen = rowEndExclusive2 - removeStart;
|
|
22982
|
+
body.dataStream = body.dataStream.slice(0, removeStart) + body.dataStream.slice(rowEndExclusive2);
|
|
22983
|
+
body.paragraphs = (body.paragraphs ?? []).filter((p) => p.startIndex < removeStart || p.startIndex >= rowEndExclusive2).map((p) => ({
|
|
22672
22984
|
...p,
|
|
22673
|
-
startIndex: p.startIndex
|
|
22985
|
+
startIndex: p.startIndex >= rowEndExclusive2 ? p.startIndex - removedLen : p.startIndex
|
|
22674
22986
|
}));
|
|
22675
|
-
body.sectionBreaks = (body.sectionBreaks ?? []).filter((s) => s.startIndex < removeStart || s.startIndex
|
|
22987
|
+
body.sectionBreaks = (body.sectionBreaks ?? []).filter((s) => s.startIndex < removeStart || s.startIndex >= rowEndExclusive2).map((s) => ({
|
|
22676
22988
|
...s,
|
|
22677
|
-
startIndex: s.startIndex
|
|
22989
|
+
startIndex: s.startIndex >= rowEndExclusive2 ? s.startIndex - removedLen : s.startIndex
|
|
22678
22990
|
}));
|
|
22679
|
-
body.customBlocks = (body.customBlocks ?? []).filter((b) => b.startIndex < removeStart || b.startIndex
|
|
22991
|
+
body.customBlocks = (body.customBlocks ?? []).filter((b) => b.startIndex < removeStart || b.startIndex >= rowEndExclusive2).map((b) => ({
|
|
22680
22992
|
...b,
|
|
22681
|
-
startIndex: b.startIndex
|
|
22993
|
+
startIndex: b.startIndex >= rowEndExclusive2 ? b.startIndex - removedLen : b.startIndex
|
|
22682
22994
|
}));
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22995
|
+
const nextRangesOnRemove = [];
|
|
22996
|
+
for (const r of body.customRanges ?? []) {
|
|
22997
|
+
if (r.endIndex < removeStart) {
|
|
22998
|
+
nextRangesOnRemove.push(r);
|
|
22999
|
+
} else if (r.startIndex >= rowEndExclusive2) {
|
|
23000
|
+
nextRangesOnRemove.push({
|
|
23001
|
+
...r,
|
|
23002
|
+
startIndex: r.startIndex - removedLen,
|
|
23003
|
+
endIndex: r.endIndex - removedLen
|
|
23004
|
+
});
|
|
23005
|
+
} else if (r.startIndex < removeStart && r.endIndex >= rowEndExclusive2) {
|
|
23006
|
+
nextRangesOnRemove.push({
|
|
23007
|
+
...r,
|
|
23008
|
+
endIndex: r.endIndex - removedLen
|
|
23009
|
+
});
|
|
23010
|
+
}
|
|
23011
|
+
}
|
|
23012
|
+
body.customRanges = nextRangesOnRemove;
|
|
23013
|
+
const nextRunsOnRemove = [];
|
|
23014
|
+
for (const tr of body.textRuns ?? []) {
|
|
23015
|
+
if (tr.ed <= removeStart) {
|
|
23016
|
+
nextRunsOnRemove.push(tr);
|
|
23017
|
+
} else if (tr.st >= rowEndExclusive2) {
|
|
23018
|
+
nextRunsOnRemove.push({ ...tr, st: tr.st - removedLen, ed: tr.ed - removedLen });
|
|
23019
|
+
} else if (tr.st < removeStart && tr.ed > rowEndExclusive2) {
|
|
23020
|
+
nextRunsOnRemove.push({ ...tr, ed: tr.ed - removedLen });
|
|
23021
|
+
} else if (tr.st < removeStart) {
|
|
23022
|
+
nextRunsOnRemove.push({ ...tr, ed: removeStart });
|
|
23023
|
+
} else if (tr.ed > rowEndExclusive2) {
|
|
23024
|
+
nextRunsOnRemove.push({ ...tr, st: removeStart, ed: tr.ed - removedLen });
|
|
23025
|
+
}
|
|
23026
|
+
}
|
|
23027
|
+
body.textRuns = nextRunsOnRemove.filter((r) => r.ed > r.st);
|
|
22689
23028
|
body.tables = body.tables.map((t, idx) => {
|
|
22690
|
-
if (idx === tIdx
|
|
22691
|
-
|
|
23029
|
+
if (idx === tIdx || t.startIndex <= removeStart && t.endIndex >= rowEndExclusive2) {
|
|
23030
|
+
return { ...t, endIndex: t.endIndex - removedLen };
|
|
23031
|
+
}
|
|
23032
|
+
if (t.startIndex >= rowEndExclusive2) {
|
|
22692
23033
|
return { ...t, startIndex: t.startIndex - removedLen, endIndex: t.endIndex - removedLen };
|
|
22693
23034
|
}
|
|
22694
23035
|
return t;
|
|
22695
23036
|
});
|
|
22696
23037
|
if (tblSource?.tableRows?.[rIdx]) {
|
|
22697
23038
|
tblSource.tableRows.splice(rIdx, 1);
|
|
23039
|
+
if (rIdx === 0 && tblSource.tableRows[0]) {
|
|
23040
|
+
tblSource.tableRows[0] = { ...tblSource.tableRows[0], isFirstRow: BooleanNumber5.TRUE };
|
|
23041
|
+
}
|
|
22698
23042
|
}
|
|
22699
23043
|
continue;
|
|
22700
23044
|
}
|
|
22701
23045
|
const effectiveRows = items.length > 0 ? items : [null];
|
|
22702
|
-
|
|
23046
|
+
remainingRowCount += effectiveRows.length - 1;
|
|
23047
|
+
const effectiveEmptyStrategy = emptyStrategy === "remove" ? "keep-blank" : emptyStrategy;
|
|
23048
|
+
const cellStyles = rowSpan.cells.map((cell, cIdx) => {
|
|
23049
|
+
const cellSdts = rowCellSdts[cIdx];
|
|
23050
|
+
const nonSdtRun = (body.textRuns ?? []).find((tr) => {
|
|
23051
|
+
if (tr.ed <= cell.contentStart || tr.st >= cell.textEndExclusive) return false;
|
|
23052
|
+
return !cellSdts.some((s) => tr.st >= s.range.startIndex && tr.ed <= s.range.endIndex + 1);
|
|
23053
|
+
});
|
|
23054
|
+
if (nonSdtRun?.ts) {
|
|
23055
|
+
return sanitizeLoopCellRunStyle(nonSdtRun.ts);
|
|
23056
|
+
}
|
|
23057
|
+
const anchorTypo = cellSdts.length > 0 ? resolveRangeAnchorTypography(body, cellSdts[0].range) : void 0;
|
|
22703
23058
|
const hitRun = (body.textRuns ?? []).find(
|
|
22704
23059
|
(tr) => tr.st <= cell.contentStart && tr.ed > cell.contentStart
|
|
22705
23060
|
);
|
|
22706
|
-
return hitRun?.ts;
|
|
23061
|
+
return sanitizeLoopCellRunStyle(hitRun?.ts, anchorTypo);
|
|
22707
23062
|
});
|
|
22708
23063
|
const templateCellParas = rowSpan.cells.map(
|
|
22709
|
-
(cell) => (body.paragraphs ?? []).
|
|
23064
|
+
(cell) => (body.paragraphs ?? []).filter(
|
|
22710
23065
|
(p) => p.startIndex >= cell.contentStart && p.startIndex < cell.cellEndInclusive
|
|
22711
23066
|
)
|
|
22712
23067
|
);
|
|
23068
|
+
const templateCellSections = rowSpan.cells.map(
|
|
23069
|
+
(cell) => (body.sectionBreaks ?? []).find(
|
|
23070
|
+
(s) => s.startIndex >= cell.contentStart && s.startIndex < cell.cellEndInclusive
|
|
23071
|
+
)
|
|
23072
|
+
);
|
|
22713
23073
|
let builtStream = "";
|
|
22714
23074
|
const builtParas = [];
|
|
22715
23075
|
const builtSections = [];
|
|
@@ -22719,34 +23079,53 @@ function expandDocTableRowLoopsInPlace(nextSnapshot, data, explicitLoops) {
|
|
|
22719
23079
|
builtStream += DataStreamTreeTokenType13.TABLE_ROW_START;
|
|
22720
23080
|
rowSpan.cells.forEach((cell, cIdx) => {
|
|
22721
23081
|
builtStream += DataStreamTreeTokenType13.TABLE_CELL_START;
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
cellText = cIdx === 0 ? explicitCfg?.emptyPlaceholderText || "\u6682\u65E0\u660E\u7EC6\u6570\u636E" : "";
|
|
23082
|
+
let rawRendered;
|
|
23083
|
+
if (itemObj === null && effectiveEmptyStrategy === "placeholder") {
|
|
23084
|
+
rawRendered = cIdx === 0 ? explicitCfg?.emptyPlaceholderText || "\u6682\u65E0\u660E\u7EC6\u6570\u636E" : "";
|
|
22726
23085
|
} else {
|
|
22727
|
-
|
|
23086
|
+
rawRendered = renderLoopCellContent(
|
|
23087
|
+
body,
|
|
23088
|
+
cell,
|
|
23089
|
+
rowCellSdts[cIdx],
|
|
23090
|
+
detectedListKey,
|
|
23091
|
+
itemObj,
|
|
23092
|
+
cloneIdx,
|
|
23093
|
+
data,
|
|
23094
|
+
hasExplicitListKey
|
|
23095
|
+
);
|
|
22728
23096
|
}
|
|
22729
|
-
|
|
22730
|
-
const
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
23097
|
+
const normalizedCellText = rawRendered.replace(/\r\n/g, "\r").replace(/\n/g, "\r");
|
|
23098
|
+
const cellLines = normalizedCellText.split("\r");
|
|
23099
|
+
const tplParasInCell = templateCellParas[cIdx];
|
|
23100
|
+
const fallbackTplPara = tplParasInCell.length > 0 ? tplParasInCell[tplParasInCell.length - 1] : void 0;
|
|
23101
|
+
cellLines.forEach((lineText, lineIdx) => {
|
|
23102
|
+
const lineStart = baseInsertOffset + builtStream.length;
|
|
23103
|
+
builtStream += lineText;
|
|
23104
|
+
const lineEnd = baseInsertOffset + builtStream.length;
|
|
23105
|
+
if (cellStyles[cIdx] && lineEnd > lineStart) {
|
|
23106
|
+
builtRuns.push({
|
|
23107
|
+
st: lineStart,
|
|
23108
|
+
ed: lineEnd,
|
|
23109
|
+
ts: Tools10.deepClone(cellStyles[cIdx])
|
|
23110
|
+
});
|
|
23111
|
+
}
|
|
23112
|
+
const pOffset = baseInsertOffset + builtStream.length;
|
|
23113
|
+
builtStream += DataStreamTreeTokenType13.PARAGRAPH;
|
|
23114
|
+
const tplPara = tplParasInCell[lineIdx] ?? fallbackTplPara;
|
|
23115
|
+
const isFinalLine = lineIdx === cellLines.length - 1;
|
|
23116
|
+
const deterministicParaId = cloneIdx === 0 && tplParasInCell[lineIdx]?.paragraphId ? tplParasInCell[lineIdx].paragraphId : cloneIdx === 0 && isFinalLine && fallbackTplPara?.paragraphId && cellLines.length === 1 ? fallbackTplPara.paragraphId : isFinalLine && cellLines.length === 1 ? `p_loop_${tblRef.tableId}_r${rIdx}_${cloneIdx}_c${cIdx}` : `p_loop_${tblRef.tableId}_r${rIdx}_${cloneIdx}_c${cIdx}_m${lineIdx}`;
|
|
23117
|
+
builtParas.push({
|
|
23118
|
+
...tplPara ? Tools10.deepClone(tplPara) : {},
|
|
23119
|
+
paragraphId: deterministicParaId,
|
|
23120
|
+
startIndex: pOffset
|
|
22736
23121
|
});
|
|
22737
|
-
}
|
|
22738
|
-
const pOffset = baseInsertOffset + builtStream.length;
|
|
22739
|
-
builtStream += DataStreamTreeTokenType13.PARAGRAPH;
|
|
22740
|
-
const tplPara = templateCellParas[cIdx];
|
|
22741
|
-
builtParas.push({
|
|
22742
|
-
...tplPara ? Tools10.deepClone(tplPara) : {},
|
|
22743
|
-
paragraphId: cloneIdx === 0 && tplPara?.paragraphId ? tplPara.paragraphId : `p_tr_${generateRandomId11(6)}`,
|
|
22744
|
-
startIndex: pOffset
|
|
22745
23122
|
});
|
|
22746
23123
|
const sOffset = baseInsertOffset + builtStream.length;
|
|
22747
23124
|
builtStream += DataStreamTreeTokenType13.SECTION_BREAK;
|
|
23125
|
+
const tplSec = templateCellSections[cIdx];
|
|
22748
23126
|
builtSections.push({
|
|
22749
|
-
|
|
23127
|
+
...tplSec ? Tools10.deepClone(tplSec) : {},
|
|
23128
|
+
sectionId: cloneIdx === 0 && tplSec?.sectionId ? tplSec.sectionId : `s_loop_${tblRef.tableId}_r${rIdx}_${cloneIdx}_c${cIdx}`,
|
|
22750
23129
|
startIndex: sOffset
|
|
22751
23130
|
});
|
|
22752
23131
|
builtStream += DataStreamTreeTokenType13.TABLE_CELL_END;
|
|
@@ -22755,50 +23134,77 @@ function expandDocTableRowLoopsInPlace(nextSnapshot, data, explicitLoops) {
|
|
|
22755
23134
|
});
|
|
22756
23135
|
const oldStart = rowSpan.rowStart;
|
|
22757
23136
|
const oldEnd = rowSpan.rowEndInclusive;
|
|
22758
|
-
const
|
|
23137
|
+
const rowEndExclusive = oldEnd + 1;
|
|
23138
|
+
const oldLen = rowEndExclusive - oldStart;
|
|
22759
23139
|
const delta = builtStream.length - oldLen;
|
|
22760
|
-
body.dataStream = body.dataStream.slice(0, oldStart) + builtStream + body.dataStream.slice(
|
|
23140
|
+
body.dataStream = body.dataStream.slice(0, oldStart) + builtStream + body.dataStream.slice(rowEndExclusive);
|
|
22761
23141
|
body.paragraphs = [
|
|
22762
23142
|
...(body.paragraphs ?? []).filter((p) => p.startIndex < oldStart),
|
|
22763
23143
|
...builtParas,
|
|
22764
|
-
...(body.paragraphs ?? []).filter((p) => p.startIndex
|
|
23144
|
+
...(body.paragraphs ?? []).filter((p) => p.startIndex >= rowEndExclusive).map((p) => ({ ...p, startIndex: p.startIndex + delta }))
|
|
22765
23145
|
].sort((a, b) => a.startIndex - b.startIndex);
|
|
22766
23146
|
body.sectionBreaks = [
|
|
22767
23147
|
...(body.sectionBreaks ?? []).filter((s) => s.startIndex < oldStart),
|
|
22768
23148
|
...builtSections,
|
|
22769
|
-
...(body.sectionBreaks ?? []).filter((s) => s.startIndex
|
|
23149
|
+
...(body.sectionBreaks ?? []).filter((s) => s.startIndex >= rowEndExclusive).map((s) => ({ ...s, startIndex: s.startIndex + delta }))
|
|
22770
23150
|
].sort((a, b) => a.startIndex - b.startIndex);
|
|
22771
|
-
body.customBlocks = (body.customBlocks ?? []).map(
|
|
22772
|
-
(b) => b.startIndex
|
|
22773
|
-
);
|
|
22774
|
-
body.customRanges = (body.customRanges ?? []).filter((r) => r.endIndex < oldStart || r.startIndex > oldEnd).map(
|
|
22775
|
-
(r) => r.startIndex > oldEnd ? { ...r, startIndex: r.startIndex + delta, endIndex: r.endIndex + delta } : r
|
|
23151
|
+
body.customBlocks = (body.customBlocks ?? []).filter((b) => b.startIndex < oldStart || b.startIndex >= rowEndExclusive).map(
|
|
23152
|
+
(b) => b.startIndex >= rowEndExclusive ? { ...b, startIndex: b.startIndex + delta } : b
|
|
22776
23153
|
);
|
|
23154
|
+
const nextCustomRanges = [];
|
|
23155
|
+
for (const r of body.customRanges ?? []) {
|
|
23156
|
+
if (r.endIndex < oldStart) {
|
|
23157
|
+
nextCustomRanges.push(r);
|
|
23158
|
+
} else if (r.startIndex >= rowEndExclusive) {
|
|
23159
|
+
nextCustomRanges.push({
|
|
23160
|
+
...r,
|
|
23161
|
+
startIndex: r.startIndex + delta,
|
|
23162
|
+
endIndex: r.endIndex + delta
|
|
23163
|
+
});
|
|
23164
|
+
} else if (r.startIndex < oldStart && r.endIndex >= rowEndExclusive) {
|
|
23165
|
+
nextCustomRanges.push({
|
|
23166
|
+
...r,
|
|
23167
|
+
endIndex: r.endIndex + delta
|
|
23168
|
+
});
|
|
23169
|
+
}
|
|
23170
|
+
}
|
|
23171
|
+
body.customRanges = nextCustomRanges;
|
|
22777
23172
|
const nextRuns = [];
|
|
22778
23173
|
for (const tr of body.textRuns ?? []) {
|
|
22779
23174
|
if (tr.ed <= oldStart) {
|
|
22780
23175
|
nextRuns.push(tr);
|
|
22781
|
-
} else if (tr.st
|
|
23176
|
+
} else if (tr.st >= rowEndExclusive) {
|
|
22782
23177
|
nextRuns.push({ ...tr, st: tr.st + delta, ed: tr.ed + delta });
|
|
22783
|
-
} else
|
|
22784
|
-
|
|
23178
|
+
} else {
|
|
23179
|
+
if (tr.st < oldStart) {
|
|
23180
|
+
nextRuns.push({ ...tr, ed: oldStart });
|
|
23181
|
+
}
|
|
23182
|
+
if (tr.ed > rowEndExclusive) {
|
|
23183
|
+
nextRuns.push({
|
|
23184
|
+
...tr,
|
|
23185
|
+
st: oldStart + builtStream.length,
|
|
23186
|
+
ed: tr.ed + delta
|
|
23187
|
+
});
|
|
23188
|
+
}
|
|
22785
23189
|
}
|
|
22786
23190
|
}
|
|
22787
23191
|
nextRuns.push(...builtRuns);
|
|
22788
23192
|
nextRuns.sort((a, b) => a.st - b.st || a.ed - b.ed);
|
|
22789
23193
|
body.textRuns = nextRuns.filter((r) => r.ed > r.st);
|
|
22790
23194
|
body.tables = body.tables.map((t, idx) => {
|
|
22791
|
-
if (idx === tIdx
|
|
22792
|
-
|
|
23195
|
+
if (idx === tIdx || t.startIndex <= oldStart && t.endIndex >= rowEndExclusive) {
|
|
23196
|
+
return { ...t, endIndex: t.endIndex + delta };
|
|
23197
|
+
}
|
|
23198
|
+
if (t.startIndex >= rowEndExclusive) {
|
|
22793
23199
|
return { ...t, startIndex: t.startIndex + delta, endIndex: t.endIndex + delta };
|
|
22794
23200
|
}
|
|
22795
23201
|
return t;
|
|
22796
23202
|
});
|
|
22797
23203
|
if (tblSource?.tableRows?.[rIdx]) {
|
|
22798
23204
|
const tplRow = tblSource.tableRows[rIdx];
|
|
22799
|
-
const clonedRowDefs = effectiveRows.map(() => {
|
|
23205
|
+
const clonedRowDefs = effectiveRows.map((_, cloneIdx) => {
|
|
22800
23206
|
const cloned = Tools10.deepClone(tplRow);
|
|
22801
|
-
cloned.isFirstRow = BooleanNumber5.FALSE;
|
|
23207
|
+
cloned.isFirstRow = rIdx === 0 && cloneIdx === 0 ? BooleanNumber5.TRUE : BooleanNumber5.FALSE;
|
|
22802
23208
|
cloned.repeatHeaderRow = BooleanNumber5.FALSE;
|
|
22803
23209
|
return cloned;
|
|
22804
23210
|
});
|
|
@@ -22806,6 +23212,18 @@ function expandDocTableRowLoopsInPlace(nextSnapshot, data, explicitLoops) {
|
|
|
22806
23212
|
}
|
|
22807
23213
|
}
|
|
22808
23214
|
}
|
|
23215
|
+
if (consumedLoopKeys.size > 0 || metaChanged) {
|
|
23216
|
+
const nextLoops = { ...snapMeta.tableRowLoops ?? {} };
|
|
23217
|
+
for (const k of consumedLoopKeys) {
|
|
23218
|
+
delete nextLoops[k];
|
|
23219
|
+
}
|
|
23220
|
+
const nextRepeatHeaders = snapMeta.tableRepeatHeaders ? { ...snapMeta.tableRepeatHeaders } : void 0;
|
|
23221
|
+
writeDocTemplateMetadataToSnapshot(nextSnapshot, {
|
|
23222
|
+
...snapMeta,
|
|
23223
|
+
tableRowLoops: Object.keys(nextLoops).length > 0 ? nextLoops : void 0,
|
|
23224
|
+
tableRepeatHeaders: nextRepeatHeaders && Object.keys(nextRepeatHeaders).length > 0 ? nextRepeatHeaders : void 0
|
|
23225
|
+
});
|
|
23226
|
+
}
|
|
22809
23227
|
}
|
|
22810
23228
|
function parseIsoDateForExpr(raw) {
|
|
22811
23229
|
if (raw == null) return null;
|
|
@@ -22896,6 +23314,7 @@ function evaluateVisibleIfCondition(expr, data) {
|
|
|
22896
23314
|
function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
22897
23315
|
const nextSnapshot = Tools10.deepClone(snapshot);
|
|
22898
23316
|
if (!nextSnapshot.body) return nextSnapshot;
|
|
23317
|
+
const cleanFilledChrome = options?.cleanFilledChrome !== false;
|
|
22899
23318
|
expandDocTableRowLoopsInPlace(nextSnapshot, data, options?.tableRowLoops);
|
|
22900
23319
|
const controls = listDocSdtControls(nextSnapshot);
|
|
22901
23320
|
for (const ctrl of controls) {
|
|
@@ -22952,7 +23371,7 @@ function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
|
22952
23371
|
false,
|
|
22953
23372
|
true,
|
|
22954
23373
|
void 0,
|
|
22955
|
-
ctrl.visualChrome,
|
|
23374
|
+
cleanFilledChrome ? ctrl.visualChrome ?? "clean" : ctrl.visualChrome,
|
|
22956
23375
|
anchorTypo
|
|
22957
23376
|
);
|
|
22958
23377
|
const updatedSegBody2 = spliceMultiParagraphBodySpan(
|
|
@@ -22977,13 +23396,14 @@ function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
|
22977
23396
|
normalizedValue
|
|
22978
23397
|
);
|
|
22979
23398
|
const matchedHighlight = !showingPlaceholder ? matchSdtHighlightRule(ctrl.highlightRules, `${text} ${String(normalizedValue)}`) : void 0;
|
|
23399
|
+
const effectiveChrome = !showingPlaceholder && cleanFilledChrome ? ctrl.visualChrome ?? "clean" : ctrl.visualChrome;
|
|
22980
23400
|
const style = computeSdtVisualStyle(
|
|
22981
23401
|
ctrl.kind,
|
|
22982
23402
|
ctrl.lock,
|
|
22983
23403
|
showingPlaceholder,
|
|
22984
23404
|
Boolean(ctrl.bindingPath),
|
|
22985
23405
|
matchedHighlight,
|
|
22986
|
-
|
|
23406
|
+
effectiveChrome,
|
|
22987
23407
|
anchorTypo,
|
|
22988
23408
|
{
|
|
22989
23409
|
underlineBlank: ctrl.underlineBlank,
|
|
@@ -23029,7 +23449,7 @@ function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
|
23029
23449
|
const pStart = matchedParaIdx === 0 ? 0 : paras[matchedParaIdx - 1].startIndex + 1;
|
|
23030
23450
|
const pEnd = paras[matchedParaIdx].startIndex;
|
|
23031
23451
|
const rawLine = workingBody.dataStream.slice(pStart, pEnd);
|
|
23032
|
-
const rawArr = data[listKey];
|
|
23452
|
+
const rawArr = resolvePathValue(data, listKey) ?? data[listKey];
|
|
23033
23453
|
const items = Array.isArray(rawArr) ? rawArr : [];
|
|
23034
23454
|
const expandedLines = (items.length > 0 ? items : [{}]).map(
|
|
23035
23455
|
(itemObj, idx) => rawLine.replace(EXPLICIT_LIST_TOKEN_RE, (_full, lKey, subKey) => {
|
|
@@ -23052,7 +23472,7 @@ function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
|
23052
23472
|
const crPos = cursor + line.length;
|
|
23053
23473
|
newParaEntries.push({
|
|
23054
23474
|
...Tools10.deepClone(templatePara),
|
|
23055
|
-
paragraphId: k === 0 ? templatePara.paragraphId : `
|
|
23475
|
+
paragraphId: k === 0 ? templatePara.paragraphId : `${templatePara.paragraphId || `p_${matchedParaIdx}`}_loop_${k}`,
|
|
23056
23476
|
startIndex: crPos
|
|
23057
23477
|
});
|
|
23058
23478
|
cursor = crPos + 1;
|
|
@@ -23119,7 +23539,7 @@ function fillDatasetIntoDocSnapshot(snapshot, data, options) {
|
|
|
23119
23539
|
nextSnapshot.tableSource = cascadeOutcome.snapshot.tableSource;
|
|
23120
23540
|
nextSnapshot.resources = cascadeOutcome.snapshot.resources;
|
|
23121
23541
|
}
|
|
23122
|
-
evaluateComputedSdtControlsInPlace(nextSnapshot, data);
|
|
23542
|
+
evaluateComputedSdtControlsInPlace(nextSnapshot, data, cleanFilledChrome);
|
|
23123
23543
|
recalculateInlineFormulasInPlace(nextSnapshot, data);
|
|
23124
23544
|
evaluateDocTableFormulasInPlace(nextSnapshot);
|
|
23125
23545
|
const snapMeta = readDocTemplateMetadataFromSnapshot(nextSnapshot);
|
|
@@ -24531,7 +24951,7 @@ function buildLiveDocFormContext(snapshot, extraData) {
|
|
|
24531
24951
|
ctx.__displayMap = displayMap;
|
|
24532
24952
|
return ctx;
|
|
24533
24953
|
}
|
|
24534
|
-
function evaluateComputedSdtControlsInPlace(snapshot, extraData) {
|
|
24954
|
+
function evaluateComputedSdtControlsInPlace(snapshot, extraData, cleanFilledChrome = false) {
|
|
24535
24955
|
if (!snapshot.body) return false;
|
|
24536
24956
|
const initialControls = listDocSdtControls(snapshot).filter((c) => Boolean(c.computedExpr?.trim()));
|
|
24537
24957
|
if (initialControls.length === 0) return false;
|
|
@@ -24566,13 +24986,14 @@ function evaluateComputedSdtControlsInPlace(snapshot, extraData) {
|
|
|
24566
24986
|
normalizedValue
|
|
24567
24987
|
);
|
|
24568
24988
|
const matchedHighlight = !showingPlaceholder ? matchSdtHighlightRule(latestResolved.highlightRules, `${text} ${String(normalizedValue)}`) : void 0;
|
|
24989
|
+
const effectiveChrome = !showingPlaceholder && cleanFilledChrome ? latestResolved.visualChrome ?? "clean" : latestResolved.visualChrome;
|
|
24569
24990
|
const style = computeSdtVisualStyle(
|
|
24570
24991
|
latestResolved.kind,
|
|
24571
24992
|
latestResolved.lock,
|
|
24572
24993
|
showingPlaceholder,
|
|
24573
24994
|
Boolean(latestResolved.bindingPath),
|
|
24574
24995
|
matchedHighlight,
|
|
24575
|
-
|
|
24996
|
+
effectiveChrome,
|
|
24576
24997
|
anchorTypo,
|
|
24577
24998
|
{
|
|
24578
24999
|
underlineBlank: latestResolved.underlineBlank,
|
|
@@ -25231,6 +25652,20 @@ DocSdtService = __decorateClass([
|
|
|
25231
25652
|
__decorateParam(0, IUniverInstanceService)
|
|
25232
25653
|
], DocSdtService);
|
|
25233
25654
|
|
|
25655
|
+
// src/commands/doc-wave2.command.ts
|
|
25656
|
+
import {
|
|
25657
|
+
CommandType as CommandType2,
|
|
25658
|
+
CustomRangeType as CustomRangeType12,
|
|
25659
|
+
generateRandomId as generateRandomId14,
|
|
25660
|
+
ICommandService as ICommandService3,
|
|
25661
|
+
IUndoRedoService as IUndoRedoService2,
|
|
25662
|
+
JSONX,
|
|
25663
|
+
RedoCommand,
|
|
25664
|
+
Tools as Tools13,
|
|
25665
|
+
UndoCommand
|
|
25666
|
+
} from "@univerjs/core";
|
|
25667
|
+
import { RichTextEditingMutation } from "@univerjs/docs";
|
|
25668
|
+
|
|
25234
25669
|
// src/commands/doc-v204.command.ts
|
|
25235
25670
|
import {
|
|
25236
25671
|
CommandType,
|
|
@@ -26106,18 +26541,6 @@ var RefreshDocTableOfContentsCommand = {
|
|
|
26106
26541
|
};
|
|
26107
26542
|
|
|
26108
26543
|
// src/commands/doc-wave2.command.ts
|
|
26109
|
-
import {
|
|
26110
|
-
CommandType as CommandType2,
|
|
26111
|
-
CustomRangeType as CustomRangeType12,
|
|
26112
|
-
generateRandomId as generateRandomId14,
|
|
26113
|
-
ICommandService as ICommandService3,
|
|
26114
|
-
IUndoRedoService as IUndoRedoService2,
|
|
26115
|
-
JSONX,
|
|
26116
|
-
RedoCommand,
|
|
26117
|
-
Tools as Tools13,
|
|
26118
|
-
UndoCommand
|
|
26119
|
-
} from "@univerjs/core";
|
|
26120
|
-
import { RichTextEditingMutation } from "@univerjs/docs";
|
|
26121
26544
|
function buildAuxParams(unitId, snap, metadata) {
|
|
26122
26545
|
return {
|
|
26123
26546
|
unitId,
|
|
@@ -28634,16 +29057,21 @@ var FillDocDatasetCommand = {
|
|
|
28634
29057
|
const sdtService = accessor.get(IDocSdtService);
|
|
28635
29058
|
if (sdtService.getDocMode(docModel.getUnitId()) === "view") return false;
|
|
28636
29059
|
const unitId = docModel.getUnitId();
|
|
28637
|
-
const
|
|
28638
|
-
const
|
|
28639
|
-
|
|
29060
|
+
const prevMeta = Tools17.deepClone(sdtService.getTemplateMetadata(unitId));
|
|
29061
|
+
const prevSnap = Tools17.deepClone(docModel.getSnapshot());
|
|
29062
|
+
const baseSnap = Tools17.deepClone(prevSnap);
|
|
29063
|
+
writeDocTemplateMetadataToSnapshot(baseSnap, prevMeta);
|
|
28640
29064
|
const filledSnapshot = fillDatasetIntoDocSnapshot(baseSnap, params.data, {
|
|
28641
|
-
tableRowLoops:
|
|
29065
|
+
tableRowLoops: prevMeta.tableRowLoops
|
|
28642
29066
|
});
|
|
28643
29067
|
if (!filledSnapshot.body) return false;
|
|
28644
|
-
|
|
28645
|
-
|
|
28646
|
-
|
|
29068
|
+
return executeWave2SnapshotUpdateWithUndoRedo(
|
|
29069
|
+
accessor,
|
|
29070
|
+
docModel,
|
|
29071
|
+
prevSnap,
|
|
29072
|
+
prevMeta,
|
|
29073
|
+
filledSnapshot
|
|
29074
|
+
);
|
|
28647
29075
|
}
|
|
28648
29076
|
};
|
|
28649
29077
|
var ReplaceDocUnitSnapshotCommand = {
|
|
@@ -30523,6 +30951,17 @@ import {
|
|
|
30523
30951
|
Disposable as Disposable5
|
|
30524
30952
|
} from "@univerjs/core";
|
|
30525
30953
|
import { BehaviorSubject as BehaviorSubject4, Subject as Subject2 } from "rxjs";
|
|
30954
|
+
var DOC_IO_CAPABILITY_FORMATS = [
|
|
30955
|
+
"docx",
|
|
30956
|
+
"doc",
|
|
30957
|
+
"rtf",
|
|
30958
|
+
"odt",
|
|
30959
|
+
"md",
|
|
30960
|
+
"html",
|
|
30961
|
+
"pdf",
|
|
30962
|
+
"txt",
|
|
30963
|
+
"json"
|
|
30964
|
+
];
|
|
30526
30965
|
var DocIoTargetError = class extends Error {
|
|
30527
30966
|
constructor(message) {
|
|
30528
30967
|
super(message);
|
|
@@ -30538,6 +30977,73 @@ async function normalizeToUint8Array(raw) {
|
|
|
30538
30977
|
if (raw instanceof ArrayBuffer) return new Uint8Array(raw);
|
|
30539
30978
|
return new Uint8Array(await raw.arrayBuffer());
|
|
30540
30979
|
}
|
|
30980
|
+
var DEFAULT_BROWSER_IMPORT_SET = /* @__PURE__ */ new Set([
|
|
30981
|
+
"docx",
|
|
30982
|
+
"doc",
|
|
30983
|
+
"rtf",
|
|
30984
|
+
"odt",
|
|
30985
|
+
"md",
|
|
30986
|
+
"html",
|
|
30987
|
+
"txt",
|
|
30988
|
+
"json"
|
|
30989
|
+
]);
|
|
30990
|
+
var DEFAULT_BROWSER_EXPORT_SET = /* @__PURE__ */ new Set([
|
|
30991
|
+
"docx",
|
|
30992
|
+
"doc",
|
|
30993
|
+
"rtf",
|
|
30994
|
+
"odt",
|
|
30995
|
+
"md",
|
|
30996
|
+
"html",
|
|
30997
|
+
"pdf",
|
|
30998
|
+
"txt",
|
|
30999
|
+
"json"
|
|
31000
|
+
]);
|
|
31001
|
+
function normalizeFormatKey(raw) {
|
|
31002
|
+
const lower = raw.trim().toLowerCase().replace(/^\./, "");
|
|
31003
|
+
if (lower === "markdown") return "md";
|
|
31004
|
+
if (lower === "htm") return "html";
|
|
31005
|
+
return lower;
|
|
31006
|
+
}
|
|
31007
|
+
function inferFormatFromFileName(fileName) {
|
|
31008
|
+
const m = fileName.trim().toLowerCase().match(/\.([^.]+)$/);
|
|
31009
|
+
if (!m) return "txt";
|
|
31010
|
+
return normalizeFormatKey(m[1]);
|
|
31011
|
+
}
|
|
31012
|
+
function normalizeImportWarnings(rawWarnings) {
|
|
31013
|
+
if (!Array.isArray(rawWarnings)) return [];
|
|
31014
|
+
return rawWarnings.map((item) => {
|
|
31015
|
+
if (typeof item === "string") {
|
|
31016
|
+
const trimmed = item.trim();
|
|
31017
|
+
return trimmed ? { code: "SERVER_IMPORT_WARNING", message: trimmed } : null;
|
|
31018
|
+
}
|
|
31019
|
+
if (item && typeof item === "object" && typeof item.message === "string") {
|
|
31020
|
+
const w = item;
|
|
31021
|
+
return {
|
|
31022
|
+
code: w.code || "SERVER_IMPORT_WARNING",
|
|
31023
|
+
message: w.message,
|
|
31024
|
+
...typeof w.count === "number" ? { count: w.count } : {}
|
|
31025
|
+
};
|
|
31026
|
+
}
|
|
31027
|
+
return null;
|
|
31028
|
+
}).filter((w) => w !== null);
|
|
31029
|
+
}
|
|
31030
|
+
function unwrapAdapterImportResult(rawResult) {
|
|
31031
|
+
if (rawResult && typeof rawResult === "object" && !("body" in rawResult && rawResult.body !== void 0) && ("snapshot" in rawResult || "documentData" in rawResult)) {
|
|
31032
|
+
const env = rawResult;
|
|
31033
|
+
const doc2 = env.snapshot ?? env.documentData ?? {};
|
|
31034
|
+
const envWarnings = normalizeImportWarnings(env.warnings);
|
|
31035
|
+
const attachedWarnings = normalizeImportWarnings(doc2?.__importWarnings);
|
|
31036
|
+
return {
|
|
31037
|
+
documentData: doc2,
|
|
31038
|
+
warnings: envWarnings.length > 0 ? envWarnings : attachedWarnings
|
|
31039
|
+
};
|
|
31040
|
+
}
|
|
31041
|
+
const doc = rawResult ?? {};
|
|
31042
|
+
const warnings = normalizeImportWarnings(
|
|
31043
|
+
rawResult?.warnings ?? rawResult?.__importWarnings
|
|
31044
|
+
);
|
|
31045
|
+
return { documentData: doc, warnings };
|
|
31046
|
+
}
|
|
30541
31047
|
var DocIoService = class extends Disposable5 {
|
|
30542
31048
|
constructor() {
|
|
30543
31049
|
super();
|
|
@@ -30581,9 +31087,51 @@ var DocIoService = class extends Disposable5 {
|
|
|
30581
31087
|
setAdapter(adapter) {
|
|
30582
31088
|
this._adapter$.next({ name: adapter.name ?? "custom-adapter", ...adapter });
|
|
30583
31089
|
}
|
|
31090
|
+
getDefaultIoTarget() {
|
|
31091
|
+
if (this._serviceDefaultIoTarget !== void 0) {
|
|
31092
|
+
return this._serviceDefaultIoTarget;
|
|
31093
|
+
}
|
|
31094
|
+
return this._adapter$.getValue().defaultIoTarget ?? "auto";
|
|
31095
|
+
}
|
|
31096
|
+
setDefaultIoTarget(target) {
|
|
31097
|
+
this._serviceDefaultIoTarget = target;
|
|
31098
|
+
this._adapter$.next({ ...this._adapter$.getValue() });
|
|
31099
|
+
}
|
|
30584
31100
|
getIoCapabilities() {
|
|
30585
31101
|
const adapter = this._adapter$.getValue();
|
|
30586
|
-
const
|
|
31102
|
+
const defaultIoTarget = this.getDefaultIoTarget();
|
|
31103
|
+
const hasServerImport = Boolean(adapter.importDoc);
|
|
31104
|
+
const hasServerExport = Boolean(adapter.exportDoc);
|
|
31105
|
+
const hasServerIo = hasServerImport || hasServerExport;
|
|
31106
|
+
const recommendedDefaultTarget = defaultIoTarget === "browser" ? "browser" : defaultIoTarget === "server" ? "server" : hasServerIo ? "server" : "browser";
|
|
31107
|
+
const browserFmtCfg = adapter.browserFormats;
|
|
31108
|
+
const browserImportOverride = typeof browserFmtCfg === "object" && browserFmtCfg !== null && Array.isArray(browserFmtCfg.import) ? new Set(browserFmtCfg.import.map(normalizeFormatKey)) : null;
|
|
31109
|
+
const browserExportOverride = typeof browserFmtCfg === "object" && browserFmtCfg !== null && Array.isArray(browserFmtCfg.export) ? new Set(browserFmtCfg.export.map(normalizeFormatKey)) : null;
|
|
31110
|
+
const serverImportOverride = Array.isArray(adapter.serverFormats?.import) ? new Set(adapter.serverFormats.import.map(normalizeFormatKey)) : null;
|
|
31111
|
+
const serverExportOverride = Array.isArray(adapter.serverFormats?.export) ? new Set(adapter.serverFormats.export.map(normalizeFormatKey)) : null;
|
|
31112
|
+
const computeDefaultTarget = (serverSupported) => {
|
|
31113
|
+
if (defaultIoTarget === "server") return "server";
|
|
31114
|
+
if (defaultIoTarget === "browser") return "browser";
|
|
31115
|
+
return serverSupported ? "server" : "browser";
|
|
31116
|
+
};
|
|
31117
|
+
const importFormats = {};
|
|
31118
|
+
const exportFormats = {};
|
|
31119
|
+
for (const fmt3 of DOC_IO_CAPABILITY_FORMATS) {
|
|
31120
|
+
const browserImport = browserFmtCfg === false ? false : browserImportOverride ? browserImportOverride.has(fmt3) : DEFAULT_BROWSER_IMPORT_SET.has(fmt3);
|
|
31121
|
+
const serverImport = !hasServerImport ? false : serverImportOverride ? serverImportOverride.has(fmt3) : true;
|
|
31122
|
+
importFormats[fmt3] = {
|
|
31123
|
+
browser: browserImport,
|
|
31124
|
+
server: serverImport,
|
|
31125
|
+
defaultTarget: computeDefaultTarget(serverImport)
|
|
31126
|
+
};
|
|
31127
|
+
const browserExport = browserFmtCfg === false ? false : browserExportOverride ? browserExportOverride.has(fmt3) : DEFAULT_BROWSER_EXPORT_SET.has(fmt3);
|
|
31128
|
+
const serverExport = !hasServerExport ? false : serverExportOverride ? serverExportOverride.has(fmt3) : true;
|
|
31129
|
+
exportFormats[fmt3] = {
|
|
31130
|
+
browser: browserExport,
|
|
31131
|
+
server: serverExport,
|
|
31132
|
+
defaultTarget: computeDefaultTarget(serverExport)
|
|
31133
|
+
};
|
|
31134
|
+
}
|
|
30587
31135
|
return {
|
|
30588
31136
|
browser: {
|
|
30589
31137
|
importDocx: true,
|
|
@@ -30595,17 +31143,38 @@ var DocIoService = class extends Disposable5 {
|
|
|
30595
31143
|
},
|
|
30596
31144
|
server: {
|
|
30597
31145
|
adapterName: adapter.name || "frontend-default",
|
|
30598
|
-
importDoc:
|
|
30599
|
-
exportDoc:
|
|
31146
|
+
importDoc: hasServerImport,
|
|
31147
|
+
exportDoc: hasServerExport,
|
|
30600
31148
|
onSave: Boolean(adapter.onSave)
|
|
30601
31149
|
},
|
|
30602
|
-
|
|
31150
|
+
defaultIoTarget,
|
|
31151
|
+
recommendedDefaultTarget,
|
|
31152
|
+
formats: {
|
|
31153
|
+
import: importFormats,
|
|
31154
|
+
export: exportFormats
|
|
31155
|
+
}
|
|
30603
31156
|
};
|
|
30604
31157
|
}
|
|
31158
|
+
_resolveEffectiveTarget(operation, formatKey, requested) {
|
|
31159
|
+
if (requested === "browser") return "browser";
|
|
31160
|
+
if (requested === "server") return "server";
|
|
31161
|
+
const caps = this.getIoCapabilities();
|
|
31162
|
+
const fmtEntry = caps.formats[operation][formatKey];
|
|
31163
|
+
if (fmtEntry) return fmtEntry.defaultTarget;
|
|
31164
|
+
if (caps.defaultIoTarget === "server") return "server";
|
|
31165
|
+
if (caps.defaultIoTarget === "browser") return "browser";
|
|
31166
|
+
const hasHook = operation === "import" ? caps.server.importDoc : caps.server.exportDoc;
|
|
31167
|
+
return hasHook ? "server" : "browser";
|
|
31168
|
+
}
|
|
30605
31169
|
async importDocWithReport(file, options) {
|
|
30606
31170
|
let browserWarnings = [];
|
|
30607
31171
|
const defaultImport = async (f) => {
|
|
30608
31172
|
const lower = f.name.toLowerCase();
|
|
31173
|
+
const fmtKey2 = inferFormatFromFileName(f.name);
|
|
31174
|
+
const caps = this.getIoCapabilities();
|
|
31175
|
+
if (fmtKey2 === "pdf" || fmtKey2 in caps.formats.import && !caps.formats.import[fmtKey2].browser) {
|
|
31176
|
+
throw new Error(`\u5F53\u524D\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE\u4E0D\u652F\u6301\u76F4\u63A5\u5BFC\u5165 .${fmtKey2} \u683C\u5F0F\u6587\u4EF6`);
|
|
31177
|
+
}
|
|
30609
31178
|
const baseTitle = f.name.replace(/\.[^.]+$/, "") || "\u672A\u547D\u540D\u6587\u6863";
|
|
30610
31179
|
if (lower.endsWith(".docx")) {
|
|
30611
31180
|
const ab = await f.arrayBuffer();
|
|
@@ -30634,31 +31203,42 @@ var DocIoService = class extends Disposable5 {
|
|
|
30634
31203
|
});
|
|
30635
31204
|
};
|
|
30636
31205
|
const adapter = this._adapter$.getValue();
|
|
30637
|
-
const
|
|
30638
|
-
const effective =
|
|
31206
|
+
const fmtKey = inferFormatFromFileName(file.name);
|
|
31207
|
+
const effective = this._resolveEffectiveTarget("import", fmtKey, options?.target);
|
|
30639
31208
|
if (effective === "server") {
|
|
30640
31209
|
if (!adapter.importDoc) {
|
|
30641
31210
|
throw new DocIoTargetError(
|
|
30642
31211
|
"\u5F53\u524D\u672A\u914D\u7F6E\u670D\u52A1\u7AEF Word \u5BFC\u5165\u63A5\u53E3\uFF08importDoc\uFF09\uFF0C\u672A\u81EA\u52A8\u964D\u7EA7\u81F3\u6D4F\u89C8\u5668\u7AEF\uFF1B\u8BF7\u5148\u63A5\u5165\u670D\u52A1\u7AEF\u9002\u914D\u5668\u6216\u6539\u9009\u300C\u6D4F\u89C8\u5668\u5904\u7406\u300D"
|
|
30643
31212
|
);
|
|
30644
31213
|
}
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
|
|
30649
|
-
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
|
|
30654
|
-
|
|
31214
|
+
try {
|
|
31215
|
+
const rawOutcome = await adapter.importDoc(file, {
|
|
31216
|
+
unitId: options?.unitId,
|
|
31217
|
+
defaultImport
|
|
31218
|
+
});
|
|
31219
|
+
const unwrapped = unwrapAdapterImportResult(rawOutcome);
|
|
31220
|
+
return {
|
|
31221
|
+
snapshot: unwrapped.documentData,
|
|
31222
|
+
documentData: unwrapped.documentData,
|
|
31223
|
+
warnings: unwrapped.warnings.length > 0 ? unwrapped.warnings : browserWarnings,
|
|
31224
|
+
executedBy: "server",
|
|
31225
|
+
fileName: file.name
|
|
31226
|
+
};
|
|
31227
|
+
} catch (err) {
|
|
31228
|
+
if (err && typeof err === "object" && !err.suggestedFallback) {
|
|
31229
|
+
err.suggestedFallback = "browser";
|
|
31230
|
+
}
|
|
31231
|
+
throw err;
|
|
31232
|
+
}
|
|
30655
31233
|
}
|
|
30656
31234
|
try {
|
|
30657
31235
|
const documentData = await defaultImport(file);
|
|
30658
31236
|
return {
|
|
31237
|
+
snapshot: documentData,
|
|
30659
31238
|
documentData,
|
|
30660
31239
|
warnings: browserWarnings,
|
|
30661
|
-
executedBy: "browser"
|
|
31240
|
+
executedBy: "browser",
|
|
31241
|
+
fileName: file.name
|
|
30662
31242
|
};
|
|
30663
31243
|
} catch (err) {
|
|
30664
31244
|
if (err && typeof err === "object") {
|
|
@@ -30674,6 +31254,10 @@ var DocIoService = class extends Disposable5 {
|
|
|
30674
31254
|
async exportDoc(params) {
|
|
30675
31255
|
const format = params.format ?? "docx";
|
|
30676
31256
|
const defaultExport = async () => {
|
|
31257
|
+
const caps = this.getIoCapabilities();
|
|
31258
|
+
if (format in caps.formats.export && !caps.formats.export[format].browser) {
|
|
31259
|
+
throw new Error(`\u5F53\u524D\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE\u672A\u542F\u7528 .${format} \u683C\u5F0F\u5BFC\u51FA`);
|
|
31260
|
+
}
|
|
30677
31261
|
if (format === "docx") {
|
|
30678
31262
|
return exportDocxBytes(params.snapshot, params.data, {
|
|
30679
31263
|
signatureImageDataUrl: params.pdfOptions?.signatureImageDataUrl,
|
|
@@ -30739,27 +31323,38 @@ var DocIoService = class extends Disposable5 {
|
|
|
30739
31323
|
const targetSnapshot2 = params.data ? fillDatasetIntoDocSnapshot(params.snapshot, params.data) : params.snapshot;
|
|
30740
31324
|
return exportDocToOdtBytes(targetSnapshot2);
|
|
30741
31325
|
}
|
|
31326
|
+
if (format === "txt") {
|
|
31327
|
+
const targetSnapshot2 = params.data ? fillDatasetIntoDocSnapshot(params.snapshot, params.data) : params.snapshot;
|
|
31328
|
+
const plain = (targetSnapshot2.body?.dataStream ?? "").replace(/\u001D\u001C/g, " ").replace(/\r/g, "\n").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "").replace(/\n+$/g, "\n");
|
|
31329
|
+
return new TextEncoder().encode(plain);
|
|
31330
|
+
}
|
|
30742
31331
|
const targetSnapshot = params.data ? fillDatasetIntoDocSnapshot(params.snapshot, params.data) : params.snapshot;
|
|
30743
31332
|
return new TextEncoder().encode(JSON.stringify(targetSnapshot, null, 2));
|
|
30744
31333
|
};
|
|
30745
31334
|
const adapter = this._adapter$.getValue();
|
|
30746
|
-
const
|
|
30747
|
-
const effective = requested === "auto" ? adapter.exportDoc ? "server" : "browser" : requested;
|
|
31335
|
+
const effective = this._resolveEffectiveTarget("export", format, params.target);
|
|
30748
31336
|
if (effective === "server") {
|
|
30749
31337
|
if (!adapter.exportDoc) {
|
|
30750
31338
|
throw new DocIoTargetError(
|
|
30751
31339
|
"\u5F53\u524D\u672A\u914D\u7F6E\u670D\u52A1\u7AEF Word/PDF \u5BFC\u51FA\u63A5\u53E3\uFF08exportDoc\uFF09\uFF0C\u672A\u81EA\u52A8\u964D\u7EA7\u81F3\u6D4F\u89C8\u5668\u7AEF\uFF1B\u8BF7\u5148\u63A5\u5165\u670D\u52A1\u7AEF\u9002\u914D\u5668\u6216\u6539\u9009\u300C\u6D4F\u89C8\u5668\u5904\u7406\u300D"
|
|
30752
31340
|
);
|
|
30753
31341
|
}
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
31342
|
+
try {
|
|
31343
|
+
const raw = await adapter.exportDoc({
|
|
31344
|
+
unitId: params.unitId,
|
|
31345
|
+
snapshot: params.snapshot,
|
|
31346
|
+
format,
|
|
31347
|
+
data: params.data,
|
|
31348
|
+
pdfOptions: params.pdfOptions,
|
|
31349
|
+
defaultExport
|
|
31350
|
+
});
|
|
31351
|
+
return normalizeToUint8Array(raw);
|
|
31352
|
+
} catch (err) {
|
|
31353
|
+
if (err && typeof err === "object" && !err.suggestedFallback) {
|
|
31354
|
+
err.suggestedFallback = "browser";
|
|
31355
|
+
}
|
|
31356
|
+
throw err;
|
|
31357
|
+
}
|
|
30763
31358
|
}
|
|
30764
31359
|
try {
|
|
30765
31360
|
return await defaultExport();
|
|
@@ -30889,8 +31484,12 @@ var UniverDocsExtPlugin = class extends Plugin {
|
|
|
30889
31484
|
];
|
|
30890
31485
|
dependencies.forEach((dep) => this._injector.add(dep));
|
|
30891
31486
|
this._injector.get(IDocActionMacroService);
|
|
31487
|
+
const ioService = this._injector.get(IDocIoService);
|
|
30892
31488
|
if (this._config.io) {
|
|
30893
|
-
|
|
31489
|
+
ioService.setAdapter(this._config.io);
|
|
31490
|
+
}
|
|
31491
|
+
if (this._config.defaultIoTarget) {
|
|
31492
|
+
ioService.setDefaultIoTarget(this._config.defaultIoTarget);
|
|
30894
31493
|
}
|
|
30895
31494
|
if (this._config.aiCopilot) {
|
|
30896
31495
|
this._injector.get(IDocAiCopilotService).setAdapter(this._config.aiCopilot);
|
|
@@ -31054,6 +31653,7 @@ export {
|
|
|
31054
31653
|
DEFAULT_ENDNOTE_SETTINGS,
|
|
31055
31654
|
DEFAULT_FOOTNOTE_SETTINGS,
|
|
31056
31655
|
DOC_HYPERLINK_DEFAULT_COLOR,
|
|
31656
|
+
DOC_IO_CAPABILITY_FORMATS,
|
|
31057
31657
|
DOC_TRACK_DELETE_STYLE,
|
|
31058
31658
|
DOC_TRACK_INSERT_STYLE,
|
|
31059
31659
|
DeleteDocAreaCommand,
|
|
@@ -31479,6 +32079,7 @@ export {
|
|
|
31479
32079
|
spliceDocumentBodySpan,
|
|
31480
32080
|
spliceMultiParagraphBodySpan,
|
|
31481
32081
|
splitDocTableCellInSnapshot,
|
|
32082
|
+
stripDocEditorChromeForView,
|
|
31482
32083
|
stripSdtAffixes,
|
|
31483
32084
|
syncSnapshotAuxFields,
|
|
31484
32085
|
toControlSpecSnapshot,
|