@beyondwork/docx-react-component 1.0.122 → 1.0.124
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 +351 -56
- 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-EMDH4IQN.js → chunk-4B74ETJI.js} +4 -3
- package/dist/{chunk-QNGJRZ2D.js → chunk-4IPEZYQX.js} +1 -1
- package/dist/{chunk-S4ANOS2M.js → chunk-7PC6XUNO.js} +2 -2
- package/dist/{chunk-TMU7JMXX.js → chunk-A74Y5NE4.js} +11 -15
- package/dist/{chunk-3OFSP2IX.js → chunk-BOHHIVQ2.js} +3 -3
- package/dist/{chunk-TFSXOIAI.js → chunk-FNWKE74J.js} +43 -3
- 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-UHQOUTAX.js → chunk-MPH4ZQS4.js} +377 -50
- package/dist/{chunk-GZW2ERUO.js → chunk-N4VIXI2Z.js} +3 -3
- package/dist/{chunk-OBCP6VTG.js → chunk-NAMAWCXN.js} +1 -1
- package/dist/{chunk-QFU7ZOAD.js → chunk-PFYUJU3Q.js} +176 -36
- package/dist/{chunk-PCXTMEGY.js → chunk-Q76XPPTA.js} +24 -14
- package/dist/{chunk-37SEJQ3G.js → chunk-RSYN6FTS.js} +2 -2
- package/dist/{chunk-UWDWGQH5.js → chunk-TY4DIJO3.js} +1 -1
- package/dist/{chunk-IT2DK3A7.js → chunk-ZMRO6P3A.js} +9 -7
- 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 +1198 -191
- 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 +12 -15
- 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 +10 -14
- 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 +14 -612
- 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
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
resolveSectionVariants,
|
|
19
19
|
sectionSupportsStoryTarget,
|
|
20
20
|
storyTargetKey
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-H6IL5ABU.js";
|
|
22
22
|
import {
|
|
23
23
|
createSelectionSnapshot
|
|
24
24
|
} from "./chunk-OYGMRRR7.js";
|
|
25
25
|
import {
|
|
26
26
|
collectCanonicalLayoutInputs
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FNWKE74J.js";
|
|
28
28
|
import {
|
|
29
29
|
MAIN_STORY_TARGET,
|
|
30
30
|
createDetachedAnchor,
|
|
@@ -3957,6 +3957,7 @@ function buildPageGraph(inputOrPages, sectionsArg, storiesArg) {
|
|
|
3957
3957
|
regions,
|
|
3958
3958
|
divergences: frameDivergences,
|
|
3959
3959
|
subParts: input.subParts,
|
|
3960
|
+
anchors: input.anchors,
|
|
3960
3961
|
pageFieldCounts
|
|
3961
3962
|
});
|
|
3962
3963
|
const divergences = builtFrame.divergences;
|
|
@@ -4123,6 +4124,7 @@ function buildPageFrame(input) {
|
|
|
4123
4124
|
stories: input.stories,
|
|
4124
4125
|
regions,
|
|
4125
4126
|
subParts: input.subParts,
|
|
4127
|
+
anchors: input.anchors,
|
|
4126
4128
|
pageFieldCounts: input.pageFieldCounts
|
|
4127
4129
|
});
|
|
4128
4130
|
const divergences = [...input.divergences, ...pageLocalStoryResult.divergences];
|
|
@@ -4160,6 +4162,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
4160
4162
|
input.stories.header,
|
|
4161
4163
|
input.regions.header,
|
|
4162
4164
|
findHeaderFooterPart(input.subParts?.headers, input.stories.header),
|
|
4165
|
+
input.anchors,
|
|
4163
4166
|
input.pageFieldCounts
|
|
4164
4167
|
);
|
|
4165
4168
|
instances.push(built.instance);
|
|
@@ -4176,6 +4179,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
4176
4179
|
input.stories.footer,
|
|
4177
4180
|
input.regions.footer,
|
|
4178
4181
|
findHeaderFooterPart(input.subParts?.footers, input.stories.footer),
|
|
4182
|
+
input.anchors,
|
|
4179
4183
|
input.pageFieldCounts
|
|
4180
4184
|
);
|
|
4181
4185
|
instances.push(built.instance);
|
|
@@ -4183,7 +4187,7 @@ function buildPageLocalStoryInstances(input) {
|
|
|
4183
4187
|
}
|
|
4184
4188
|
return { instances, divergences };
|
|
4185
4189
|
}
|
|
4186
|
-
function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, displayPageNumber, layout, target, region, source, pageFieldCounts) {
|
|
4190
|
+
function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, displayPageNumber, layout, target, region, source, anchors, pageFieldCounts) {
|
|
4187
4191
|
const measuredFrameHeightTwips = region?.heightTwips ?? 0;
|
|
4188
4192
|
const sectionPart = target.sectionIndex === void 0 ? "section-unknown" : `section-${target.sectionIndex}`;
|
|
4189
4193
|
const instanceId = `${frameId}:${target.kind}:${target.variant}:${target.relationshipId}`;
|
|
@@ -4204,7 +4208,9 @@ function buildPageLocalStoryInstance(frameId, pageId, pageIndex, sectionIndex, d
|
|
|
4204
4208
|
kind: target.kind,
|
|
4205
4209
|
variant: target.variant,
|
|
4206
4210
|
relationshipId: target.relationshipId,
|
|
4207
|
-
region
|
|
4211
|
+
region,
|
|
4212
|
+
storyBasePath: `${target.kind}:${source.partPath ?? `word/${target.kind}${target.relationshipId}.xml`}`,
|
|
4213
|
+
anchorsByInlinePath: buildAnchorsByInlinePath(anchors)
|
|
4208
4214
|
}) : { objects: [], divergences: [] };
|
|
4209
4215
|
const signature = buildPageLocalStorySignature({
|
|
4210
4216
|
kind: target.kind,
|
|
@@ -4258,6 +4264,23 @@ function buildPageLocalStorySignature(input) {
|
|
|
4258
4264
|
object.anchorRectTwips?.yTwips ?? "",
|
|
4259
4265
|
object.anchorRectTwips?.widthTwips ?? "",
|
|
4260
4266
|
object.anchorRectTwips?.heightTwips ?? "",
|
|
4267
|
+
object.textBoxBody?.bodyKey ?? "",
|
|
4268
|
+
object.textBoxBody?.status ?? "",
|
|
4269
|
+
object.textBoxBody?.unavailableReason ?? "",
|
|
4270
|
+
object.textBoxBody?.contentRectTwips?.xTwips ?? "",
|
|
4271
|
+
object.textBoxBody?.contentRectTwips?.yTwips ?? "",
|
|
4272
|
+
object.textBoxBody?.contentRectTwips?.widthTwips ?? "",
|
|
4273
|
+
object.textBoxBody?.contentRectTwips?.heightTwips ?? "",
|
|
4274
|
+
object.textBoxBody?.paragraphs.map(
|
|
4275
|
+
(paragraph) => [
|
|
4276
|
+
paragraph.paragraphKey,
|
|
4277
|
+
paragraph.rectTwips?.xTwips ?? "",
|
|
4278
|
+
paragraph.rectTwips?.yTwips ?? "",
|
|
4279
|
+
paragraph.rectTwips?.widthTwips ?? "",
|
|
4280
|
+
paragraph.rectTwips?.heightTwips ?? "",
|
|
4281
|
+
paragraph.unavailableReason ?? ""
|
|
4282
|
+
].join("/")
|
|
4283
|
+
).join(",") ?? "",
|
|
4261
4284
|
object.relationshipIds?.join(",") ?? "",
|
|
4262
4285
|
object.mediaIds?.join(",") ?? "",
|
|
4263
4286
|
object.wrapMode ?? "",
|
|
@@ -4402,6 +4425,10 @@ function truncatePageLocalStoryPreview(text) {
|
|
|
4402
4425
|
if (text.length <= MAX_PAGE_LOCAL_STORY_PREVIEW_CHARS) return text;
|
|
4403
4426
|
return `${text.slice(0, MAX_PAGE_LOCAL_STORY_PREVIEW_CHARS - 1).trimEnd()}\u2026`;
|
|
4404
4427
|
}
|
|
4428
|
+
function buildAnchorsByInlinePath(anchors) {
|
|
4429
|
+
if (!anchors || anchors.length === 0) return void 0;
|
|
4430
|
+
return new Map(anchors.map((anchor) => [anchor.inlinePath, anchor]));
|
|
4431
|
+
}
|
|
4405
4432
|
function collectStoryAnchoredObjects(blocks, context) {
|
|
4406
4433
|
const objects = [];
|
|
4407
4434
|
const divergences = [];
|
|
@@ -4445,26 +4472,45 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
4445
4472
|
});
|
|
4446
4473
|
ordinal += 1;
|
|
4447
4474
|
};
|
|
4448
|
-
const
|
|
4475
|
+
const visitBlocks = (blocksToVisit, basePath) => {
|
|
4476
|
+
for (let blockIndex = 0; blockIndex < blocksToVisit.length; blockIndex += 1) {
|
|
4477
|
+
const block = blocksToVisit[blockIndex];
|
|
4478
|
+
if (!block) continue;
|
|
4479
|
+
visitBlock(block, `${basePath}/block[${blockIndex}]`);
|
|
4480
|
+
}
|
|
4481
|
+
};
|
|
4482
|
+
const visitBlock = (block, blockPath) => {
|
|
4449
4483
|
switch (block.type) {
|
|
4450
4484
|
case "paragraph":
|
|
4451
|
-
|
|
4485
|
+
visitInlines(block.children, blockPath, `${blockPath}/inline`);
|
|
4452
4486
|
break;
|
|
4453
4487
|
case "table":
|
|
4454
|
-
for (
|
|
4455
|
-
|
|
4456
|
-
|
|
4488
|
+
for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {
|
|
4489
|
+
const row = block.rows[rowIndex];
|
|
4490
|
+
if (!row) continue;
|
|
4491
|
+
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
4492
|
+
const cell = row.cells[cellIndex];
|
|
4493
|
+
if (!cell) continue;
|
|
4494
|
+
visitBlocks(cell.children, `${blockPath}/row[${rowIndex}]/cell[${cellIndex}]`);
|
|
4457
4495
|
}
|
|
4458
4496
|
}
|
|
4459
4497
|
break;
|
|
4460
4498
|
case "sdt":
|
|
4461
|
-
|
|
4499
|
+
case "custom_xml":
|
|
4500
|
+
visitBlocks(block.children, blockPath);
|
|
4462
4501
|
break;
|
|
4463
4502
|
default:
|
|
4464
4503
|
break;
|
|
4465
4504
|
}
|
|
4466
4505
|
};
|
|
4467
|
-
const
|
|
4506
|
+
const visitInlines = (inlines, blockPath, basePath) => {
|
|
4507
|
+
for (let inlineIndex = 0; inlineIndex < inlines.length; inlineIndex += 1) {
|
|
4508
|
+
const inline = inlines[inlineIndex];
|
|
4509
|
+
if (!inline) continue;
|
|
4510
|
+
visitInline(inline, blockPath, `${basePath}[${inlineIndex}]`);
|
|
4511
|
+
}
|
|
4512
|
+
};
|
|
4513
|
+
const visitInline = (inline, blockPath, inlinePath) => {
|
|
4468
4514
|
switch (inline.type) {
|
|
4469
4515
|
case "image": {
|
|
4470
4516
|
pushObject({
|
|
@@ -4485,17 +4531,27 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
4485
4531
|
inline.anchor.extent.widthEmu,
|
|
4486
4532
|
inline.anchor.extent.heightEmu
|
|
4487
4533
|
);
|
|
4534
|
+
const anchorRectTwips = resolveObjectAnchorRectTwips(
|
|
4535
|
+
context.region,
|
|
4536
|
+
extentTwips,
|
|
4537
|
+
inline.anchor.positionH,
|
|
4538
|
+
inline.anchor.positionV
|
|
4539
|
+
);
|
|
4540
|
+
const canonicalAnchor = context.anchorsByInlinePath?.get(inlinePath);
|
|
4541
|
+
const textBoxBody = buildDrawingFrameTextBoxBodyFacts(
|
|
4542
|
+
inline,
|
|
4543
|
+
canonicalAnchor,
|
|
4544
|
+
inlinePath,
|
|
4545
|
+
display,
|
|
4546
|
+
anchorRectTwips
|
|
4547
|
+
);
|
|
4488
4548
|
pushObject({
|
|
4489
4549
|
objectId: getDrawingFrameObjectId(inline, context.storyKey, ordinal),
|
|
4490
4550
|
sourceType: "drawing-frame",
|
|
4491
4551
|
display,
|
|
4492
4552
|
extentTwips,
|
|
4493
|
-
anchorRectTwips
|
|
4494
|
-
|
|
4495
|
-
extentTwips,
|
|
4496
|
-
inline.anchor.positionH,
|
|
4497
|
-
inline.anchor.positionV
|
|
4498
|
-
),
|
|
4553
|
+
anchorRectTwips,
|
|
4554
|
+
...textBoxBody ? { textBoxBody } : {},
|
|
4499
4555
|
...relationshipIds.length > 0 ? { relationshipIds } : {},
|
|
4500
4556
|
...inline.content.type === "picture" && inline.content.mediaId ? { mediaIds: [inline.content.mediaId] } : {},
|
|
4501
4557
|
preserveOnly: Boolean(preserveHint),
|
|
@@ -4503,7 +4559,7 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
4503
4559
|
wrapMode: inline.anchor.wrapMode
|
|
4504
4560
|
});
|
|
4505
4561
|
if (inline.content.type === "shape") {
|
|
4506
|
-
|
|
4562
|
+
visitBlocks(inline.content.txbxBlocks ?? [], `${inlinePath}/txbx`);
|
|
4507
4563
|
}
|
|
4508
4564
|
break;
|
|
4509
4565
|
}
|
|
@@ -4530,10 +4586,11 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
4530
4586
|
} : {},
|
|
4531
4587
|
...preserveHint?.relationshipIds ? { relationshipIds: [...preserveHint.relationshipIds] } : {},
|
|
4532
4588
|
preserveOnly: Boolean(preserveHint),
|
|
4533
|
-
...preserveHint ? { preserveHint } : {}
|
|
4589
|
+
...preserveHint ? { preserveHint } : {},
|
|
4590
|
+
...inline.type === "vml_shape" && inline.text ? { textBoxBody: buildUnsupportedVmlTextBoxFacts(inline, inlinePath) } : {}
|
|
4534
4591
|
});
|
|
4535
4592
|
if (inline.type === "shape") {
|
|
4536
|
-
|
|
4593
|
+
visitBlocks(inline.txbxBlocks ?? [], `${inlinePath}/txbx`);
|
|
4537
4594
|
}
|
|
4538
4595
|
break;
|
|
4539
4596
|
}
|
|
@@ -4555,16 +4612,16 @@ function collectStoryAnchoredObjects(blocks, context) {
|
|
|
4555
4612
|
});
|
|
4556
4613
|
break;
|
|
4557
4614
|
case "field":
|
|
4558
|
-
|
|
4615
|
+
visitInlines(inline.children, blockPath, `${inlinePath}/child`);
|
|
4559
4616
|
break;
|
|
4560
4617
|
case "hyperlink":
|
|
4561
|
-
|
|
4618
|
+
visitInlines(inline.children, blockPath, `${inlinePath}/child`);
|
|
4562
4619
|
break;
|
|
4563
4620
|
default:
|
|
4564
4621
|
break;
|
|
4565
4622
|
}
|
|
4566
4623
|
};
|
|
4567
|
-
|
|
4624
|
+
visitBlocks(blocks, context.storyBasePath);
|
|
4568
4625
|
return { objects, divergences };
|
|
4569
4626
|
}
|
|
4570
4627
|
function getDrawingFramePreserveHint(inline) {
|
|
@@ -4572,6 +4629,170 @@ function getDrawingFramePreserveHint(inline) {
|
|
|
4572
4629
|
if (content.type === "picture") return void 0;
|
|
4573
4630
|
return content.preserveOnlyObject;
|
|
4574
4631
|
}
|
|
4632
|
+
function buildDrawingFrameTextBoxBodyFacts(inline, canonicalAnchor, inlinePath, display, anchorRectTwips) {
|
|
4633
|
+
if (inline.content.type !== "shape") return void 0;
|
|
4634
|
+
const content = inline.content;
|
|
4635
|
+
const canonicalBody = canonicalAnchor?.textBoxBody;
|
|
4636
|
+
const hasTextBoxContent = Boolean(
|
|
4637
|
+
canonicalBody || content.isTextBox || content.textBoxBody || content.txbxBlocks?.length
|
|
4638
|
+
);
|
|
4639
|
+
if (!hasTextBoxContent) return void 0;
|
|
4640
|
+
if (!canonicalBody) {
|
|
4641
|
+
return unavailableTextBoxBodyFacts(
|
|
4642
|
+
`${canonicalAnchor?.objectKey ?? inlinePath}:txbx`,
|
|
4643
|
+
"unmodeled-txbx-blocks",
|
|
4644
|
+
content.textBoxBody,
|
|
4645
|
+
content.txbxBlocks?.length ?? 0,
|
|
4646
|
+
countParagraphBlocks(content.txbxBlocks ?? []),
|
|
4647
|
+
0
|
|
4648
|
+
);
|
|
4649
|
+
}
|
|
4650
|
+
if (display !== "floating") {
|
|
4651
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "inline-textbox");
|
|
4652
|
+
}
|
|
4653
|
+
if (!anchorRectTwips) {
|
|
4654
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "missing-anchor-rect");
|
|
4655
|
+
}
|
|
4656
|
+
if (canonicalBody.status !== "modeled") {
|
|
4657
|
+
return unavailableTextBoxBodyFactsFromCanonical(
|
|
4658
|
+
canonicalBody,
|
|
4659
|
+
normalizeTextBoxBodyUnavailableReason(canonicalBody.unavailableReason)
|
|
4660
|
+
);
|
|
4661
|
+
}
|
|
4662
|
+
const bodyInsetsTwips = textBoxInsetsTwips(canonicalBody.bodyProperties);
|
|
4663
|
+
if (!bodyInsetsTwips) {
|
|
4664
|
+
return unavailableTextBoxBodyFactsFromCanonical(canonicalBody, "missing-body-insets");
|
|
4665
|
+
}
|
|
4666
|
+
const contentRectTwips = rect(
|
|
4667
|
+
anchorRectTwips.xTwips + bodyInsetsTwips.leftTwips,
|
|
4668
|
+
anchorRectTwips.yTwips + bodyInsetsTwips.topTwips,
|
|
4669
|
+
Math.max(0, anchorRectTwips.widthTwips - bodyInsetsTwips.leftTwips - bodyInsetsTwips.rightTwips),
|
|
4670
|
+
Math.max(0, anchorRectTwips.heightTwips - bodyInsetsTwips.topTwips - bodyInsetsTwips.bottomTwips)
|
|
4671
|
+
);
|
|
4672
|
+
return {
|
|
4673
|
+
bodyKey: canonicalBody.bodyKey,
|
|
4674
|
+
status: "modeled",
|
|
4675
|
+
...canonicalBody.bodyProperties ? { bodyProperties: { ...canonicalBody.bodyProperties } } : {},
|
|
4676
|
+
bodyInsetsTwips,
|
|
4677
|
+
contentRectTwips,
|
|
4678
|
+
blockCount: canonicalBody.blockCount,
|
|
4679
|
+
paragraphCount: canonicalBody.paragraphCount,
|
|
4680
|
+
unsupportedBlockCount: canonicalBody.unsupportedBlockCount,
|
|
4681
|
+
paragraphs: buildTextBoxParagraphFacts(canonicalBody, contentRectTwips)
|
|
4682
|
+
};
|
|
4683
|
+
}
|
|
4684
|
+
function unavailableTextBoxBodyFactsFromCanonical(body, reason) {
|
|
4685
|
+
return {
|
|
4686
|
+
bodyKey: body.bodyKey,
|
|
4687
|
+
status: body.status === "preserve-only" ? "preserve-only" : "unavailable",
|
|
4688
|
+
unavailableReason: reason,
|
|
4689
|
+
...body.bodyProperties ? { bodyProperties: { ...body.bodyProperties } } : {},
|
|
4690
|
+
blockCount: body.blockCount,
|
|
4691
|
+
paragraphCount: body.paragraphCount,
|
|
4692
|
+
unsupportedBlockCount: body.unsupportedBlockCount,
|
|
4693
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
4694
|
+
paragraphKey: paragraph.paragraphKey,
|
|
4695
|
+
blockPath: paragraph.blockPath,
|
|
4696
|
+
blockIndex: paragraph.blockIndex,
|
|
4697
|
+
unavailableReason: reason,
|
|
4698
|
+
...paragraph.styleId !== void 0 ? { styleId: paragraph.styleId } : {},
|
|
4699
|
+
...paragraph.alignment !== void 0 ? { alignment: paragraph.alignment } : {},
|
|
4700
|
+
textLength: paragraph.textLength,
|
|
4701
|
+
runCount: paragraph.runCount
|
|
4702
|
+
}))
|
|
4703
|
+
};
|
|
4704
|
+
}
|
|
4705
|
+
function unavailableTextBoxBodyFacts(bodyKey, reason, bodyProperties, blockCount, paragraphCount, unsupportedBlockCount) {
|
|
4706
|
+
return {
|
|
4707
|
+
bodyKey,
|
|
4708
|
+
status: "unavailable",
|
|
4709
|
+
unavailableReason: reason,
|
|
4710
|
+
...bodyProperties ? { bodyProperties: { ...bodyProperties } } : {},
|
|
4711
|
+
blockCount,
|
|
4712
|
+
paragraphCount,
|
|
4713
|
+
unsupportedBlockCount,
|
|
4714
|
+
paragraphs: []
|
|
4715
|
+
};
|
|
4716
|
+
}
|
|
4717
|
+
function buildUnsupportedVmlTextBoxFacts(inline, inlinePath) {
|
|
4718
|
+
const hasText = Boolean(inline.text?.length);
|
|
4719
|
+
return {
|
|
4720
|
+
bodyKey: `${inline.preserveOnlyObject?.sourceId ?? inlinePath}:vml-textbox`,
|
|
4721
|
+
status: "unavailable",
|
|
4722
|
+
unavailableReason: "unsupported-vml-textbox",
|
|
4723
|
+
blockCount: hasText ? 1 : 0,
|
|
4724
|
+
paragraphCount: hasText ? 1 : 0,
|
|
4725
|
+
unsupportedBlockCount: hasText ? 1 : 0,
|
|
4726
|
+
paragraphs: []
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
function buildTextBoxParagraphFacts(body, contentRectTwips) {
|
|
4730
|
+
const paragraphCount = body.paragraphs.length;
|
|
4731
|
+
if (paragraphCount === 0) return [];
|
|
4732
|
+
const baseHeight = Math.floor(contentRectTwips.heightTwips / paragraphCount);
|
|
4733
|
+
return body.paragraphs.map((paragraph, index) => {
|
|
4734
|
+
const yTwips = contentRectTwips.yTwips + baseHeight * index;
|
|
4735
|
+
const heightTwips = index === paragraphCount - 1 ? Math.max(0, contentRectTwips.yTwips + contentRectTwips.heightTwips - yTwips) : Math.max(0, baseHeight);
|
|
4736
|
+
return {
|
|
4737
|
+
paragraphKey: paragraph.paragraphKey,
|
|
4738
|
+
blockPath: paragraph.blockPath,
|
|
4739
|
+
blockIndex: paragraph.blockIndex,
|
|
4740
|
+
rectTwips: rect(
|
|
4741
|
+
contentRectTwips.xTwips,
|
|
4742
|
+
yTwips,
|
|
4743
|
+
contentRectTwips.widthTwips,
|
|
4744
|
+
heightTwips
|
|
4745
|
+
),
|
|
4746
|
+
...paragraph.styleId !== void 0 ? { styleId: paragraph.styleId } : {},
|
|
4747
|
+
...paragraph.alignment !== void 0 ? { alignment: paragraph.alignment } : {},
|
|
4748
|
+
textLength: paragraph.textLength,
|
|
4749
|
+
runCount: paragraph.runCount
|
|
4750
|
+
};
|
|
4751
|
+
});
|
|
4752
|
+
}
|
|
4753
|
+
function textBoxInsetsTwips(bodyProperties) {
|
|
4754
|
+
if (!bodyProperties || bodyProperties.insetLeftEmu === void 0 || bodyProperties.insetTopEmu === void 0 || bodyProperties.insetRightEmu === void 0 || bodyProperties.insetBottomEmu === void 0) {
|
|
4755
|
+
return void 0;
|
|
4756
|
+
}
|
|
4757
|
+
return {
|
|
4758
|
+
leftTwips: Math.max(0, Math.round(bodyProperties.insetLeftEmu / EMUS_PER_TWIP)),
|
|
4759
|
+
topTwips: Math.max(0, Math.round(bodyProperties.insetTopEmu / EMUS_PER_TWIP)),
|
|
4760
|
+
rightTwips: Math.max(0, Math.round(bodyProperties.insetRightEmu / EMUS_PER_TWIP)),
|
|
4761
|
+
bottomTwips: Math.max(0, Math.round(bodyProperties.insetBottomEmu / EMUS_PER_TWIP))
|
|
4762
|
+
};
|
|
4763
|
+
}
|
|
4764
|
+
function normalizeTextBoxBodyUnavailableReason(reason) {
|
|
4765
|
+
switch (reason) {
|
|
4766
|
+
case "txbx-blocks-unavailable":
|
|
4767
|
+
case "empty-body":
|
|
4768
|
+
case "unsupported-content":
|
|
4769
|
+
return reason;
|
|
4770
|
+
default:
|
|
4771
|
+
return "unmodeled-txbx-blocks";
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
function countParagraphBlocks(blocks) {
|
|
4775
|
+
let count = 0;
|
|
4776
|
+
const visit = (block) => {
|
|
4777
|
+
if (block.type === "paragraph") {
|
|
4778
|
+
count += 1;
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4781
|
+
if (block.type === "table") {
|
|
4782
|
+
for (const row of block.rows) {
|
|
4783
|
+
for (const cell of row.cells) {
|
|
4784
|
+
for (const child of cell.children) visit(child);
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
if (block.type === "sdt" || block.type === "custom_xml") {
|
|
4790
|
+
for (const child of block.children) visit(child);
|
|
4791
|
+
}
|
|
4792
|
+
};
|
|
4793
|
+
for (const block of blocks) visit(block);
|
|
4794
|
+
return count;
|
|
4795
|
+
}
|
|
4575
4796
|
function collectDrawingRelationshipIds(inline) {
|
|
4576
4797
|
const content = inline.content;
|
|
4577
4798
|
if (content.type === "picture") return [content.blipRef];
|
|
@@ -4900,12 +5121,34 @@ function freezePageFrame(frame) {
|
|
|
4900
5121
|
for (const story of frame.pageLocalStories) {
|
|
4901
5122
|
Object.freeze(story.resolvedFields);
|
|
4902
5123
|
Object.freeze(story.previewParts);
|
|
5124
|
+
for (const object of story.anchoredObjects) {
|
|
5125
|
+
freezeStoryAnchoredObject(object);
|
|
5126
|
+
}
|
|
4903
5127
|
Object.freeze(story.anchoredObjects);
|
|
4904
5128
|
Object.freeze(story);
|
|
4905
5129
|
}
|
|
4906
5130
|
Object.freeze(frame.pageLocalStories);
|
|
4907
5131
|
Object.freeze(frame);
|
|
4908
5132
|
}
|
|
5133
|
+
function freezeStoryAnchoredObject(object) {
|
|
5134
|
+
if (object.extentTwips) Object.freeze(object.extentTwips);
|
|
5135
|
+
if (object.anchorRectTwips) Object.freeze(object.anchorRectTwips);
|
|
5136
|
+
if (object.relationshipIds) Object.freeze(object.relationshipIds);
|
|
5137
|
+
if (object.mediaIds) Object.freeze(object.mediaIds);
|
|
5138
|
+
if (object.textBoxBody) {
|
|
5139
|
+
if (object.textBoxBody.bodyProperties) Object.freeze(object.textBoxBody.bodyProperties);
|
|
5140
|
+
if (object.textBoxBody.bodyInsetsTwips) Object.freeze(object.textBoxBody.bodyInsetsTwips);
|
|
5141
|
+
if (object.textBoxBody.contentRectTwips) Object.freeze(object.textBoxBody.contentRectTwips);
|
|
5142
|
+
for (const paragraph of object.textBoxBody.paragraphs) {
|
|
5143
|
+
if (paragraph.rectTwips) Object.freeze(paragraph.rectTwips);
|
|
5144
|
+
Object.freeze(paragraph);
|
|
5145
|
+
}
|
|
5146
|
+
Object.freeze(object.textBoxBody.paragraphs);
|
|
5147
|
+
Object.freeze(object.textBoxBody);
|
|
5148
|
+
}
|
|
5149
|
+
Object.freeze(object.divergenceIds);
|
|
5150
|
+
Object.freeze(object);
|
|
5151
|
+
}
|
|
4909
5152
|
function normalizePageLocalStoryFieldsForPages(pages) {
|
|
4910
5153
|
const pageFieldCounts = buildPageFieldCounts(pages);
|
|
4911
5154
|
return pages.map((page) => {
|
|
@@ -6244,7 +6487,7 @@ async function createCanvasProvider(fontLoader) {
|
|
|
6244
6487
|
|
|
6245
6488
|
// src/runtime/layout/layout-engine-version.ts
|
|
6246
6489
|
var LAYOUT_ENGINE_VERSION = 87;
|
|
6247
|
-
var LAYCACHE_SCHEMA_VERSION =
|
|
6490
|
+
var LAYCACHE_SCHEMA_VERSION = 11;
|
|
6248
6491
|
|
|
6249
6492
|
// src/runtime/layout/layout-engine-instance.ts
|
|
6250
6493
|
var FULL_VIEWPORT_WINDOW_KEY = "full";
|
|
@@ -6590,7 +6833,8 @@ function createLayoutEngine(options = {}) {
|
|
|
6590
6833
|
fragmentsByPageIndex,
|
|
6591
6834
|
lineBoxesByPageIndex,
|
|
6592
6835
|
noteAllocationsByPageIndex: pageStack.noteAllocationsByPageIndex,
|
|
6593
|
-
subParts: document2.subParts
|
|
6836
|
+
subParts: document2.subParts,
|
|
6837
|
+
anchors: layoutInputs.anchors
|
|
6594
6838
|
});
|
|
6595
6839
|
const graph = applyViewportWindowMaterialization(
|
|
6596
6840
|
measuredGraph,
|
|
@@ -6725,7 +6969,8 @@ function createLayoutEngine(options = {}) {
|
|
|
6725
6969
|
fragmentsByPageIndex: freshFragmentsByPageIndex,
|
|
6726
6970
|
lineBoxesByPageIndex: freshLineBoxesByPageIndex,
|
|
6727
6971
|
noteAllocationsByPageIndex: freshResult.noteAllocationsByPageIndex,
|
|
6728
|
-
subParts: document2.subParts
|
|
6972
|
+
subParts: document2.subParts,
|
|
6973
|
+
anchors: layoutInputs.anchors
|
|
6729
6974
|
});
|
|
6730
6975
|
const freshNodes = freshGraph.pages;
|
|
6731
6976
|
const splicedGraph = spliceGraph(priorGraph, freshNodes, firstDirty, convergedTailStart);
|
package/dist/compare.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-
|
|
1
|
+
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CG2TgAzj.cjs';
|
|
2
2
|
|
|
3
3
|
type OpcCompressionMethod = "store" | "deflate";
|
|
4
4
|
type OpcSurfaceKind = "content" | "relationships" | "content-types";
|
package/dist/compare.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-
|
|
1
|
+
import { C as CanonicalDocument, B as BlockNode } from './canonical-document-CG2TgAzj.js';
|
|
2
2
|
|
|
3
3
|
type OpcCompressionMethod = "store" | "deflate";
|
|
4
4
|
type OpcSurfaceKind = "content" | "relationships" | "content-types";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'prosemirror-state';
|
|
2
2
|
import 'prosemirror-model';
|
|
3
|
-
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-
|
|
4
|
-
import '../../canonical-document-
|
|
3
|
+
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-DajNGKV4.cjs';
|
|
4
|
+
import '../../canonical-document-CG2TgAzj.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'prosemirror-state';
|
|
2
2
|
import 'prosemirror-model';
|
|
3
|
-
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-
|
|
4
|
-
import '../../canonical-document-
|
|
3
|
+
export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-CNnMHZM9.js';
|
|
4
|
+
import '../../canonical-document-CG2TgAzj.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
@@ -898,12 +898,13 @@ function buildBlockCacheSignature(context, blockIndex) {
|
|
|
898
898
|
owner?.targetKey ?? ""
|
|
899
899
|
].join("|");
|
|
900
900
|
}
|
|
901
|
-
function collectEditableTargetsInBlocks(blocks, context, targets, cache) {
|
|
901
|
+
function collectEditableTargetsInBlocks(blocks, context, targets, cache, blockIndexOffset = 0) {
|
|
902
902
|
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
903
903
|
const block = blocks[blockIndex];
|
|
904
904
|
if (!block) continue;
|
|
905
|
-
const
|
|
906
|
-
const
|
|
905
|
+
const absoluteBlockIndex = blockIndex + blockIndexOffset;
|
|
906
|
+
const blockPath = `${context.basePath}/block[${absoluteBlockIndex}]`;
|
|
907
|
+
const signature = cache !== void 0 ? buildBlockCacheSignature(context, absoluteBlockIndex) : "";
|
|
907
908
|
if (cache !== void 0) {
|
|
908
909
|
const cached = cache.get(block);
|
|
909
910
|
if (cached !== void 0 && cached.blockPath === blockPath && cached.signature === signature) {
|
|
@@ -5569,6 +5570,8 @@ function createSurfaceBlock(block, document, cursor, counters, formattingContext
|
|
|
5569
5570
|
formattingContext,
|
|
5570
5571
|
promoteSecondaryStoryTextBoxes,
|
|
5571
5572
|
cullBuild,
|
|
5573
|
+
editableTargetsByBlockPath,
|
|
5574
|
+
blockPath,
|
|
5572
5575
|
blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0
|
|
5573
5576
|
);
|
|
5574
5577
|
}
|
|
@@ -5975,7 +5978,7 @@ function getRecursableSdtBlockedReasonCode(block) {
|
|
|
5975
5978
|
].filter(Boolean).join(" ").toLowerCase();
|
|
5976
5979
|
return searchText.includes("table of contents") || /\btoc\b/u.test(searchText) ? "workflow_preserve_only" : null;
|
|
5977
5980
|
}
|
|
5978
|
-
function createParagraphBlock(paragraphIndex, paragraph, document, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTarget) {
|
|
5981
|
+
function createParagraphBlock(paragraphIndex, paragraph, document, start, formattingContext, promoteSecondaryStoryTextBoxes, cullBuild = false, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, blockPath, editableTarget) {
|
|
5979
5982
|
const themeResolver = formattingContext.theme;
|
|
5980
5983
|
const effectiveNumbering = formattingContext.resolveEffectiveParagraphNumbering(paragraph);
|
|
5981
5984
|
let resolvedNumbering = null;
|
|
@@ -6040,6 +6043,8 @@ function createParagraphBlock(paragraphIndex, paragraph, document, start, format
|
|
|
6040
6043
|
document,
|
|
6041
6044
|
cursor,
|
|
6042
6045
|
promoteSecondaryStoryTextBoxes,
|
|
6046
|
+
blockPath !== void 0 ? `${blockPath}/inline[${childIndex}]` : void 0,
|
|
6047
|
+
editableTargetsByBlockPath,
|
|
6043
6048
|
void 0,
|
|
6044
6049
|
cullBuild,
|
|
6045
6050
|
themeResolver,
|
|
@@ -6096,7 +6101,7 @@ function isVisibleTocResultInline(node) {
|
|
|
6096
6101
|
return false;
|
|
6097
6102
|
}
|
|
6098
6103
|
}
|
|
6099
|
-
function appendInlineSegments(paragraph, node, document, start, promoteSecondaryStoryTextBoxes, hyperlinkHref, cullBuild = false, themeResolver, formattingContext) {
|
|
6104
|
+
function appendInlineSegments(paragraph, node, document, start, promoteSecondaryStoryTextBoxes, inlinePath, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH, hyperlinkHref, cullBuild = false, themeResolver, formattingContext) {
|
|
6100
6105
|
switch (node.type) {
|
|
6101
6106
|
case "text": {
|
|
6102
6107
|
const cloned = node.marks ? cloneMarks2(node.marks) : { marks: [] };
|
|
@@ -6149,13 +6154,16 @@ function appendInlineSegments(paragraph, node, document, start, promoteSecondary
|
|
|
6149
6154
|
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
6150
6155
|
case "hyperlink": {
|
|
6151
6156
|
let cursor = start;
|
|
6152
|
-
for (
|
|
6157
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex += 1) {
|
|
6158
|
+
const child = node.children[childIndex];
|
|
6153
6159
|
const result = appendInlineSegments(
|
|
6154
6160
|
paragraph,
|
|
6155
6161
|
child,
|
|
6156
6162
|
document,
|
|
6157
6163
|
cursor,
|
|
6158
6164
|
promoteSecondaryStoryTextBoxes,
|
|
6165
|
+
inlinePath !== void 0 ? `${inlinePath}/child[${childIndex}]` : void 0,
|
|
6166
|
+
editableTargetsByBlockPath,
|
|
6159
6167
|
node.href,
|
|
6160
6168
|
cullBuild,
|
|
6161
6169
|
themeResolver,
|
|
@@ -6214,6 +6222,33 @@ function appendInlineSegments(paragraph, node, document, start, promoteSecondary
|
|
|
6214
6222
|
if (isMicrosoftSensitivityLabelShape(node)) {
|
|
6215
6223
|
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
6216
6224
|
}
|
|
6225
|
+
if (node.isTextBox && node.txbxBlocks !== void 0) {
|
|
6226
|
+
const txbxTextSegment = extractTxbxFirstTextSegment(node.txbxBlocks);
|
|
6227
|
+
const txbxText = txbxTextSegment?.text ?? node.text;
|
|
6228
|
+
const txbxBody = surfaceTextBoxBodyFromShape(
|
|
6229
|
+
node,
|
|
6230
|
+
void 0,
|
|
6231
|
+
inlinePath,
|
|
6232
|
+
editableTargetsByBlockPath
|
|
6233
|
+
);
|
|
6234
|
+
paragraph.segments.push({
|
|
6235
|
+
segmentId: `${paragraph.blockId}-segment-${paragraph.segments.length}`,
|
|
6236
|
+
kind: "shape",
|
|
6237
|
+
from: start,
|
|
6238
|
+
to: start + 1,
|
|
6239
|
+
label: "Text box",
|
|
6240
|
+
detail: createShapeDetail(node),
|
|
6241
|
+
...node.geometry !== void 0 ? { geometry: node.geometry } : {},
|
|
6242
|
+
isTextBox: true,
|
|
6243
|
+
...node.textBoxBody ? { textBoxBody: node.textBoxBody } : {},
|
|
6244
|
+
...node.preserveOnlyObject ? { preserveOnlyObject: surfacePreserveOnlyObject(node.preserveOnlyObject) } : {},
|
|
6245
|
+
...txbxText ? { txbxText } : {},
|
|
6246
|
+
...txbxBody ? { txbxBody } : {},
|
|
6247
|
+
...txbxTextSegment?.marks && txbxTextSegment.marks.length > 0 ? { txbxMarks: txbxTextSegment.marks } : {},
|
|
6248
|
+
...txbxTextSegment?.markAttrs ? { txbxMarkAttrs: txbxTextSegment.markAttrs } : {}
|
|
6249
|
+
});
|
|
6250
|
+
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
6251
|
+
}
|
|
6217
6252
|
if (promoteSecondaryStoryTextBoxes && node.isTextBox && node.text) {
|
|
6218
6253
|
return appendTextBoxSegment(
|
|
6219
6254
|
paragraph,
|
|
@@ -6273,7 +6308,7 @@ function appendInlineSegments(paragraph, node, document, start, promoteSecondary
|
|
|
6273
6308
|
const anchor = surfaceAnchorFromGeometry(node.anchor);
|
|
6274
6309
|
const txbxTextSegment = c.isTextBox ? extractTxbxFirstTextSegment(c.txbxBlocks) : void 0;
|
|
6275
6310
|
const txbxText = txbxTextSegment?.text ?? (c.isTextBox ? c.text : void 0);
|
|
6276
|
-
const txbxBody = c.isTextBox ? surfaceTextBoxBodyFromShape(c, node.sourceRef) : void 0;
|
|
6311
|
+
const txbxBody = c.isTextBox ? surfaceTextBoxBodyFromShape(c, node.sourceRef, inlinePath, editableTargetsByBlockPath) : void 0;
|
|
6277
6312
|
const surfaceFill = c.fill;
|
|
6278
6313
|
paragraph.segments.push({
|
|
6279
6314
|
segmentId: `${paragraph.blockId}-segment-${paragraph.segments.length}`,
|
|
@@ -6450,13 +6485,16 @@ function appendInlineSegments(paragraph, node, document, start, promoteSecondary
|
|
|
6450
6485
|
const refHyperlinkHref = (node.fieldFamily === "REF" || node.fieldFamily === "PAGEREF" || node.fieldFamily === "NOTEREF") && node.switches?.hyperlink === true && node.fieldTarget ? `#${node.fieldTarget}` : void 0;
|
|
6451
6486
|
let cursor = start;
|
|
6452
6487
|
const lockedIds = [];
|
|
6453
|
-
for (
|
|
6488
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex += 1) {
|
|
6489
|
+
const child = node.children[childIndex];
|
|
6454
6490
|
const result = appendInlineSegments(
|
|
6455
6491
|
paragraph,
|
|
6456
6492
|
child,
|
|
6457
6493
|
document,
|
|
6458
6494
|
cursor,
|
|
6459
6495
|
promoteSecondaryStoryTextBoxes,
|
|
6496
|
+
inlinePath !== void 0 ? `${inlinePath}/child[${childIndex}]` : void 0,
|
|
6497
|
+
editableTargetsByBlockPath,
|
|
6460
6498
|
refHyperlinkHref ?? hyperlinkHref,
|
|
6461
6499
|
cullBuild,
|
|
6462
6500
|
themeResolver,
|
|
@@ -6703,7 +6741,7 @@ function extractTxbxFirstTextSegment(blocks) {
|
|
|
6703
6741
|
}
|
|
6704
6742
|
return void 0;
|
|
6705
6743
|
}
|
|
6706
|
-
function surfaceTextBoxBodyFromShape(shape, sourceRef) {
|
|
6744
|
+
function surfaceTextBoxBodyFromShape(shape, sourceRef, inlinePath, editableTargetsByBlockPath = EMPTY_EDITABLE_TARGETS_BY_BLOCK_PATH) {
|
|
6707
6745
|
if (!shape.isTextBox && shape.txbxContentXml === void 0 && shape.txbxBlocks === void 0) {
|
|
6708
6746
|
return void 0;
|
|
6709
6747
|
}
|
|
@@ -6729,9 +6767,12 @@ function surfaceTextBoxBodyFromShape(shape, sourceRef) {
|
|
|
6729
6767
|
(run, inlineIndex) => surfaceTextBoxRunFromLegacyRun(run, inlineIndex)
|
|
6730
6768
|
) ?? [];
|
|
6731
6769
|
const text = runs.map((run) => run.text ?? "").join("");
|
|
6770
|
+
const blockPath = inlinePath !== void 0 ? `${inlinePath}/txbx/block[${blockIndex}]` : void 0;
|
|
6771
|
+
const editableTarget = blockPath !== void 0 ? editableTargetsByBlockPath.get(blockPath) : void 0;
|
|
6732
6772
|
return [{
|
|
6733
6773
|
...block.sourceRef !== void 0 ? { sourceRef: block.sourceRef } : {},
|
|
6734
6774
|
blockIndex,
|
|
6775
|
+
...editableTarget !== void 0 ? { editableTarget } : {},
|
|
6735
6776
|
text,
|
|
6736
6777
|
textLength: Array.from(text).length,
|
|
6737
6778
|
...block.borders !== void 0 ? { borders: block.borders } : {},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-
|
|
1
|
+
import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-DajNGKV4.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'yjs';
|
|
4
4
|
import 'y-protocols/awareness';
|
|
5
|
-
import '../../canonical-document-
|
|
5
|
+
import '../../canonical-document-CG2TgAzj.cjs';
|
|
6
6
|
import 'prosemirror-state';
|
|
7
7
|
import 'prosemirror-model';
|
|
8
8
|
|