@beyondwork/docx-react-component 1.0.122 → 1.0.123
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/api/public-types.cjs +318 -32
- package/dist/api/public-types.d.cts +2 -2
- package/dist/api/public-types.d.ts +2 -2
- package/dist/api/public-types.js +3 -3
- package/dist/api/v3.cjs +349 -62
- package/dist/api/v3.d.cts +3 -3
- package/dist/api/v3.d.ts +3 -3
- package/dist/api/v3.js +10 -10
- package/dist/{canonical-document-ByIqTd4s.d.cts → canonical-document-CG2TgAzj.d.cts} +1 -1
- package/dist/{canonical-document-ByIqTd4s.d.ts → canonical-document-CG2TgAzj.d.ts} +1 -1
- package/dist/{chunk-B4YHWFE3.js → chunk-32ZAOQ54.js} +1 -1
- package/dist/{chunk-QNGJRZ2D.js → chunk-4IPEZYQX.js} +1 -1
- package/dist/{chunk-3OFSP2IX.js → chunk-BOHHIVQ2.js} +3 -3
- package/dist/{chunk-EMDH4IQN.js → chunk-E5IBDE5E.js} +4 -3
- package/dist/{chunk-TFSXOIAI.js → chunk-FNWKE74J.js} +43 -3
- package/dist/{chunk-IT2DK3A7.js → chunk-H2YQKA55.js} +9 -7
- package/dist/{chunk-3TUQCHYT.js → chunk-H6IL5ABU.js} +47 -7
- package/dist/{chunk-GON2DNTE.js → chunk-HXHQA4BU.js} +1 -1
- package/dist/{chunk-3OHVK2D6.js → chunk-IR7QV2BX.js} +17 -1
- package/dist/{chunk-ZKSDVHGH.js → chunk-KOHQFZMM.js} +1 -1
- package/dist/{chunk-XVFENXLK.js → chunk-LGWNN3L2.js} +2 -2
- package/dist/{chunk-TMU7JMXX.js → chunk-MB7RJBSN.js} +9 -21
- package/dist/{chunk-UWDWGQH5.js → chunk-ML4A4WUN.js} +1 -1
- package/dist/{chunk-GZW2ERUO.js → chunk-N4VIXI2Z.js} +3 -3
- package/dist/{chunk-S4ANOS2M.js → chunk-NNPVA5VL.js} +2 -2
- package/dist/{chunk-QFU7ZOAD.js → chunk-PFYUJU3Q.js} +176 -36
- package/dist/{chunk-37SEJQ3G.js → chunk-RSYN6FTS.js} +2 -2
- package/dist/{chunk-OBCP6VTG.js → chunk-RWERZWHR.js} +1 -1
- package/dist/{chunk-UHQOUTAX.js → chunk-SGSJ4DQA.js} +377 -50
- package/dist/{chunk-PCXTMEGY.js → chunk-UHJLCPLU.js} +24 -14
- package/dist/{chunk-G3B2OBCZ.js → chunk-ZRHLLPSJ.js} +271 -26
- package/dist/compare.d.cts +1 -1
- package/dist/compare.d.ts +1 -1
- package/dist/core/commands/formatting-commands.d.cts +2 -2
- package/dist/core/commands/formatting-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.cjs +50 -9
- package/dist/core/commands/image-commands.d.cts +2 -2
- package/dist/core/commands/image-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.js +5 -5
- package/dist/core/commands/section-layout-commands.d.cts +2 -2
- package/dist/core/commands/section-layout-commands.d.ts +2 -2
- package/dist/core/commands/style-commands.d.cts +2 -2
- package/dist/core/commands/style-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.cjs +50 -9
- package/dist/core/commands/table-structure-commands.d.cts +2 -2
- package/dist/core/commands/table-structure-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.js +4 -4
- package/dist/core/commands/text-commands.cjs +66 -9
- package/dist/core/commands/text-commands.d.cts +3 -2
- package/dist/core/commands/text-commands.d.ts +3 -2
- package/dist/core/commands/text-commands.js +5 -5
- package/dist/core/selection/mapping.d.cts +2 -2
- package/dist/core/selection/mapping.d.ts +2 -2
- package/dist/core/state/editor-state.d.cts +2 -2
- package/dist/core/state/editor-state.d.ts +2 -2
- package/dist/index.cjs +1196 -197
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +278 -85
- package/dist/io/docx-session.cjs +10 -21
- package/dist/io/docx-session.d.cts +4 -4
- package/dist/io/docx-session.d.ts +4 -4
- package/dist/io/docx-session.js +4 -4
- package/dist/legal.cjs +8 -20
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +3 -3
- package/dist/{loader-BF8ju_LK.d.ts → loader-D9KCtj4m.d.cts} +4 -22
- package/dist/{loader-g54WRvj1.d.cts → loader-D9y4ZRjj.d.ts} +4 -22
- package/dist/{public-types-Dl1jiWjk.d.ts → public-types-CNnMHZM9.d.ts} +263 -213
- package/dist/{public-types-D_y4Ptcj.d.cts → public-types-DajNGKV4.d.cts} +263 -213
- package/dist/public-types.cjs +318 -32
- package/dist/public-types.d.cts +2 -2
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.js +3 -3
- package/dist/runtime/collab.d.cts +3 -3
- package/dist/runtime/collab.d.ts +3 -3
- package/dist/runtime/document-runtime.cjs +752 -77
- package/dist/runtime/document-runtime.d.cts +2 -2
- package/dist/runtime/document-runtime.d.ts +2 -2
- package/dist/runtime/document-runtime.js +14 -14
- package/dist/{session-C1EPAkcI.d.ts → session-DEmaOEjA.d.ts} +3 -3
- package/dist/{session-D15QOO0Q.d.cts → session-DyQGlryH.d.cts} +3 -3
- package/dist/session.cjs +12 -618
- package/dist/session.d.cts +5 -5
- package/dist/session.d.ts +5 -5
- package/dist/session.js +7 -9
- package/dist/tailwind.cjs +489 -63
- package/dist/tailwind.d.cts +2 -2
- package/dist/tailwind.d.ts +2 -2
- package/dist/tailwind.js +7 -7
- package/dist/{types-BoSRp2Vg.d.cts → types-CxE1aZiv.d.cts} +2 -2
- package/dist/{types-DEvRwq9C.d.ts → types-DjJNaE9c.d.ts} +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
- package/dist/ui-tailwind/theme/tokens.css +387 -0
- package/dist/ui-tailwind.cjs +489 -63
- package/dist/ui-tailwind.d.cts +3 -3
- package/dist/ui-tailwind.d.ts +3 -3
- package/dist/ui-tailwind.js +7 -7
- package/package.json +7 -3
package/dist/api/v3.cjs
CHANGED
|
@@ -12869,12 +12869,13 @@ function buildBlockCacheSignature(context, blockIndex) {
|
|
|
12869
12869
|
owner?.targetKey ?? ""
|
|
12870
12870
|
].join("|");
|
|
12871
12871
|
}
|
|
12872
|
-
function collectEditableTargetsInBlocks(blocks, context, targets, cache) {
|
|
12872
|
+
function collectEditableTargetsInBlocks(blocks, context, targets, cache, blockIndexOffset = 0) {
|
|
12873
12873
|
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
12874
12874
|
const block = blocks[blockIndex];
|
|
12875
12875
|
if (!block) continue;
|
|
12876
|
-
const
|
|
12877
|
-
const
|
|
12876
|
+
const absoluteBlockIndex = blockIndex + blockIndexOffset;
|
|
12877
|
+
const blockPath = `${context.basePath}/block[${absoluteBlockIndex}]`;
|
|
12878
|
+
const signature = cache !== void 0 ? buildBlockCacheSignature(context, absoluteBlockIndex) : "";
|
|
12878
12879
|
if (cache !== void 0) {
|
|
12879
12880
|
const cached = cache.get(block);
|
|
12880
12881
|
if (cached !== void 0 && cached.blockPath === blockPath && cached.signature === signature) {
|
|
@@ -18404,7 +18405,6 @@ function resolveContentType(path, contentTypes) {
|
|
|
18404
18405
|
// src/io/ooxml/parse-bookmark-references.ts
|
|
18405
18406
|
var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
|
|
18406
18407
|
var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
|
|
18407
|
-
var SIMPLE_FIELD_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*"([^"]*)"/gi;
|
|
18408
18408
|
var TOC_FIELD_RE = /\bTOC\b/;
|
|
18409
18409
|
var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
|
|
18410
18410
|
var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
|
|
@@ -18423,14 +18423,12 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
18423
18423
|
}
|
|
18424
18424
|
INSTR_TEXT_RE.lastIndex = 0;
|
|
18425
18425
|
while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
if (scanInstructionForRetainedBookmarks(m[1] ?? "", retained)) {
|
|
18433
|
-
retainAllToc = true;
|
|
18426
|
+
const instrText = m[1] ?? "";
|
|
18427
|
+
if (TOC_FIELD_RE.test(instrText)) retainAllToc = true;
|
|
18428
|
+
REFLIKE_FIELD_RE.lastIndex = 0;
|
|
18429
|
+
let r;
|
|
18430
|
+
while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
|
|
18431
|
+
if (r[1]) retained.add(r[1]);
|
|
18434
18432
|
}
|
|
18435
18433
|
}
|
|
18436
18434
|
retainRevisionBoundedBookmarks(documentXml, retained);
|
|
@@ -18440,15 +18438,6 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
18440
18438
|
retainAll
|
|
18441
18439
|
};
|
|
18442
18440
|
}
|
|
18443
|
-
function scanInstructionForRetainedBookmarks(instruction, retained) {
|
|
18444
|
-
const hasTocField = TOC_FIELD_RE.test(instruction);
|
|
18445
|
-
REFLIKE_FIELD_RE.lastIndex = 0;
|
|
18446
|
-
let r;
|
|
18447
|
-
while ((r = REFLIKE_FIELD_RE.exec(instruction)) !== null) {
|
|
18448
|
-
if (r[1]) retained.add(r[1]);
|
|
18449
|
-
}
|
|
18450
|
-
return hasTocField;
|
|
18451
|
-
}
|
|
18452
18441
|
function retainRevisionBoundedBookmarks(documentXml, retained) {
|
|
18453
18442
|
const starts = /* @__PURE__ */ new Map();
|
|
18454
18443
|
BOOKMARK_START_RE.lastIndex = 0;
|
|
@@ -21952,7 +21941,7 @@ var SAFE_TABLE_FIELD_FAMILIES = /* @__PURE__ */ new Set([
|
|
|
21952
21941
|
"FORMULA"
|
|
21953
21942
|
]);
|
|
21954
21943
|
var RISKY_TABLE_MARKUP_RE = /<w:(ins|del|moveFrom|moveTo|rPrChange|pPrChange|tblPrChange|trPrChange|tcPrChange|sectPrChange|cellIns|cellDel|cellMerge|smartTag)\b/;
|
|
21955
|
-
var
|
|
21944
|
+
var SIMPLE_FIELD_INSTR_RE = /\bw:instr="([^"]*)"/g;
|
|
21956
21945
|
var COMPLEX_FIELD_TOKEN_RE = /<(?:\w+:)?fldChar\b[^>]*?(?:\w+:)?fldCharType="(begin|separate|end)"[^>]*?(?:\/>|>[\s\S]*?<\/(?:\w+:)?fldChar>)|<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gu;
|
|
21957
21946
|
function decodeXmlEntities5(text) {
|
|
21958
21947
|
return text.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
@@ -21993,7 +21982,7 @@ function isSafeTableFieldInstruction(instruction) {
|
|
|
21993
21982
|
}
|
|
21994
21983
|
function tableRequiresOpaquePreservation(rawXml) {
|
|
21995
21984
|
if (RISKY_TABLE_MARKUP_RE.test(rawXml)) return true;
|
|
21996
|
-
const simpleInstructions = [...rawXml.matchAll(
|
|
21985
|
+
const simpleInstructions = [...rawXml.matchAll(SIMPLE_FIELD_INSTR_RE)].map(
|
|
21997
21986
|
(match) => match[1] ?? ""
|
|
21998
21987
|
);
|
|
21999
21988
|
const complexInstructions = extractComplexFieldInstructionsFromRaw(rawXml);
|
|
@@ -27773,7 +27762,8 @@ function parseCommentDefinitions(commentsXml, extensions, durableIds) {
|
|
|
27773
27762
|
const createdAt = normalizeImportedTimestamp2(
|
|
27774
27763
|
readStringAttr(child, "w:date")
|
|
27775
27764
|
);
|
|
27776
|
-
const
|
|
27765
|
+
const rawInitials = readStringAttr(child, "w:initials");
|
|
27766
|
+
const initials = rawInitials !== void 0 && rawInitials.trim().length > 0 ? rawInitials : void 0;
|
|
27777
27767
|
const paragraphNodes = child.children.filter(
|
|
27778
27768
|
(node) => node.type === "element" && localName(node.name) === "p"
|
|
27779
27769
|
);
|
|
@@ -32546,7 +32536,7 @@ async function computeStructuralHash(blocks) {
|
|
|
32546
32536
|
|
|
32547
32537
|
// src/runtime/layout/layout-engine-version.ts
|
|
32548
32538
|
var LAYOUT_ENGINE_VERSION = 87;
|
|
32549
|
-
var LAYCACHE_SCHEMA_VERSION =
|
|
32539
|
+
var LAYCACHE_SCHEMA_VERSION = 11;
|
|
32550
32540
|
|
|
32551
32541
|
// src/runtime/prerender/customxml-cache.ts
|
|
32552
32542
|
var LAYCACHE_NAMESPACE_NAME = "laycache";
|
|
@@ -34847,7 +34837,7 @@ function deriveScopeEditableTargetEvidence(document2, scope, entry, options = {}
|
|
|
34847
34837
|
facts.push(projectWorkflowBlockerFact(fact));
|
|
34848
34838
|
factsByTargetKey.set(fact.targetKey, facts);
|
|
34849
34839
|
}
|
|
34850
|
-
const entries = collectEditableTargetRefs(document2).map((target) => {
|
|
34840
|
+
const entries = collectEditableTargetRefs(document2, options.editableTargetCache).map((target) => {
|
|
34851
34841
|
const relation = relationForTarget(target, scope, entry);
|
|
34852
34842
|
if (!relation) return null;
|
|
34853
34843
|
const workflowBlockers = Object.freeze(
|
|
@@ -40507,7 +40497,8 @@ function composeEvidence(inputs) {
|
|
|
40507
40497
|
scope,
|
|
40508
40498
|
entry,
|
|
40509
40499
|
{
|
|
40510
|
-
...inputs.editableTargetBlockerFacts ? { workflowBlockerFacts: inputs.editableTargetBlockerFacts } : {}
|
|
40500
|
+
...inputs.editableTargetBlockerFacts ? { workflowBlockerFacts: inputs.editableTargetBlockerFacts } : {},
|
|
40501
|
+
...inputs.editableTargetCache ? { editableTargetCache: inputs.editableTargetCache } : {}
|
|
40511
40502
|
}
|
|
40512
40503
|
) : void 0;
|
|
40513
40504
|
const contentControls = deriveScopeContentControlEvidence(document2, selfRange);
|
|
@@ -40596,7 +40587,8 @@ function compileScopeBundle(scope, inputs) {
|
|
|
40596
40587
|
...inputs.layout ? { layout: inputs.layout } : {},
|
|
40597
40588
|
...inputs.adjacentGeometry ? { adjacentGeometry: inputs.adjacentGeometry } : {},
|
|
40598
40589
|
...inputs.tableCellTextRange ? { tableCellTextRange: inputs.tableCellTextRange } : {},
|
|
40599
|
-
...inputs.editableTargetBlockerFacts ? { editableTargetBlockerFacts: inputs.editableTargetBlockerFacts } : {}
|
|
40590
|
+
...inputs.editableTargetBlockerFacts ? { editableTargetBlockerFacts: inputs.editableTargetBlockerFacts } : {},
|
|
40591
|
+
...inputs.editableTargetCache ? { editableTargetCache: inputs.editableTargetCache } : {}
|
|
40600
40592
|
});
|
|
40601
40593
|
return {
|
|
40602
40594
|
scope,
|
|
@@ -42585,7 +42577,7 @@ function createScopeCompilerService(runtime) {
|
|
|
42585
42577
|
const interactionGuard = runtime.getInteractionGuardSnapshot?.();
|
|
42586
42578
|
const activeStory = runtime.getActiveStory?.();
|
|
42587
42579
|
const editableTargetBlockerFacts = deriveWorkflowEditableTargetBlockerFacts({
|
|
42588
|
-
targets: collectEditableTargetRefs(document2),
|
|
42580
|
+
targets: collectEditableTargetRefs(document2, runtime.getEditableTargetCache?.()),
|
|
42589
42581
|
...interactionGuard ? { guard: interactionGuard } : {},
|
|
42590
42582
|
...runtime.getProtectionSnapshot ? { protectionSnapshot: runtime.getProtectionSnapshot() } : {},
|
|
42591
42583
|
...activeStory ? { activeStoryKey: storyKeyForEditableTarget(activeStory) } : {}
|
|
@@ -42596,6 +42588,7 @@ function createScopeCompilerService(runtime) {
|
|
|
42596
42588
|
runtime.getRenderSnapshot?.()
|
|
42597
42589
|
)
|
|
42598
42590
|
}) : void 0;
|
|
42591
|
+
const editableTargetCache = runtime.getEditableTargetCache?.();
|
|
42599
42592
|
return compileScopeBundleById(scopeId, {
|
|
42600
42593
|
document: document2,
|
|
42601
42594
|
...overlay ? { overlay } : {},
|
|
@@ -42605,7 +42598,8 @@ function createScopeCompilerService(runtime) {
|
|
|
42605
42598
|
editableTargetBlockerFacts,
|
|
42606
42599
|
...runtime.geometry ? { geometry: runtime.geometry } : {},
|
|
42607
42600
|
...layout ? { layout } : {},
|
|
42608
|
-
tableCellTextRange
|
|
42601
|
+
tableCellTextRange,
|
|
42602
|
+
...editableTargetCache ? { editableTargetCache } : {}
|
|
42609
42603
|
});
|
|
42610
42604
|
},
|
|
42611
42605
|
buildReplacementScope(targetHandle, input) {
|
|
@@ -43938,6 +43932,8 @@ function toV3PageLocalStoryObject(object) {
|
|
|
43938
43932
|
heightTwips: object.extentTwips.heightTwips
|
|
43939
43933
|
}
|
|
43940
43934
|
} : {},
|
|
43935
|
+
...object.anchorRectTwips ? { anchorRectTwips: cloneRect2(object.anchorRectTwips) } : {},
|
|
43936
|
+
...object.textBoxBody ? { textBoxBody: object.textBoxBody } : {},
|
|
43941
43937
|
...object.relationshipIds ? { relationshipIds: [...object.relationshipIds] } : {},
|
|
43942
43938
|
...object.mediaIds ? { mediaIds: [...object.mediaIds] } : {},
|
|
43943
43939
|
preserveOnly: object.preserveOnly,
|
|
@@ -46481,6 +46477,8 @@ function createSurfaceBlock(block, document2, cursor, counters, formattingContex
|
|
|
46481
46477
|
formattingContext,
|
|
46482
46478
|
promoteSecondaryStoryTextBoxes,
|
|
46483
46479
|
cullBuild,
|
|
46480
|
+
editableTargetsByBlockPath,
|
|
46481
|
+
blockPath,
|
|
46484
46482
|
blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0
|
|
46485
46483
|
);
|
|
46486
46484
|
}
|
|
@@ -46887,7 +46885,7 @@ function getRecursableSdtBlockedReasonCode(block) {
|
|
|
46887
46885
|
].filter(Boolean).join(" ").toLowerCase();
|
|
46888
46886
|
return searchText.includes("table of contents") || /\btoc\b/u.test(searchText) ? "workflow_preserve_only" : null;
|
|
46889
46887
|
}
|
|
46890
|
-
function createParagraphBlock(paragraphIndex, paragraph, document2, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTarget) {
|
|
46888
|
+
function createParagraphBlock(paragraphIndex, paragraph, document2, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, blockPath, editableTarget) {
|
|
46891
46889
|
const themeResolver = formattingContext.theme;
|
|
46892
46890
|
const effectiveNumbering = formattingContext.resolveEffectiveParagraphNumbering(paragraph);
|
|
46893
46891
|
let resolvedNumbering = null;
|
|
@@ -46952,6 +46950,8 @@ function createParagraphBlock(paragraphIndex, paragraph, document2, start, forma
|
|
|
46952
46950
|
document2,
|
|
46953
46951
|
cursor,
|
|
46954
46952
|
promoteSecondaryStoryTextBoxes,
|
|
46953
|
+
blockPath !== void 0 ? `${blockPath}/inline[${childIndex}]` : void 0,
|
|
46954
|
+
editableTargetsByBlockPath,
|
|
46955
46955
|
void 0,
|
|
46956
46956
|
cullBuild,
|
|
46957
46957
|
themeResolver,
|
|
@@ -47008,7 +47008,7 @@ function isVisibleTocResultInline(node) {
|
|
|
47008
47008
|
return false;
|
|
47009
47009
|
}
|
|
47010
47010
|
}
|
|
47011
|
-
function appendInlineSegments(paragraph, node, document2, start, promoteSecondaryStoryTextBoxes, hyperlinkHref, cullBuild = false, themeResolver, formattingContext) {
|
|
47011
|
+
function appendInlineSegments(paragraph, node, document2, start, promoteSecondaryStoryTextBoxes, inlinePath, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, hyperlinkHref, cullBuild = false, themeResolver, formattingContext) {
|
|
47012
47012
|
switch (node.type) {
|
|
47013
47013
|
case "text": {
|
|
47014
47014
|
const cloned = node.marks ? cloneMarks(node.marks) : { marks: [] };
|
|
@@ -47061,13 +47061,16 @@ function appendInlineSegments(paragraph, node, document2, start, promoteSecondar
|
|
|
47061
47061
|
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
47062
47062
|
case "hyperlink": {
|
|
47063
47063
|
let cursor = start;
|
|
47064
|
-
for (
|
|
47064
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex += 1) {
|
|
47065
|
+
const child = node.children[childIndex];
|
|
47065
47066
|
const result = appendInlineSegments(
|
|
47066
47067
|
paragraph,
|
|
47067
47068
|
child,
|
|
47068
47069
|
document2,
|
|
47069
47070
|
cursor,
|
|
47070
47071
|
promoteSecondaryStoryTextBoxes,
|
|
47072
|
+
inlinePath !== void 0 ? `${inlinePath}/child[${childIndex}]` : void 0,
|
|
47073
|
+
editableTargetsByBlockPath,
|
|
47071
47074
|
node.href,
|
|
47072
47075
|
cullBuild,
|
|
47073
47076
|
themeResolver,
|
|
@@ -47126,6 +47129,33 @@ function appendInlineSegments(paragraph, node, document2, start, promoteSecondar
|
|
|
47126
47129
|
if (isMicrosoftSensitivityLabelShape(node)) {
|
|
47127
47130
|
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
47128
47131
|
}
|
|
47132
|
+
if (node.isTextBox && node.txbxBlocks !== void 0) {
|
|
47133
|
+
const txbxTextSegment = extractTxbxFirstTextSegment(node.txbxBlocks);
|
|
47134
|
+
const txbxText = txbxTextSegment?.text ?? node.text;
|
|
47135
|
+
const txbxBody = surfaceTextBoxBodyFromShape(
|
|
47136
|
+
node,
|
|
47137
|
+
void 0,
|
|
47138
|
+
inlinePath,
|
|
47139
|
+
editableTargetsByBlockPath
|
|
47140
|
+
);
|
|
47141
|
+
paragraph.segments.push({
|
|
47142
|
+
segmentId: `${paragraph.blockId}-segment-${paragraph.segments.length}`,
|
|
47143
|
+
kind: "shape",
|
|
47144
|
+
from: start,
|
|
47145
|
+
to: start + 1,
|
|
47146
|
+
label: "Text box",
|
|
47147
|
+
detail: createShapeDetail(node),
|
|
47148
|
+
...node.geometry !== void 0 ? { geometry: node.geometry } : {},
|
|
47149
|
+
isTextBox: true,
|
|
47150
|
+
...node.textBoxBody ? { textBoxBody: node.textBoxBody } : {},
|
|
47151
|
+
...node.preserveOnlyObject ? { preserveOnlyObject: surfacePreserveOnlyObject(node.preserveOnlyObject) } : {},
|
|
47152
|
+
...txbxText ? { txbxText } : {},
|
|
47153
|
+
...txbxBody ? { txbxBody } : {},
|
|
47154
|
+
...txbxTextSegment?.marks && txbxTextSegment.marks.length > 0 ? { txbxMarks: txbxTextSegment.marks } : {},
|
|
47155
|
+
...txbxTextSegment?.markAttrs ? { txbxMarkAttrs: txbxTextSegment.markAttrs } : {}
|
|
47156
|
+
});
|
|
47157
|
+
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
47158
|
+
}
|
|
47129
47159
|
if (promoteSecondaryStoryTextBoxes && node.isTextBox && node.text) {
|
|
47130
47160
|
return appendTextBoxSegment(
|
|
47131
47161
|
paragraph,
|
|
@@ -47185,7 +47215,7 @@ function appendInlineSegments(paragraph, node, document2, start, promoteSecondar
|
|
|
47185
47215
|
const anchor = surfaceAnchorFromGeometry(node.anchor);
|
|
47186
47216
|
const txbxTextSegment = c.isTextBox ? extractTxbxFirstTextSegment(c.txbxBlocks) : void 0;
|
|
47187
47217
|
const txbxText = txbxTextSegment?.text ?? (c.isTextBox ? c.text : void 0);
|
|
47188
|
-
const txbxBody = c.isTextBox ? surfaceTextBoxBodyFromShape(c, node.sourceRef) : void 0;
|
|
47218
|
+
const txbxBody = c.isTextBox ? surfaceTextBoxBodyFromShape(c, node.sourceRef, inlinePath, editableTargetsByBlockPath) : void 0;
|
|
47189
47219
|
const surfaceFill = c.fill;
|
|
47190
47220
|
paragraph.segments.push({
|
|
47191
47221
|
segmentId: `${paragraph.blockId}-segment-${paragraph.segments.length}`,
|
|
@@ -47362,13 +47392,16 @@ function appendInlineSegments(paragraph, node, document2, start, promoteSecondar
|
|
|
47362
47392
|
const refHyperlinkHref = (node.fieldFamily === "REF" || node.fieldFamily === "PAGEREF" || node.fieldFamily === "NOTEREF") && node.switches?.hyperlink === true && node.fieldTarget ? `#${node.fieldTarget}` : void 0;
|
|
47363
47393
|
let cursor = start;
|
|
47364
47394
|
const lockedIds = [];
|
|
47365
|
-
for (
|
|
47395
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex += 1) {
|
|
47396
|
+
const child = node.children[childIndex];
|
|
47366
47397
|
const result = appendInlineSegments(
|
|
47367
47398
|
paragraph,
|
|
47368
47399
|
child,
|
|
47369
47400
|
document2,
|
|
47370
47401
|
cursor,
|
|
47371
47402
|
promoteSecondaryStoryTextBoxes,
|
|
47403
|
+
inlinePath !== void 0 ? `${inlinePath}/child[${childIndex}]` : void 0,
|
|
47404
|
+
editableTargetsByBlockPath,
|
|
47372
47405
|
refHyperlinkHref ?? hyperlinkHref,
|
|
47373
47406
|
cullBuild,
|
|
47374
47407
|
themeResolver,
|
|
@@ -47615,7 +47648,7 @@ function extractTxbxFirstTextSegment(blocks) {
|
|
|
47615
47648
|
}
|
|
47616
47649
|
return void 0;
|
|
47617
47650
|
}
|
|
47618
|
-
function surfaceTextBoxBodyFromShape(shape, sourceRef) {
|
|
47651
|
+
function surfaceTextBoxBodyFromShape(shape, sourceRef, inlinePath, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH) {
|
|
47619
47652
|
if (!shape.isTextBox && shape.txbxContentXml === void 0 && shape.txbxBlocks === void 0) {
|
|
47620
47653
|
return void 0;
|
|
47621
47654
|
}
|
|
@@ -47641,9 +47674,12 @@ function surfaceTextBoxBodyFromShape(shape, sourceRef) {
|
|
|
47641
47674
|
(run, inlineIndex) => surfaceTextBoxRunFromLegacyRun(run, inlineIndex)
|
|
47642
47675
|
) ?? [];
|
|
47643
47676
|
const text = runs.map((run) => run.text ?? "").join("");
|
|
47677
|
+
const blockPath = inlinePath !== void 0 ? `${inlinePath}/txbx/block[${blockIndex}]` : void 0;
|
|
47678
|
+
const editableTarget = blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0;
|
|
47644
47679
|
return [{
|
|
47645
47680
|
...block.sourceRef !== void 0 ? { sourceRef: block.sourceRef } : {},
|
|
47646
47681
|
blockIndex,
|
|
47682
|
+
...editableTarget !== void 0 ? { editableTarget } : {},
|
|
47647
47683
|
text,
|
|
47648
47684
|
textLength: Array.from(text).length,
|
|
47649
47685
|
...block.borders !== void 0 ? { borders: block.borders } : {},
|
|
@@ -50954,6 +50990,7 @@ function buildPageGraph(inputOrPages, sectionsArg, storiesArg) {
|
|
|
50954
50990
|
regions,
|
|
50955
50991
|
divergences: frameDivergences,
|
|
50956
50992
|
subParts: input.subParts,
|
|
50993
|
+
anchors: input.anchors,
|
|
50957
50994
|
pageFieldCounts
|
|
50958
50995
|
});
|
|
50959
50996
|
const divergences = builtFrame.divergences;
|
|
@@ -51120,6 +51157,7 @@ function buildPageFrame(input) {
|
|
|
51120
51157
|
stories: input.stories,
|
|
51121
51158
|
regions,
|
|
51122
51159
|
subParts: input.subParts,
|
|
51160
|
+
anchors: input.anchors,
|
|
51123
51161
|
pageFieldCounts: input.pageFieldCounts
|
|
51124
51162
|
});
|
|
51125
51163
|
const divergences = [...input.divergences, ...pageLocalStoryResult.divergences];
|
|
@@ -51157,6 +51195,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
51157
51195
|
input.stories.header,
|
|
51158
51196
|
input.regions.header,
|
|
51159
51197
|
findHeaderFooterPart(input.subParts?.headers, input.stories.header),
|
|
51198
|
+
input.anchors,
|
|
51160
51199
|
input.pageFieldCounts
|
|
51161
51200
|
);
|
|
51162
51201
|
instances.push(built.instance);
|
|
@@ -51173,6 +51212,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
51173
51212
|
input.stories.footer,
|
|
51174
51213
|
input.regions.footer,
|
|
51175
51214
|
findHeaderFooterPart(input.subParts?.footers, input.stories.footer),
|
|
51215
|
+
input.anchors,
|
|
51176
51216
|
input.pageFieldCounts
|
|
51177
51217
|
);
|
|
51178
51218
|
instances.push(built.instance);
|
|
@@ -51180,7 +51220,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
51180
51220
|
}
|
|
51181
51221
|
return { instances, divergences };
|
|
51182
51222
|
}
|
|
51183
|
-
function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, displayPageNumber, layout, target, region, source, pageFieldCounts) {
|
|
51223
|
+
function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, displayPageNumber, layout, target, region, source, anchors, pageFieldCounts) {
|
|
51184
51224
|
const measuredFrameHeightTwips = region?.heightTwips ?? 0;
|
|
51185
51225
|
const sectionPart = target.sectionIndex === void 0 ? "section-unknown" : `section-${target.sectionIndex}`;
|
|
51186
51226
|
const instanceId = `${frameId}:${target.kind}:${target.variant}:${target.relationshipId}`;
|
|
@@ -51201,7 +51241,9 @@ function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, d
|
|
|
51201
51241
|
kind: target.kind,
|
|
51202
51242
|
variant: target.variant,
|
|
51203
51243
|
relationshipId: target.relationshipId,
|
|
51204
|
-
region
|
|
51244
|
+
region,
|
|
51245
|
+
storyBasePath: `${target.kind}:${source.partPath ?? `word/${target.kind}${target.relationshipId}.xml`}`,
|
|
51246
|
+
anchorsByInlinePath: buildAnchorsByInlinePath(anchors)
|
|
51205
51247
|
}) : { objects: [], divergences: [] };
|
|
51206
51248
|
const signature = buildPageLocalStorySignature({
|
|
51207
51249
|
kind: target.kind,
|
|
@@ -51255,6 +51297,23 @@ function buildPageLocalStorySignature(input) {
|
|
|
51255
51297
|
object.anchorRectTwips?.yTwips ?? "",
|
|
51256
51298
|
object.anchorRectTwips?.widthTwips ?? "",
|
|
51257
51299
|
object.anchorRectTwips?.heightTwips ?? "",
|
|
51300
|
+
object.textBoxBody?.bodyKey ?? "",
|
|
51301
|
+
object.textBoxBody?.status ?? "",
|
|
51302
|
+
object.textBoxBody?.unavailableReason ?? "",
|
|
51303
|
+
object.textBoxBody?.contentRectTwips?.xTwips ?? "",
|
|
51304
|
+
object.textBoxBody?.contentRectTwips?.yTwips ?? "",
|
|
51305
|
+
object.textBoxBody?.contentRectTwips?.widthTwips ?? "",
|
|
51306
|
+
object.textBoxBody?.contentRectTwips?.heightTwips ?? "",
|
|
51307
|
+
object.textBoxBody?.paragraphs.map(
|
|
51308
|
+
(paragraph) => [
|
|
51309
|
+
paragraph.paragraphKey,
|
|
51310
|
+
paragraph.rectTwips?.xTwips ?? "",
|
|
51311
|
+
paragraph.rectTwips?.yTwips ?? "",
|
|
51312
|
+
paragraph.rectTwips?.widthTwips ?? "",
|
|
51313
|
+
paragraph.rectTwips?.heightTwips ?? "",
|
|
51314
|
+
paragraph.unavailableReason ?? ""
|
|
51315
|
+
].join("/")
|
|
51316
|
+
).join(",") ?? "",
|
|
51258
51317
|
object.relationshipIds?.join(",") ?? "",
|
|
51259
51318
|
object.mediaIds?.join(",") ?? "",
|
|
51260
51319
|
object.wrapMode ?? "",
|
|
@@ -51399,6 +51458,10 @@ function truncatePageLocalStoryPreview(text) {
|
|
|
51399
51458
|
if (text.length <= MAX_PAGE_LOCAL_STORY_PREVIEW_CHARS) return text;
|
|
51400
51459
|
return `${text.slice(0, MAX_PAGE_LOCAL_STORY_PREVIEW_CHARS - 1).trimEnd()}\u2026`;
|
|
51401
51460
|
}
|
|
51461
|
+
function buildAnchorsByInlinePath(anchors) {
|
|
51462
|
+
if (!anchors || anchors.length === 0) return void 0;
|
|
51463
|
+
return new Map(anchors.map((anchor) => [anchor.inlinePath, anchor]));
|
|
51464
|
+
}
|
|
51402
51465
|
function collectStoryAnchoredObjects(blocks, context) {
|
|
51403
51466
|
const objects = [];
|
|
51404
51467
|
const divergences = [];
|
|
@@ -51442,26 +51505,45 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
51442
51505
|
});
|
|
51443
51506
|
ordinal += 1;
|
|
51444
51507
|
};
|
|
51445
|
-
const
|
|
51508
|
+
const visitBlocks = (blocksToVisit, basePath) => {
|
|
51509
|
+
for (let blockIndex = 0; blockIndex < blocksToVisit.length; blockIndex += 1) {
|
|
51510
|
+
const block = blocksToVisit[blockIndex];
|
|
51511
|
+
if (!block) continue;
|
|
51512
|
+
visitBlock(block, `${basePath}/block[${blockIndex}]`);
|
|
51513
|
+
}
|
|
51514
|
+
};
|
|
51515
|
+
const visitBlock = (block, blockPath) => {
|
|
51446
51516
|
switch (block.type) {
|
|
51447
51517
|
case "paragraph":
|
|
51448
|
-
|
|
51518
|
+
visitInlines(block.children, blockPath, `${blockPath}/inline`);
|
|
51449
51519
|
break;
|
|
51450
51520
|
case "table":
|
|
51451
|
-
for (
|
|
51452
|
-
|
|
51453
|
-
|
|
51521
|
+
for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {
|
|
51522
|
+
const row = block.rows[rowIndex];
|
|
51523
|
+
if (!row) continue;
|
|
51524
|
+
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
51525
|
+
const cell = row.cells[cellIndex];
|
|
51526
|
+
if (!cell) continue;
|
|
51527
|
+
visitBlocks(cell.children, `${blockPath}/row[${rowIndex}]/cell[${cellIndex}]`);
|
|
51454
51528
|
}
|
|
51455
51529
|
}
|
|
51456
51530
|
break;
|
|
51457
51531
|
case "sdt":
|
|
51458
|
-
|
|
51532
|
+
case "custom_xml":
|
|
51533
|
+
visitBlocks(block.children, blockPath);
|
|
51459
51534
|
break;
|
|
51460
51535
|
default:
|
|
51461
51536
|
break;
|
|
51462
51537
|
}
|
|
51463
51538
|
};
|
|
51464
|
-
const
|
|
51539
|
+
const visitInlines = (inlines, blockPath, basePath) => {
|
|
51540
|
+
for (let inlineIndex = 0; inlineIndex < inlines.length; inlineIndex += 1) {
|
|
51541
|
+
const inline = inlines[inlineIndex];
|
|
51542
|
+
if (!inline) continue;
|
|
51543
|
+
visitInline(inline, blockPath, `${basePath}[${inlineIndex}]`);
|
|
51544
|
+
}
|
|
51545
|
+
};
|
|
51546
|
+
const visitInline = (inline, blockPath, inlinePath) => {
|
|
51465
51547
|
switch (inline.type) {
|
|
51466
51548
|
case "image": {
|
|
51467
51549
|
pushObject({
|
|
@@ -51482,17 +51564,27 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
51482
51564
|
inline.anchor.extent.widthEmu,
|
|
51483
51565
|
inline.anchor.extent.heightEmu
|
|
51484
51566
|
);
|
|
51567
|
+
const anchorRectTwips = resolveObjectAnchorRectTwips(
|
|
51568
|
+
context.region,
|
|
51569
|
+
extentTwips,
|
|
51570
|
+
inline.anchor.positionH,
|
|
51571
|
+
inline.anchor.positionV
|
|
51572
|
+
);
|
|
51573
|
+
const canonicalAnchor = context.anchorsByInlinePath?.get(inlinePath);
|
|
51574
|
+
const textBoxBody = buildDrawingFrameTextBoxBodyFacts(
|
|
51575
|
+
inline,
|
|
51576
|
+
canonicalAnchor,
|
|
51577
|
+
inlinePath,
|
|
51578
|
+
display,
|
|
51579
|
+
anchorRectTwips
|
|
51580
|
+
);
|
|
51485
51581
|
pushObject({
|
|
51486
51582
|
objectId: getDrawingFrameObjectId(inline, context.storyKey, ordinal),
|
|
51487
51583
|
sourceType: "drawing-frame",
|
|
51488
51584
|
display,
|
|
51489
51585
|
extentTwips,
|
|
51490
|
-
anchorRectTwips
|
|
51491
|
-
|
|
51492
|
-
extentTwips,
|
|
51493
|
-
inline.anchor.positionH,
|
|
51494
|
-
inline.anchor.positionV
|
|
51495
|
-
),
|
|
51586
|
+
anchorRectTwips,
|
|
51587
|
+
...textBoxBody ? { textBoxBody } : {},
|
|
51496
51588
|
...relationshipIds.length > 0 ? { relationshipIds } : {},
|
|
51497
51589
|
...inline.content.type === "picture" && inline.content.mediaId ? { mediaIds: [inline.content.mediaId] } : {},
|
|
51498
51590
|
preserveOnly: Boolean(preserveHint),
|
|
@@ -51500,7 +51592,7 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
51500
51592
|
wrapMode: inline.anchor.wrapMode
|
|
51501
51593
|
});
|
|
51502
51594
|
if (inline.content.type === "shape") {
|
|
51503
|
-
|
|
51595
|
+
visitBlocks(inline.content.txbxBlocks ?? [], `${inlinePath}/txbx`);
|
|
51504
51596
|
}
|
|
51505
51597
|
break;
|
|
51506
51598
|
}
|
|
@@ -51527,10 +51619,11 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
51527
51619
|
} : {},
|
|
51528
51620
|
...preserveHint?.relationshipIds ? { relationshipIds: [...preserveHint.relationshipIds] } : {},
|
|
51529
51621
|
preserveOnly: Boolean(preserveHint),
|
|
51530
|
-
...preserveHint ? { preserveHint } : {}
|
|
51622
|
+
...preserveHint ? { preserveHint } : {},
|
|
51623
|
+
...inline.type === "vml_shape" && inline.text ? { textBoxBody: buildUnsupportedVmlTextBoxFacts(inline, inlinePath) } : {}
|
|
51531
51624
|
});
|
|
51532
51625
|
if (inline.type === "shape") {
|
|
51533
|
-
|
|
51626
|
+
visitBlocks(inline.txbxBlocks ?? [], `${inlinePath}/txbx`);
|
|
51534
51627
|
}
|
|
51535
51628
|
break;
|
|
51536
51629
|
}
|
|
@@ -51552,16 +51645,16 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
51552
51645
|
});
|
|
51553
51646
|
break;
|
|
51554
51647
|
case "field":
|
|
51555
|
-
|
|
51648
|
+
visitInlines(inline.children, blockPath, `${inlinePath}/child`);
|
|
51556
51649
|
break;
|
|
51557
51650
|
case "hyperlink":
|
|
51558
|
-
|
|
51651
|
+
visitInlines(inline.children, blockPath, `${inlinePath}/child`);
|
|
51559
51652
|
break;
|
|
51560
51653
|
default:
|
|
51561
51654
|
break;
|
|
51562
51655
|
}
|
|
51563
51656
|
};
|
|
51564
|
-
|
|
51657
|
+
visitBlocks(blocks, context.storyBasePath);
|
|
51565
51658
|
return { objects, divergences };
|
|
51566
51659
|
}
|
|
51567
51660
|
function getDrawingFramePreserveHint(inline) {
|
|
@@ -51569,6 +51662,170 @@ function getDrawingFramePreserveHint(inline) {
|
|
|
51569
51662
|
if (content.type === "picture") return void 0;
|
|
51570
51663
|
return content.preserveOnlyObject;
|
|
51571
51664
|
}
|
|
51665
|
+
function buildDrawingFrameTextBoxBodyFacts(inline, canonicalAnchor, inlinePath, display, anchorRectTwips) {
|
|
51666
|
+
if (inline.content.type !== "shape") return void 0;
|
|
51667
|
+
const content = inline.content;
|
|
51668
|
+
const canonicalBody = canonicalAnchor?.textBoxBody;
|
|
51669
|
+
const hasTextBoxContent = Boolean(
|
|
51670
|
+
canonicalBody || content.isTextBox || content.textBoxBody || content.txbxBlocks?.length
|
|
51671
|
+
);
|
|
51672
|
+
if (!hasTextBoxContent) return void 0;
|
|
51673
|
+
if (!canonicalBody) {
|
|
51674
|
+
return unavailableTextBoxBodyFacts(
|
|
51675
|
+
`${canonicalAnchor?.objectKey ?? inlinePath}:txbx`,
|
|
51676
|
+
"unmodeled-txbx-blocks",
|
|
51677
|
+
content.textBoxBody,
|
|
51678
|
+
content.txbxBlocks?.length ?? 0,
|
|
51679
|
+
countParagraphBlocks(content.txbxBlocks ?? []),
|
|
51680
|
+
0
|
|
51681
|
+
);
|
|
51682
|
+
}
|
|
51683
|
+
if (display !== "floating") {
|
|
51684
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "inline-textbox");
|
|
51685
|
+
}
|
|
51686
|
+
if (!anchorRectTwips) {
|
|
51687
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "missing-anchor-rect");
|
|
51688
|
+
}
|
|
51689
|
+
if (canonicalBody.status !== "modeled") {
|
|
51690
|
+
return unavailableTextBoxBodyFactsFromCanonical(
|
|
51691
|
+
canonicalBody,
|
|
51692
|
+
normalizeTextBoxBodyUnavailableReason(canonicalBody.unavailableReason)
|
|
51693
|
+
);
|
|
51694
|
+
}
|
|
51695
|
+
const bodyInsetsTwips = textBoxInsetsTwips(canonicalBody.bodyProperties);
|
|
51696
|
+
if (!bodyInsetsTwips) {
|
|
51697
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "missing-body-insets");
|
|
51698
|
+
}
|
|
51699
|
+
const contentRectTwips = rect2(
|
|
51700
|
+
anchorRectTwips.xTwips + bodyInsetsTwips.leftTwips,
|
|
51701
|
+
anchorRectTwips.yTwips + bodyInsetsTwips.topTwips,
|
|
51702
|
+
Math.max(0, anchorRectTwips.widthTwips - bodyInsetsTwips.leftTwips - bodyInsetsTwips.rightTwips),
|
|
51703
|
+
Math.max(0, anchorRectTwips.heightTwips - bodyInsetsTwips.topTwips - bodyInsetsTwips.bottomTwips)
|
|
51704
|
+
);
|
|
51705
|
+
return {
|
|
51706
|
+
bodyKey: canonicalBody.bodyKey,
|
|
51707
|
+
status: "modeled",
|
|
51708
|
+
...canonicalBody.bodyProperties ? { bodyProperties: { ...canonicalBody.bodyProperties } } : {},
|
|
51709
|
+
bodyInsetsTwips,
|
|
51710
|
+
contentRectTwips,
|
|
51711
|
+
blockCount: canonicalBody.blockCount,
|
|
51712
|
+
paragraphCount: canonicalBody.paragraphCount,
|
|
51713
|
+
unsupportedBlockCount: canonicalBody.unsupportedBlockCount,
|
|
51714
|
+
paragraphs: buildTextBoxParagraphFacts(canonicalBody, contentRectTwips)
|
|
51715
|
+
};
|
|
51716
|
+
}
|
|
51717
|
+
function unavailableTextBoxBodyFactsFromCanonical(body, reason) {
|
|
51718
|
+
return {
|
|
51719
|
+
bodyKey: body.bodyKey,
|
|
51720
|
+
status: body.status === "preserve-only" ? "preserve-only" : "unavailable",
|
|
51721
|
+
unavailableReason: reason,
|
|
51722
|
+
...body.bodyProperties ? { bodyProperties: { ...body.bodyProperties } } : {},
|
|
51723
|
+
blockCount: body.blockCount,
|
|
51724
|
+
paragraphCount: body.paragraphCount,
|
|
51725
|
+
unsupportedBlockCount: body.unsupportedBlockCount,
|
|
51726
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
51727
|
+
paragraphKey: paragraph.paragraphKey,
|
|
51728
|
+
blockPath: paragraph.blockPath,
|
|
51729
|
+
blockIndex: paragraph.blockIndex,
|
|
51730
|
+
unavailableReason: reason,
|
|
51731
|
+
...paragraph.styleId !== void 0 ? { styleId: paragraph.styleId } : {},
|
|
51732
|
+
...paragraph.alignment !== void 0 ? { alignment: paragraph.alignment } : {},
|
|
51733
|
+
textLength: paragraph.textLength,
|
|
51734
|
+
runCount: paragraph.runCount
|
|
51735
|
+
}))
|
|
51736
|
+
};
|
|
51737
|
+
}
|
|
51738
|
+
function unavailableTextBoxBodyFacts(bodyKey, reason, bodyProperties, blockCount, paragraphCount, unsupportedBlockCount) {
|
|
51739
|
+
return {
|
|
51740
|
+
bodyKey,
|
|
51741
|
+
status: "unavailable",
|
|
51742
|
+
unavailableReason: reason,
|
|
51743
|
+
...bodyProperties ? { bodyProperties: { ...bodyProperties } } : {},
|
|
51744
|
+
blockCount,
|
|
51745
|
+
paragraphCount,
|
|
51746
|
+
unsupportedBlockCount,
|
|
51747
|
+
paragraphs: []
|
|
51748
|
+
};
|
|
51749
|
+
}
|
|
51750
|
+
function buildUnsupportedVmlTextBoxFacts(inline, inlinePath) {
|
|
51751
|
+
const hasText = Boolean(inline.text?.length);
|
|
51752
|
+
return {
|
|
51753
|
+
bodyKey: `${inline.preserveOnlyObject?.sourceId ?? inlinePath}:vml-textbox`,
|
|
51754
|
+
status: "unavailable",
|
|
51755
|
+
unavailableReason: "unsupported-vml-textbox",
|
|
51756
|
+
blockCount: hasText ? 1 : 0,
|
|
51757
|
+
paragraphCount: hasText ? 1 : 0,
|
|
51758
|
+
unsupportedBlockCount: hasText ? 1 : 0,
|
|
51759
|
+
paragraphs: []
|
|
51760
|
+
};
|
|
51761
|
+
}
|
|
51762
|
+
function buildTextBoxParagraphFacts(body, contentRectTwips) {
|
|
51763
|
+
const paragraphCount = body.paragraphs.length;
|
|
51764
|
+
if (paragraphCount === 0) return [];
|
|
51765
|
+
const baseHeight = Math.floor(contentRectTwips.heightTwips / paragraphCount);
|
|
51766
|
+
return body.paragraphs.map((paragraph, index) => {
|
|
51767
|
+
const yTwips = contentRectTwips.yTwips + baseHeight * index;
|
|
51768
|
+
const heightTwips = index === paragraphCount - 1 ? Math.max(0, contentRectTwips.yTwips + contentRectTwips.heightTwips - yTwips) : Math.max(0, baseHeight);
|
|
51769
|
+
return {
|
|
51770
|
+
paragraphKey: paragraph.paragraphKey,
|
|
51771
|
+
blockPath: paragraph.blockPath,
|
|
51772
|
+
blockIndex: paragraph.blockIndex,
|
|
51773
|
+
rectTwips: rect2(
|
|
51774
|
+
contentRectTwips.xTwips,
|
|
51775
|
+
yTwips,
|
|
51776
|
+
contentRectTwips.widthTwips,
|
|
51777
|
+
heightTwips
|
|
51778
|
+
),
|
|
51779
|
+
...paragraph.styleId !== void 0 ? { styleId: paragraph.styleId } : {},
|
|
51780
|
+
...paragraph.alignment !== void 0 ? { alignment: paragraph.alignment } : {},
|
|
51781
|
+
textLength: paragraph.textLength,
|
|
51782
|
+
runCount: paragraph.runCount
|
|
51783
|
+
};
|
|
51784
|
+
});
|
|
51785
|
+
}
|
|
51786
|
+
function textBoxInsetsTwips(bodyProperties) {
|
|
51787
|
+
if (!bodyProperties || bodyProperties.insetLeftEmu === void 0 || bodyProperties.insetTopEmu === void 0 || bodyProperties.insetRightEmu === void 0 || bodyProperties.insetBottomEmu === void 0) {
|
|
51788
|
+
return void 0;
|
|
51789
|
+
}
|
|
51790
|
+
return {
|
|
51791
|
+
leftTwips: Math.max(0, Math.round(bodyProperties.insetLeftEmu / EMUS_PER_TWIP)),
|
|
51792
|
+
topTwips: Math.max(0, Math.round(bodyProperties.insetTopEmu / EMUS_PER_TWIP)),
|
|
51793
|
+
rightTwips: Math.max(0, Math.round(bodyProperties.insetRightEmu / EMUS_PER_TWIP)),
|
|
51794
|
+
bottomTwips: Math.max(0, Math.round(bodyProperties.insetBottomEmu / EMUS_PER_TWIP))
|
|
51795
|
+
};
|
|
51796
|
+
}
|
|
51797
|
+
function normalizeTextBoxBodyUnavailableReason(reason) {
|
|
51798
|
+
switch (reason) {
|
|
51799
|
+
case "txbx-blocks-unavailable":
|
|
51800
|
+
case "empty-body":
|
|
51801
|
+
case "unsupported-content":
|
|
51802
|
+
return reason;
|
|
51803
|
+
default:
|
|
51804
|
+
return "unmodeled-txbx-blocks";
|
|
51805
|
+
}
|
|
51806
|
+
}
|
|
51807
|
+
function countParagraphBlocks(blocks) {
|
|
51808
|
+
let count = 0;
|
|
51809
|
+
const visit = (block) => {
|
|
51810
|
+
if (block.type === "paragraph") {
|
|
51811
|
+
count += 1;
|
|
51812
|
+
return;
|
|
51813
|
+
}
|
|
51814
|
+
if (block.type === "table") {
|
|
51815
|
+
for (const row of block.rows) {
|
|
51816
|
+
for (const cell of row.cells) {
|
|
51817
|
+
for (const child of cell.children) visit(child);
|
|
51818
|
+
}
|
|
51819
|
+
}
|
|
51820
|
+
return;
|
|
51821
|
+
}
|
|
51822
|
+
if (block.type === "sdt" || block.type === "custom_xml") {
|
|
51823
|
+
for (const child of block.children) visit(child);
|
|
51824
|
+
}
|
|
51825
|
+
};
|
|
51826
|
+
for (const block of blocks) visit(block);
|
|
51827
|
+
return count;
|
|
51828
|
+
}
|
|
51572
51829
|
function collectDrawingRelationshipIds(inline) {
|
|
51573
51830
|
const content = inline.content;
|
|
51574
51831
|
if (content.type === "picture") return [content.blipRef];
|
|
@@ -51897,12 +52154,34 @@ function freezePageFrame(frame) {
|
|
|
51897
52154
|
for (const story of frame.pageLocalStories) {
|
|
51898
52155
|
Object.freeze(story.resolvedFields);
|
|
51899
52156
|
Object.freeze(story.previewParts);
|
|
52157
|
+
for (const object of story.anchoredObjects) {
|
|
52158
|
+
freezeStoryAnchoredObject(object);
|
|
52159
|
+
}
|
|
51900
52160
|
Object.freeze(story.anchoredObjects);
|
|
51901
52161
|
Object.freeze(story);
|
|
51902
52162
|
}
|
|
51903
52163
|
Object.freeze(frame.pageLocalStories);
|
|
51904
52164
|
Object.freeze(frame);
|
|
51905
52165
|
}
|
|
52166
|
+
function freezeStoryAnchoredObject(object) {
|
|
52167
|
+
if (object.extentTwips) Object.freeze(object.extentTwips);
|
|
52168
|
+
if (object.anchorRectTwips) Object.freeze(object.anchorRectTwips);
|
|
52169
|
+
if (object.relationshipIds) Object.freeze(object.relationshipIds);
|
|
52170
|
+
if (object.mediaIds) Object.freeze(object.mediaIds);
|
|
52171
|
+
if (object.textBoxBody) {
|
|
52172
|
+
if (object.textBoxBody.bodyProperties) Object.freeze(object.textBoxBody.bodyProperties);
|
|
52173
|
+
if (object.textBoxBody.bodyInsetsTwips) Object.freeze(object.textBoxBody.bodyInsetsTwips);
|
|
52174
|
+
if (object.textBoxBody.contentRectTwips) Object.freeze(object.textBoxBody.contentRectTwips);
|
|
52175
|
+
for (const paragraph of object.textBoxBody.paragraphs) {
|
|
52176
|
+
if (paragraph.rectTwips) Object.freeze(paragraph.rectTwips);
|
|
52177
|
+
Object.freeze(paragraph);
|
|
52178
|
+
}
|
|
52179
|
+
Object.freeze(object.textBoxBody.paragraphs);
|
|
52180
|
+
Object.freeze(object.textBoxBody);
|
|
52181
|
+
}
|
|
52182
|
+
Object.freeze(object.divergenceIds);
|
|
52183
|
+
Object.freeze(object);
|
|
52184
|
+
}
|
|
51906
52185
|
function normalizePageLocalStoryFieldsForPages(pages) {
|
|
51907
52186
|
const pageFieldCounts = buildPageFieldCounts(pages);
|
|
51908
52187
|
return pages.map((page) => {
|
|
@@ -53534,7 +53813,8 @@ function createLayoutEngine(options = {}) {
|
|
|
53534
53813
|
fragmentsByPageIndex,
|
|
53535
53814
|
lineBoxesByPageIndex,
|
|
53536
53815
|
noteAllocationsByPageIndex: pageStack.noteAllocationsByPageIndex,
|
|
53537
|
-
subParts: document2.subParts
|
|
53816
|
+
subParts: document2.subParts,
|
|
53817
|
+
anchors: layoutInputs.anchors
|
|
53538
53818
|
});
|
|
53539
53819
|
const graph = applyViewportWindowMaterialization(
|
|
53540
53820
|
measuredGraph,
|
|
@@ -53669,7 +53949,8 @@ function createLayoutEngine(options = {}) {
|
|
|
53669
53949
|
fragmentsByPageIndex: freshFragmentsByPageIndex,
|
|
53670
53950
|
lineBoxesByPageIndex: freshLineBoxesByPageIndex,
|
|
53671
53951
|
noteAllocationsByPageIndex: freshResult.noteAllocationsByPageIndex,
|
|
53672
|
-
subParts: document2.subParts
|
|
53952
|
+
subParts: document2.subParts,
|
|
53953
|
+
anchors: layoutInputs.anchors
|
|
53673
53954
|
});
|
|
53674
53955
|
const freshNodes = freshGraph.pages;
|
|
53675
53956
|
const splicedGraph = spliceGraph(priorGraph, freshNodes, firstDirty, convergedTailStart);
|
|
@@ -56129,7 +56410,7 @@ function resolveEditableTextTarget(input) {
|
|
|
56129
56410
|
"Editable target ref does not belong to the active story."
|
|
56130
56411
|
);
|
|
56131
56412
|
}
|
|
56132
|
-
const currentTargets = collectEditableTargetRefs(input.document);
|
|
56413
|
+
const currentTargets = collectEditableTargetRefs(input.document, input.editableTargetCache);
|
|
56133
56414
|
const current = currentTargets.find(
|
|
56134
56415
|
(candidate) => candidate.targetKey === input.target.targetKey
|
|
56135
56416
|
);
|
|
@@ -56230,7 +56511,13 @@ function reject(code, message) {
|
|
|
56230
56511
|
};
|
|
56231
56512
|
}
|
|
56232
56513
|
function sameResolvedTarget2(left, right) {
|
|
56233
|
-
return left.kind === right.kind && left.storyKey === right.storyKey && left.blockPath === right.blockPath && left.leafPath === right.leafPath && left.commandFamily === right.commandFamily && left.editability === right.editability && left
|
|
56514
|
+
return left.kind === right.kind && left.storyKey === right.storyKey && left.blockPath === right.blockPath && left.leafPath === right.leafPath && left.commandFamily === right.commandFamily && left.editability === right.editability && sameTextTargetStaleCheck(left, right) && left.staleCheck.inlineCount === right.staleCheck.inlineCount && left.staleCheck.targetHash === right.staleCheck.targetHash && left.staleCheck.targetTextLength === right.staleCheck.targetTextLength && left.staleCheck.childCount === right.staleCheck.childCount && left.staleCheck.blockType === right.staleCheck.blockType && left.staleCheck.wordParaId === right.staleCheck.wordParaId && left.staleCheck.wordTextId === right.staleCheck.wordTextId && jsonStable(left.staleCheck.sourceRef) === jsonStable(right.staleCheck.sourceRef) && jsonStable(left.sourceRef) === jsonStable(right.sourceRef) && jsonStable(left.table) === jsonStable(right.table) && jsonStable(left.editableOwner) === jsonStable(right.editableOwner);
|
|
56515
|
+
}
|
|
56516
|
+
function sameTextTargetStaleCheck(left, right) {
|
|
56517
|
+
if (left.staleCheck.paragraphTextHash === right.staleCheck.paragraphTextHash && left.staleCheck.paragraphTextLength === right.staleCheck.paragraphTextLength) {
|
|
56518
|
+
return true;
|
|
56519
|
+
}
|
|
56520
|
+
return left.commandFamily === "text-leaf" && left.staleCheck.paragraphTextLength !== void 0 && right.staleCheck.paragraphTextLength !== void 0 && left.staleCheck.paragraphTextLength !== right.staleCheck.paragraphTextLength;
|
|
56234
56521
|
}
|
|
56235
56522
|
function locateTargetRange(document2, surface, target) {
|
|
56236
56523
|
if (target.kind === "hyperlink-text") {
|
|
@@ -56549,7 +56836,7 @@ function resolveEditableTableStructureTarget(input) {
|
|
|
56549
56836
|
`Editable target is not editable${input.target.posture.blockers.length > 0 ? `: ${input.target.posture.blockers.join(", ")}` : "."}`
|
|
56550
56837
|
);
|
|
56551
56838
|
}
|
|
56552
|
-
const current = collectEditableTargetRefs(input.document).find(
|
|
56839
|
+
const current = collectEditableTargetRefs(input.document, input.editableTargetCache).find(
|
|
56553
56840
|
(candidate) => candidate.targetKey === input.target?.targetKey
|
|
56554
56841
|
);
|
|
56555
56842
|
if (!current) {
|