@beyondwork/docx-react-component 1.0.132 → 1.0.133
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 +158 -67
- package/dist/api/public-types.d.cts +1 -1
- package/dist/api/public-types.d.ts +1 -1
- package/dist/api/public-types.js +3 -3
- package/dist/api/v3.cjs +9326 -7478
- package/dist/api/v3.d.cts +2 -2
- package/dist/api/v3.d.ts +2 -2
- package/dist/api/v3.js +10 -10
- package/dist/{chunk-XYTWOJII.js → chunk-224TSMEB.js} +635 -89
- package/dist/{chunk-43JAPM2F.js → chunk-3JEE5RJU.js} +92 -131
- package/dist/{chunk-UP2KDOYE.js → chunk-57HTKX3P.js} +6 -2
- package/dist/{chunk-RYMMKOFI.js → chunk-5KTJKTNE.js} +32 -0
- package/dist/{chunk-LPLJZJT2.js → chunk-CVSD3UNK.js} +128 -69
- package/dist/{chunk-JVTDBX67.js → chunk-EFEW7BTT.js} +2 -2
- package/dist/{chunk-UFPBYJMA.js → chunk-INLRCC4N.js} +2 -2
- package/dist/{chunk-6736GA6J.js → chunk-KL4TZSZV.js} +1 -1
- package/dist/{chunk-N5FTU4HZ.js → chunk-MQ5GAJ54.js} +68 -39
- package/dist/{chunk-W2I47J2Q.js → chunk-NJFKPDNG.js} +216 -2
- package/dist/{chunk-YUHNDEV5.js → chunk-OTRVGNZQ.js} +2934 -1815
- package/dist/{chunk-4HGFJ6Z2.js → chunk-PZIEOEJZ.js} +1 -1
- package/dist/{chunk-C5LXKR54.js → chunk-QTRJLKR2.js} +1 -1
- package/dist/{chunk-SZ6BJA4Q.js → chunk-REFHJ2FN.js} +3 -3
- package/dist/{chunk-ZDYGRO2Z.js → chunk-RP76USJE.js} +1 -1
- package/dist/{chunk-QUTVR72L.js → chunk-S3PEKX6H.js} +246 -43
- package/dist/{chunk-RBWJHRNP.js → chunk-T66OS7MN.js} +8 -3
- package/dist/{chunk-ALWXYGXP.js → chunk-V2JF42SI.js} +2 -2
- package/dist/{chunk-6TLZ6CMP.js → chunk-WDDFU2N2.js} +2 -2
- package/dist/{chunk-U3UMKA7B.js → chunk-XBQFDBXE.js} +1 -1
- package/dist/{chunk-CDEZGLQ3.js → chunk-ZFCZ7XXH.js} +1 -1
- package/dist/core/commands/formatting-commands.d.cts +1 -1
- package/dist/core/commands/formatting-commands.d.ts +1 -1
- package/dist/core/commands/image-commands.cjs +32 -0
- package/dist/core/commands/image-commands.d.cts +1 -1
- package/dist/core/commands/image-commands.d.ts +1 -1
- package/dist/core/commands/image-commands.js +5 -5
- package/dist/core/commands/section-layout-commands.d.cts +1 -1
- package/dist/core/commands/section-layout-commands.d.ts +1 -1
- package/dist/core/commands/style-commands.d.cts +1 -1
- package/dist/core/commands/style-commands.d.ts +1 -1
- package/dist/core/commands/table-structure-commands.cjs +32 -0
- package/dist/core/commands/table-structure-commands.d.cts +1 -1
- package/dist/core/commands/table-structure-commands.d.ts +1 -1
- package/dist/core/commands/table-structure-commands.js +4 -4
- package/dist/core/commands/text-commands.cjs +99 -38
- package/dist/core/commands/text-commands.d.cts +12 -1
- package/dist/core/commands/text-commands.d.ts +12 -1
- package/dist/core/commands/text-commands.js +5 -5
- package/dist/core/selection/mapping.d.cts +1 -1
- package/dist/core/selection/mapping.d.ts +1 -1
- package/dist/core/state/editor-state.d.cts +1 -1
- package/dist/core/state/editor-state.d.ts +1 -1
- package/dist/index.cjs +4827 -2434
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +292 -53
- package/dist/io/docx-session.cjs +7 -2
- package/dist/io/docx-session.d.cts +3 -3
- package/dist/io/docx-session.d.ts +3 -3
- package/dist/io/docx-session.js +4 -4
- package/dist/legal.js +3 -3
- package/dist/{loader-MAa8VpzW.d.cts → loader-B2H99237.d.cts} +2 -2
- package/dist/{loader-CfpeEPAa.d.ts → loader-DfTjqVwn.d.ts} +2 -2
- package/dist/{public-types-Cjs8glST.d.ts → public-types-B5lOUIrP.d.ts} +689 -232
- package/dist/{public-types-KBS6JnOs.d.cts → public-types-S8gTYwKo.d.cts} +689 -232
- package/dist/public-types.cjs +158 -67
- package/dist/public-types.d.cts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/dist/public-types.js +3 -3
- package/dist/runtime/collab.d.cts +2 -2
- package/dist/runtime/collab.d.ts +2 -2
- package/dist/runtime/document-runtime.cjs +1032 -416
- package/dist/runtime/document-runtime.d.cts +1 -1
- package/dist/runtime/document-runtime.d.ts +1 -1
- package/dist/runtime/document-runtime.js +14 -14
- package/dist/{session-CkoH8FoY.d.ts → session-CBDIOYXA.d.ts} +2 -2
- package/dist/{session-wwe0Gib-.d.cts → session-CR2A1hGZ.d.cts} +2 -2
- package/dist/session.cjs +7 -2
- package/dist/session.d.cts +4 -4
- package/dist/session.d.ts +4 -4
- package/dist/session.js +5 -5
- package/dist/tailwind.cjs +398 -105
- package/dist/tailwind.d.cts +1 -1
- package/dist/tailwind.d.ts +1 -1
- package/dist/tailwind.js +7 -7
- package/dist/{types-CH7NWqVL.d.ts → types-B-90ywjU.d.ts} +1 -1
- package/dist/{types-B3SGRW0w.d.cts → types-yty2K-hk.d.cts} +1 -1
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
- package/dist/ui-tailwind.cjs +398 -105
- package/dist/ui-tailwind.d.cts +3 -2
- package/dist/ui-tailwind.d.ts +3 -2
- package/dist/ui-tailwind.js +7 -7
- package/package.json +1 -1
package/dist/tailwind.cjs
CHANGED
|
@@ -2668,6 +2668,43 @@ function TwToolbar(props) {
|
|
|
2668
2668
|
const showPostFormattingDivider = showListActionsInRow || showSpacingActionsInRow || showInsertActionsInRow || showUpdateActionsInRow || showCompactOverflow;
|
|
2669
2669
|
const zoomLabel = typeof zoomLevel === "number" ? `${zoomLevel}%` : zoomLevel === "pageWidth" ? "Fit width" : "Fit page";
|
|
2670
2670
|
const showZoomSteppers = responsiveTier === "wide";
|
|
2671
|
+
const bulletedListState = resolveListCommandControl({
|
|
2672
|
+
canEdit,
|
|
2673
|
+
editDisabledReason,
|
|
2674
|
+
callback: props.onToggleBulletedList,
|
|
2675
|
+
availability: getListCommandAvailability(props.activeListReadback, "toggle-bulleted")
|
|
2676
|
+
});
|
|
2677
|
+
const numberedListState = resolveListCommandControl({
|
|
2678
|
+
canEdit,
|
|
2679
|
+
editDisabledReason,
|
|
2680
|
+
callback: props.onToggleNumberedList,
|
|
2681
|
+
availability: getListCommandAvailability(props.activeListReadback, "toggle-numbered")
|
|
2682
|
+
});
|
|
2683
|
+
const outdentState = resolveListCommandControl({
|
|
2684
|
+
canEdit,
|
|
2685
|
+
editDisabledReason,
|
|
2686
|
+
callback: props.onOutdent,
|
|
2687
|
+
availability: getListCommandAvailability(props.activeListReadback, "outdent")
|
|
2688
|
+
});
|
|
2689
|
+
const indentState = resolveListCommandControl({
|
|
2690
|
+
canEdit,
|
|
2691
|
+
editDisabledReason,
|
|
2692
|
+
callback: props.onIndent,
|
|
2693
|
+
availability: getListCommandAvailability(props.activeListReadback, "indent")
|
|
2694
|
+
});
|
|
2695
|
+
const restartNumberingState = resolveListCommandControl({
|
|
2696
|
+
canEdit,
|
|
2697
|
+
editDisabledReason,
|
|
2698
|
+
callback: props.onRestartNumbering,
|
|
2699
|
+
availability: getListCommandAvailability(props.activeListReadback, "restart-numbering")
|
|
2700
|
+
});
|
|
2701
|
+
const continueNumberingState = resolveListCommandControl({
|
|
2702
|
+
canEdit,
|
|
2703
|
+
editDisabledReason,
|
|
2704
|
+
callback: props.onContinueNumbering,
|
|
2705
|
+
availability: getListCommandAvailability(props.activeListReadback, "continue-numbering")
|
|
2706
|
+
});
|
|
2707
|
+
const activeListKind = props.activeListReadback?.listKind;
|
|
2671
2708
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2672
2709
|
"header",
|
|
2673
2710
|
{
|
|
@@ -2683,7 +2720,7 @@ function TwToolbar(props) {
|
|
|
2683
2720
|
},
|
|
2684
2721
|
className: [
|
|
2685
2722
|
"shrink-0 rounded-[var(--radius-sm)] border border-[var(--color-border-subtle)]",
|
|
2686
|
-
"bg-[var(--color-bg-chrome)] px-2.5",
|
|
2723
|
+
"bg-[var(--color-bg-chrome)] px-2.5 shadow-[var(--shadow-soft)]",
|
|
2687
2724
|
isCompact ? "flex min-h-10 flex-wrap items-center gap-1.5 py-1.5" : "flex items-center gap-1"
|
|
2688
2725
|
].join(" "),
|
|
2689
2726
|
children: [
|
|
@@ -2852,9 +2889,9 @@ function TwToolbar(props) {
|
|
|
2852
2889
|
{
|
|
2853
2890
|
icon: import_lucide_react5.List,
|
|
2854
2891
|
label: "Bulleted list",
|
|
2855
|
-
active: Boolean(props.activeListContext && !props.activeListContext.isOrdered),
|
|
2856
|
-
disabled:
|
|
2857
|
-
disabledReason:
|
|
2892
|
+
active: activeListKind ? activeListKind === "bulleted" : Boolean(props.activeListContext && !props.activeListContext.isOrdered),
|
|
2893
|
+
disabled: bulletedListState.disabled,
|
|
2894
|
+
disabledReason: bulletedListState.disabledReason,
|
|
2858
2895
|
onClick: props.onToggleBulletedList
|
|
2859
2896
|
}
|
|
2860
2897
|
),
|
|
@@ -2863,9 +2900,9 @@ function TwToolbar(props) {
|
|
|
2863
2900
|
{
|
|
2864
2901
|
icon: import_lucide_react5.Rows3,
|
|
2865
2902
|
label: "Numbered list",
|
|
2866
|
-
active: Boolean(props.activeListContext?.isOrdered),
|
|
2867
|
-
disabled:
|
|
2868
|
-
disabledReason:
|
|
2903
|
+
active: activeListKind ? activeListKind === "numbered" : Boolean(props.activeListContext?.isOrdered),
|
|
2904
|
+
disabled: numberedListState.disabled,
|
|
2905
|
+
disabledReason: numberedListState.disabledReason,
|
|
2869
2906
|
onClick: props.onToggleNumberedList
|
|
2870
2907
|
}
|
|
2871
2908
|
)
|
|
@@ -2876,8 +2913,8 @@ function TwToolbar(props) {
|
|
|
2876
2913
|
{
|
|
2877
2914
|
icon: import_lucide_react5.Outdent,
|
|
2878
2915
|
label: "Outdent",
|
|
2879
|
-
disabled:
|
|
2880
|
-
disabledReason:
|
|
2916
|
+
disabled: outdentState.disabled,
|
|
2917
|
+
disabledReason: outdentState.disabledReason,
|
|
2881
2918
|
onClick: props.onOutdent
|
|
2882
2919
|
}
|
|
2883
2920
|
),
|
|
@@ -2886,8 +2923,8 @@ function TwToolbar(props) {
|
|
|
2886
2923
|
{
|
|
2887
2924
|
icon: import_lucide_react5.Indent,
|
|
2888
2925
|
label: "Indent",
|
|
2889
|
-
disabled:
|
|
2890
|
-
disabledReason:
|
|
2926
|
+
disabled: indentState.disabled,
|
|
2927
|
+
disabledReason: indentState.disabledReason,
|
|
2891
2928
|
onClick: props.onIndent
|
|
2892
2929
|
}
|
|
2893
2930
|
)
|
|
@@ -2897,8 +2934,8 @@ function TwToolbar(props) {
|
|
|
2897
2934
|
ToolbarTextButton,
|
|
2898
2935
|
{
|
|
2899
2936
|
ariaLabel: "Restart numbering",
|
|
2900
|
-
disabled:
|
|
2901
|
-
disabledReason:
|
|
2937
|
+
disabled: restartNumberingState.disabled,
|
|
2938
|
+
disabledReason: restartNumberingState.disabledReason,
|
|
2902
2939
|
onClick: props.onRestartNumbering,
|
|
2903
2940
|
children: "Restart"
|
|
2904
2941
|
}
|
|
@@ -2907,8 +2944,8 @@ function TwToolbar(props) {
|
|
|
2907
2944
|
ToolbarTextButton,
|
|
2908
2945
|
{
|
|
2909
2946
|
ariaLabel: "Continue numbering",
|
|
2910
|
-
disabled:
|
|
2911
|
-
disabledReason:
|
|
2947
|
+
disabled: continueNumberingState.disabled,
|
|
2948
|
+
disabledReason: continueNumberingState.disabledReason,
|
|
2912
2949
|
onClick: props.onContinueNumbering,
|
|
2913
2950
|
children: "Continue"
|
|
2914
2951
|
}
|
|
@@ -2952,6 +2989,7 @@ function TwToolbar(props) {
|
|
|
2952
2989
|
ToolbarCompactOverflow,
|
|
2953
2990
|
{
|
|
2954
2991
|
activeListContext: props.activeListContext,
|
|
2992
|
+
activeListReadback: props.activeListReadback,
|
|
2955
2993
|
canEdit,
|
|
2956
2994
|
canInsertStructural,
|
|
2957
2995
|
editDisabledReason,
|
|
@@ -3485,8 +3523,59 @@ function ToolbarFontSizeSelect(props) {
|
|
|
3485
3523
|
}
|
|
3486
3524
|
);
|
|
3487
3525
|
}
|
|
3526
|
+
function getListCommandAvailability(readback, command) {
|
|
3527
|
+
return readback?.commandSupport.find((entry) => entry.command === command);
|
|
3528
|
+
}
|
|
3529
|
+
function resolveListCommandControl(input) {
|
|
3530
|
+
if (!input.canEdit) {
|
|
3531
|
+
return { disabled: true, disabledReason: input.editDisabledReason };
|
|
3532
|
+
}
|
|
3533
|
+
if (!input.callback) {
|
|
3534
|
+
return { disabled: true };
|
|
3535
|
+
}
|
|
3536
|
+
if (input.availability?.enabled === false) {
|
|
3537
|
+
return { disabled: true, disabledReason: input.availability.reason };
|
|
3538
|
+
}
|
|
3539
|
+
return { disabled: false };
|
|
3540
|
+
}
|
|
3488
3541
|
function ToolbarCompactOverflow(props) {
|
|
3489
3542
|
const [open, setOpen] = import_react4.default.useState(false);
|
|
3543
|
+
const bulletedListState = resolveListCommandControl({
|
|
3544
|
+
canEdit: props.canEdit,
|
|
3545
|
+
editDisabledReason: props.editDisabledReason,
|
|
3546
|
+
callback: props.onToggleBulletedList,
|
|
3547
|
+
availability: getListCommandAvailability(props.activeListReadback, "toggle-bulleted")
|
|
3548
|
+
});
|
|
3549
|
+
const numberedListState = resolveListCommandControl({
|
|
3550
|
+
canEdit: props.canEdit,
|
|
3551
|
+
editDisabledReason: props.editDisabledReason,
|
|
3552
|
+
callback: props.onToggleNumberedList,
|
|
3553
|
+
availability: getListCommandAvailability(props.activeListReadback, "toggle-numbered")
|
|
3554
|
+
});
|
|
3555
|
+
const outdentState = resolveListCommandControl({
|
|
3556
|
+
canEdit: props.canEdit,
|
|
3557
|
+
editDisabledReason: props.editDisabledReason,
|
|
3558
|
+
callback: props.onOutdent,
|
|
3559
|
+
availability: getListCommandAvailability(props.activeListReadback, "outdent")
|
|
3560
|
+
});
|
|
3561
|
+
const indentState = resolveListCommandControl({
|
|
3562
|
+
canEdit: props.canEdit,
|
|
3563
|
+
editDisabledReason: props.editDisabledReason,
|
|
3564
|
+
callback: props.onIndent,
|
|
3565
|
+
availability: getListCommandAvailability(props.activeListReadback, "indent")
|
|
3566
|
+
});
|
|
3567
|
+
const restartNumberingState = resolveListCommandControl({
|
|
3568
|
+
canEdit: props.canEdit,
|
|
3569
|
+
editDisabledReason: props.editDisabledReason,
|
|
3570
|
+
callback: props.onRestartNumbering,
|
|
3571
|
+
availability: getListCommandAvailability(props.activeListReadback, "restart-numbering")
|
|
3572
|
+
});
|
|
3573
|
+
const continueNumberingState = resolveListCommandControl({
|
|
3574
|
+
canEdit: props.canEdit,
|
|
3575
|
+
editDisabledReason: props.editDisabledReason,
|
|
3576
|
+
callback: props.onContinueNumbering,
|
|
3577
|
+
availability: getListCommandAvailability(props.activeListReadback, "continue-numbering")
|
|
3578
|
+
});
|
|
3490
3579
|
const overflowGroups = [
|
|
3491
3580
|
props.showStyleSelectors || props.showInlineFormatting || props.showTextColors ? "Format" : null,
|
|
3492
3581
|
props.showListActions || props.showParagraphActions || props.showParagraphAlignment || props.showListContinuation ? "Paragraph" : null,
|
|
@@ -3703,8 +3792,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3703
3792
|
ToolbarMenuButton,
|
|
3704
3793
|
{
|
|
3705
3794
|
ariaLabel: "Bulleted list",
|
|
3706
|
-
disabled:
|
|
3707
|
-
disabledReason:
|
|
3795
|
+
disabled: bulletedListState.disabled,
|
|
3796
|
+
disabledReason: bulletedListState.disabledReason,
|
|
3708
3797
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.List, { className: "h-3.5 w-3.5" }),
|
|
3709
3798
|
label: "Bulleted list",
|
|
3710
3799
|
onClick: () => {
|
|
@@ -3717,8 +3806,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3717
3806
|
ToolbarMenuButton,
|
|
3718
3807
|
{
|
|
3719
3808
|
ariaLabel: "Numbered list",
|
|
3720
|
-
disabled:
|
|
3721
|
-
disabledReason:
|
|
3809
|
+
disabled: numberedListState.disabled,
|
|
3810
|
+
disabledReason: numberedListState.disabledReason,
|
|
3722
3811
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Rows3, { className: "h-3.5 w-3.5" }),
|
|
3723
3812
|
label: "Numbered list",
|
|
3724
3813
|
onClick: () => {
|
|
@@ -3747,8 +3836,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3747
3836
|
ToolbarMenuButton,
|
|
3748
3837
|
{
|
|
3749
3838
|
ariaLabel: "Outdent",
|
|
3750
|
-
disabled:
|
|
3751
|
-
disabledReason:
|
|
3839
|
+
disabled: outdentState.disabled,
|
|
3840
|
+
disabledReason: outdentState.disabledReason,
|
|
3752
3841
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Outdent, { className: "h-3.5 w-3.5" }),
|
|
3753
3842
|
label: "Outdent",
|
|
3754
3843
|
onClick: () => {
|
|
@@ -3761,8 +3850,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3761
3850
|
ToolbarMenuButton,
|
|
3762
3851
|
{
|
|
3763
3852
|
ariaLabel: "Indent",
|
|
3764
|
-
disabled:
|
|
3765
|
-
disabledReason:
|
|
3853
|
+
disabled: indentState.disabled,
|
|
3854
|
+
disabledReason: indentState.disabledReason,
|
|
3766
3855
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Indent, { className: "h-3.5 w-3.5" }),
|
|
3767
3856
|
label: "Indent",
|
|
3768
3857
|
onClick: () => {
|
|
@@ -3777,8 +3866,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3777
3866
|
ToolbarMenuButton,
|
|
3778
3867
|
{
|
|
3779
3868
|
ariaLabel: "Restart numbering",
|
|
3780
|
-
disabled:
|
|
3781
|
-
disabledReason:
|
|
3869
|
+
disabled: restartNumberingState.disabled,
|
|
3870
|
+
disabledReason: restartNumberingState.disabledReason,
|
|
3782
3871
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Rows3, { className: "h-3.5 w-3.5" }),
|
|
3783
3872
|
label: "Restart numbering",
|
|
3784
3873
|
onClick: () => {
|
|
@@ -3791,8 +3880,8 @@ function ToolbarCompactOverflow(props) {
|
|
|
3791
3880
|
ToolbarMenuButton,
|
|
3792
3881
|
{
|
|
3793
3882
|
ariaLabel: "Continue numbering",
|
|
3794
|
-
disabled:
|
|
3795
|
-
disabledReason:
|
|
3883
|
+
disabled: continueNumberingState.disabled,
|
|
3884
|
+
disabledReason: continueNumberingState.disabledReason,
|
|
3796
3885
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.Rows3, { className: "h-3.5 w-3.5" }),
|
|
3797
3886
|
label: "Continue numbering",
|
|
3798
3887
|
onClick: () => {
|
|
@@ -9131,7 +9220,20 @@ function sourceJoinHash(refs) {
|
|
|
9131
9220
|
if (sourceIds.length === 0) return void 0;
|
|
9132
9221
|
return hashText(sourceIds.join("\0"));
|
|
9133
9222
|
}
|
|
9223
|
+
var numberingCatalogHashCache = /* @__PURE__ */ new WeakMap();
|
|
9224
|
+
var numberingTargetHashCache = /* @__PURE__ */ new WeakMap();
|
|
9134
9225
|
function createNumberingCatalogRevisionHash(doc) {
|
|
9226
|
+
const numbering = doc.numbering;
|
|
9227
|
+
if (numbering !== void 0) {
|
|
9228
|
+
const cached = numberingCatalogHashCache.get(numbering);
|
|
9229
|
+
if (cached !== void 0) return cached;
|
|
9230
|
+
const fresh = computeNumberingCatalogRevisionHash(doc);
|
|
9231
|
+
numberingCatalogHashCache.set(numbering, fresh);
|
|
9232
|
+
return fresh;
|
|
9233
|
+
}
|
|
9234
|
+
return computeNumberingCatalogRevisionHash(doc);
|
|
9235
|
+
}
|
|
9236
|
+
function computeNumberingCatalogRevisionHash(doc) {
|
|
9135
9237
|
const catalog = doc.numbering ?? { abstractDefinitions: {}, instances: {} };
|
|
9136
9238
|
const abstractDefinitions = catalog.abstractDefinitions ?? {};
|
|
9137
9239
|
const instances = catalog.instances ?? {};
|
|
@@ -9182,8 +9284,27 @@ function createNumberingCatalogRevisionHash(doc) {
|
|
|
9182
9284
|
}));
|
|
9183
9285
|
}
|
|
9184
9286
|
function createNumberingTargetRevisionHash(doc) {
|
|
9287
|
+
const numbering = doc.numbering;
|
|
9288
|
+
const styles = doc.styles;
|
|
9289
|
+
if (numbering !== void 0 && styles !== void 0) {
|
|
9290
|
+
let inner = numberingTargetHashCache.get(numbering);
|
|
9291
|
+
if (inner === void 0) {
|
|
9292
|
+
inner = /* @__PURE__ */ new WeakMap();
|
|
9293
|
+
numberingTargetHashCache.set(numbering, inner);
|
|
9294
|
+
}
|
|
9295
|
+
const cached = inner.get(styles);
|
|
9296
|
+
if (cached !== void 0) return cached;
|
|
9297
|
+
const fresh = computeNumberingTargetRevisionHash(doc);
|
|
9298
|
+
inner.set(styles, fresh);
|
|
9299
|
+
return fresh;
|
|
9300
|
+
}
|
|
9301
|
+
return computeNumberingTargetRevisionHash(doc);
|
|
9302
|
+
}
|
|
9303
|
+
function computeNumberingTargetRevisionHash(doc) {
|
|
9185
9304
|
const paragraphStyles = doc.styles?.paragraphs ?? {};
|
|
9186
9305
|
return hashText(JSON.stringify({
|
|
9306
|
+
// Reuses the memoized catalog hash on the hot path so a typing edit
|
|
9307
|
+
// pays for the catalog hash at most once across both helpers.
|
|
9187
9308
|
numberingCatalogHash: createNumberingCatalogRevisionHash(doc),
|
|
9188
9309
|
paragraphStyleNumbering: Object.keys(paragraphStyles).sort().map((styleId) => {
|
|
9189
9310
|
const style = paragraphStyles[styleId];
|
|
@@ -20368,7 +20489,7 @@ function fnv1a2(input) {
|
|
|
20368
20489
|
}
|
|
20369
20490
|
|
|
20370
20491
|
// src/runtime/layout/layout-engine-version.ts
|
|
20371
|
-
var LAYOUT_ENGINE_VERSION =
|
|
20492
|
+
var LAYOUT_ENGINE_VERSION = 94;
|
|
20372
20493
|
|
|
20373
20494
|
// src/runtime/layout/layout-engine-instance.ts
|
|
20374
20495
|
var FULL_VIEWPORT_WINDOW_KEY = "full";
|
|
@@ -20594,11 +20715,45 @@ function createLayoutEngine(options = {}) {
|
|
|
20594
20715
|
const telemetryBus = options.telemetryBus;
|
|
20595
20716
|
const dirtyFieldFamilies = /* @__PURE__ */ new Set();
|
|
20596
20717
|
const listeners = /* @__PURE__ */ new Set();
|
|
20597
|
-
let
|
|
20598
|
-
let
|
|
20599
|
-
let cachedFormatting = null;
|
|
20600
|
-
let cachedMapper = null;
|
|
20718
|
+
let cachedFull = null;
|
|
20719
|
+
let cachedWindowed = null;
|
|
20601
20720
|
let previousPageCount = 0;
|
|
20721
|
+
function isFullViewportKey(key) {
|
|
20722
|
+
return key === FULL_VIEWPORT_WINDOW_KEY;
|
|
20723
|
+
}
|
|
20724
|
+
function getCachedSlot(viewportWindowKeyValue) {
|
|
20725
|
+
return isFullViewportKey(viewportWindowKeyValue) ? cachedFull : cachedWindowed;
|
|
20726
|
+
}
|
|
20727
|
+
function preferredCachedGraph() {
|
|
20728
|
+
return cachedFull?.graph ?? cachedWindowed?.graph ?? null;
|
|
20729
|
+
}
|
|
20730
|
+
function clearAllSlots() {
|
|
20731
|
+
cachedFull = null;
|
|
20732
|
+
cachedWindowed = null;
|
|
20733
|
+
}
|
|
20734
|
+
function clearWindowedSlot() {
|
|
20735
|
+
cachedWindowed = null;
|
|
20736
|
+
}
|
|
20737
|
+
function evictStaleSiblingSlot(freshKey) {
|
|
20738
|
+
const sibling = isFullViewportKey(freshKey.viewportWindowKey) ? cachedWindowed : cachedFull;
|
|
20739
|
+
if (sibling === null) return;
|
|
20740
|
+
if (sibling.key.content === freshKey.content && sibling.key.styles === freshKey.styles && sibling.key.subParts === freshKey.subParts) {
|
|
20741
|
+
return;
|
|
20742
|
+
}
|
|
20743
|
+
if (isFullViewportKey(freshKey.viewportWindowKey)) {
|
|
20744
|
+
cachedWindowed = null;
|
|
20745
|
+
} else {
|
|
20746
|
+
cachedFull = null;
|
|
20747
|
+
}
|
|
20748
|
+
}
|
|
20749
|
+
function commitSlot(slot) {
|
|
20750
|
+
if (isFullViewportKey(slot.key.viewportWindowKey)) {
|
|
20751
|
+
cachedFull = slot;
|
|
20752
|
+
} else {
|
|
20753
|
+
cachedWindowed = slot;
|
|
20754
|
+
}
|
|
20755
|
+
evictStaleSiblingSlot(slot.key);
|
|
20756
|
+
}
|
|
20602
20757
|
let pendingInvalidation = null;
|
|
20603
20758
|
function emit(event) {
|
|
20604
20759
|
for (const listener of listeners) {
|
|
@@ -20744,27 +20899,31 @@ function createLayoutEngine(options = {}) {
|
|
|
20744
20899
|
subParts: document2.subParts,
|
|
20745
20900
|
anchors: layoutInputs.anchors
|
|
20746
20901
|
});
|
|
20902
|
+
const priorGraphForMaterialization = preferredCachedGraph();
|
|
20747
20903
|
const graph = applyViewportWindowMaterialization(
|
|
20748
20904
|
measuredGraph,
|
|
20749
20905
|
viewportWindow,
|
|
20750
|
-
|
|
20906
|
+
priorGraphForMaterialization
|
|
20751
20907
|
);
|
|
20752
|
-
const
|
|
20908
|
+
const priorGraphForFieldDirtiness = preferredCachedGraph();
|
|
20909
|
+
const dirtyFamilies = computeFieldDirtiness(priorGraphForFieldDirtiness, graph);
|
|
20753
20910
|
for (const family of dirtyFamilies) {
|
|
20754
20911
|
dirtyFieldFamilies.add(family);
|
|
20755
20912
|
}
|
|
20756
20913
|
const formatting = buildResolvedFormattingState(document2, mainSurface);
|
|
20757
20914
|
const currentPageCount = graph.contentPageCount;
|
|
20758
20915
|
const pageCountDelta = currentPageCount !== previousPageCount ? { previous: previousPageCount, current: currentPageCount } : void 0;
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20916
|
+
commitSlot({
|
|
20917
|
+
key: {
|
|
20918
|
+
content: document2.content,
|
|
20919
|
+
styles: document2.styles,
|
|
20920
|
+
subParts: document2.subParts,
|
|
20921
|
+
viewportWindowKey: viewportWindowKey(viewportWindow)
|
|
20922
|
+
},
|
|
20923
|
+
graph,
|
|
20924
|
+
formatting,
|
|
20925
|
+
mapper: createPageFragmentMapper(graph)
|
|
20926
|
+
});
|
|
20768
20927
|
if (pageCountDelta) {
|
|
20769
20928
|
emit({
|
|
20770
20929
|
kind: "page_count_changed",
|
|
@@ -20805,7 +20964,7 @@ function createLayoutEngine(options = {}) {
|
|
|
20805
20964
|
return graph;
|
|
20806
20965
|
}
|
|
20807
20966
|
function incrementalRelayout(input, pending) {
|
|
20808
|
-
const priorGraph =
|
|
20967
|
+
const priorGraph = cachedFull?.graph ?? null;
|
|
20809
20968
|
const range = pending.result.dirtyPageRange;
|
|
20810
20969
|
if (!priorGraph || !range) return null;
|
|
20811
20970
|
const telemetryOn = telemetryBus?.isEnabled("layout") ?? false;
|
|
@@ -20898,6 +21057,22 @@ function createLayoutEngine(options = {}) {
|
|
|
20898
21057
|
deriveDocumentPageSnapshots(splicedGraph)
|
|
20899
21058
|
);
|
|
20900
21059
|
const pageCountDelta = currentPageCount !== previousPageCount ? { previous: previousPageCount, current: currentPageCount } : void 0;
|
|
21060
|
+
const priorMapper = cachedFull?.mapper ?? null;
|
|
21061
|
+
commitSlot({
|
|
21062
|
+
key: {
|
|
21063
|
+
content: document2.content,
|
|
21064
|
+
styles: document2.styles,
|
|
21065
|
+
subParts: document2.subParts,
|
|
21066
|
+
viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
|
|
21067
|
+
},
|
|
21068
|
+
graph: splicedGraph,
|
|
21069
|
+
formatting,
|
|
21070
|
+
mapper: rebuildMapper(
|
|
21071
|
+
priorMapper ?? createPageFragmentMapper(splicedGraph),
|
|
21072
|
+
splicedGraph,
|
|
21073
|
+
firstDirty
|
|
21074
|
+
)
|
|
21075
|
+
});
|
|
20901
21076
|
if (pageCountDelta) {
|
|
20902
21077
|
emit({
|
|
20903
21078
|
kind: "page_count_changed",
|
|
@@ -20927,19 +21102,6 @@ function createLayoutEngine(options = {}) {
|
|
|
20927
21102
|
...dirtyFamilies.length > 0 ? { dirtyFieldFamilies: dirtyFamilies } : {},
|
|
20928
21103
|
...pageCountDelta ? { pageCountDelta } : {}
|
|
20929
21104
|
});
|
|
20930
|
-
cachedKey = {
|
|
20931
|
-
content: document2.content,
|
|
20932
|
-
styles: document2.styles,
|
|
20933
|
-
subParts: document2.subParts,
|
|
20934
|
-
viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
|
|
20935
|
-
};
|
|
20936
|
-
cachedGraph = splicedGraph;
|
|
20937
|
-
cachedFormatting = formatting;
|
|
20938
|
-
cachedMapper = rebuildMapper(
|
|
20939
|
-
cachedMapper ?? createPageFragmentMapper(splicedGraph),
|
|
20940
|
-
splicedGraph,
|
|
20941
|
-
firstDirty
|
|
20942
|
-
);
|
|
20943
21105
|
if (telemetryOn) {
|
|
20944
21106
|
emitRecomputeCompleted(
|
|
20945
21107
|
"bounded",
|
|
@@ -20956,13 +21118,14 @@ function createLayoutEngine(options = {}) {
|
|
|
20956
21118
|
const document2 = input.document;
|
|
20957
21119
|
const normalizedWindow = normalizeViewportPageWindow(input.viewportPageWindow);
|
|
20958
21120
|
const currentViewportWindowKey = viewportWindowKey(normalizedWindow);
|
|
20959
|
-
const
|
|
21121
|
+
const slot = getCachedSlot(currentViewportWindowKey);
|
|
21122
|
+
const keyEqual = slot !== null && slot.key.content === document2.content && slot.key.styles === document2.styles && slot.key.subParts === document2.subParts && slot.key.viewportWindowKey === currentViewportWindowKey;
|
|
20960
21123
|
if (keyEqual && pendingInvalidation === null) {
|
|
20961
|
-
return
|
|
21124
|
+
return slot.graph;
|
|
20962
21125
|
}
|
|
20963
21126
|
const pending = pendingInvalidation;
|
|
20964
21127
|
pendingInvalidation = null;
|
|
20965
|
-
if (pending !== null && pending.result.scope === "bounded" &&
|
|
21128
|
+
if (pending !== null && pending.result.scope === "bounded" && cachedFull !== null && normalizedWindow === void 0) {
|
|
20966
21129
|
const spliced = incrementalRelayout(input, pending);
|
|
20967
21130
|
if (spliced !== null) {
|
|
20968
21131
|
return spliced;
|
|
@@ -20971,16 +21134,39 @@ function createLayoutEngine(options = {}) {
|
|
|
20971
21134
|
}
|
|
20972
21135
|
return fullRebuild(input, pending?.reason);
|
|
20973
21136
|
}
|
|
21137
|
+
function ensureSlotMapperAndFormatting(slot, document2) {
|
|
21138
|
+
if (slot.mapper === null) {
|
|
21139
|
+
slot.mapper = createPageFragmentMapper(slot.graph);
|
|
21140
|
+
}
|
|
21141
|
+
if (slot.formatting === null) {
|
|
21142
|
+
const mainSurface = createEditorSurfaceSnapshot(
|
|
21143
|
+
document2,
|
|
21144
|
+
createSelectionSnapshot(0, 0),
|
|
21145
|
+
MAIN_STORY_TARGET
|
|
21146
|
+
);
|
|
21147
|
+
slot.formatting = buildResolvedFormattingState(document2, mainSurface);
|
|
21148
|
+
}
|
|
21149
|
+
}
|
|
20974
21150
|
function getMapper(input) {
|
|
20975
21151
|
getGraphInternal(input);
|
|
20976
|
-
|
|
21152
|
+
const currentViewportWindowKey = viewportWindowKey(
|
|
21153
|
+
normalizeViewportPageWindow(input.viewportPageWindow)
|
|
21154
|
+
);
|
|
21155
|
+
const slot = getCachedSlot(currentViewportWindowKey);
|
|
21156
|
+
ensureSlotMapperAndFormatting(slot, input.document);
|
|
21157
|
+
return slot.mapper;
|
|
20977
21158
|
}
|
|
20978
21159
|
function getFormatting(input) {
|
|
20979
21160
|
getGraphInternal(input);
|
|
20980
|
-
|
|
21161
|
+
const currentViewportWindowKey = viewportWindowKey(
|
|
21162
|
+
normalizeViewportPageWindow(input.viewportPageWindow)
|
|
21163
|
+
);
|
|
21164
|
+
const slot = getCachedSlot(currentViewportWindowKey);
|
|
21165
|
+
ensureSlotMapperAndFormatting(slot, input.document);
|
|
21166
|
+
return slot.formatting;
|
|
20981
21167
|
}
|
|
20982
21168
|
if (autoUpgradeToCanvas && options.measurementProvider === void 0 && typeof document !== "undefined" && typeof HTMLCanvasElement !== "undefined") {
|
|
20983
|
-
const readCachedRevision = () =>
|
|
21169
|
+
const readCachedRevision = () => preferredCachedGraph()?.revision ?? 0;
|
|
20984
21170
|
void (async () => {
|
|
20985
21171
|
try {
|
|
20986
21172
|
const mod = await Promise.resolve().then(() => (init_measurement_backend_canvas(), measurement_backend_canvas_exports));
|
|
@@ -20990,10 +21176,7 @@ function createLayoutEngine(options = {}) {
|
|
|
20990
21176
|
options.measurementCache,
|
|
20991
21177
|
telemetryBus
|
|
20992
21178
|
);
|
|
20993
|
-
|
|
20994
|
-
cachedGraph = null;
|
|
20995
|
-
cachedFormatting = null;
|
|
20996
|
-
cachedMapper = null;
|
|
21179
|
+
clearAllSlots();
|
|
20997
21180
|
emit({
|
|
20998
21181
|
kind: "measurement_backend_ready",
|
|
20999
21182
|
revision: readCachedRevision(),
|
|
@@ -21037,22 +21220,19 @@ function createLayoutEngine(options = {}) {
|
|
|
21037
21220
|
return getMapper(input);
|
|
21038
21221
|
},
|
|
21039
21222
|
invalidate(reason) {
|
|
21040
|
-
const result = analyzeInvalidation(reason,
|
|
21223
|
+
const result = analyzeInvalidation(reason, preferredCachedGraph());
|
|
21041
21224
|
for (const family of result.dirtyFieldFamilies) {
|
|
21042
21225
|
dirtyFieldFamilies.add(family);
|
|
21043
21226
|
}
|
|
21044
21227
|
if (result.scope === "bounded") {
|
|
21045
21228
|
pendingInvalidation = { reason, result };
|
|
21046
21229
|
} else {
|
|
21047
|
-
|
|
21048
|
-
cachedGraph = null;
|
|
21049
|
-
cachedFormatting = null;
|
|
21050
|
-
cachedMapper = null;
|
|
21230
|
+
clearAllSlots();
|
|
21051
21231
|
pendingInvalidation = { reason, result };
|
|
21052
21232
|
}
|
|
21053
21233
|
},
|
|
21054
21234
|
analyzeInvalidation(reason) {
|
|
21055
|
-
return analyzeInvalidation(reason,
|
|
21235
|
+
return analyzeInvalidation(reason, preferredCachedGraph());
|
|
21056
21236
|
},
|
|
21057
21237
|
getDirtyFieldFamilies() {
|
|
21058
21238
|
return Array.from(dirtyFieldFamilies);
|
|
@@ -21080,14 +21260,11 @@ function createLayoutEngine(options = {}) {
|
|
|
21080
21260
|
telemetryBus
|
|
21081
21261
|
);
|
|
21082
21262
|
if (previousFidelity !== provider.fidelity) {
|
|
21083
|
-
|
|
21084
|
-
cachedGraph = null;
|
|
21085
|
-
cachedFormatting = null;
|
|
21086
|
-
cachedMapper = null;
|
|
21263
|
+
clearAllSlots();
|
|
21087
21264
|
}
|
|
21088
21265
|
emit({
|
|
21089
21266
|
kind: "measurement_backend_ready",
|
|
21090
|
-
revision:
|
|
21267
|
+
revision: preferredCachedGraph()?.revision ?? 0,
|
|
21091
21268
|
fidelity: provider.fidelity
|
|
21092
21269
|
});
|
|
21093
21270
|
},
|
|
@@ -21102,30 +21279,33 @@ function createLayoutEngine(options = {}) {
|
|
|
21102
21279
|
*/
|
|
21103
21280
|
invalidateMeasurementCache() {
|
|
21104
21281
|
measurementProvider.invalidateCache();
|
|
21105
|
-
|
|
21106
|
-
cachedGraph = null;
|
|
21107
|
-
cachedFormatting = null;
|
|
21108
|
-
cachedMapper = null;
|
|
21282
|
+
clearAllSlots();
|
|
21109
21283
|
},
|
|
21110
21284
|
getMeasurementCacheStats() {
|
|
21111
21285
|
if (!isCachedLayoutMeasurementProvider(measurementProvider)) return null;
|
|
21112
21286
|
return measurementProvider.measurementCacheStats();
|
|
21113
21287
|
},
|
|
21114
21288
|
/**
|
|
21115
|
-
* L7 Phase 2.5 — seed the cached graph from a prerender
|
|
21116
|
-
* Populates
|
|
21117
|
-
*
|
|
21118
|
-
* returns the seeded graph directly.
|
|
21119
|
-
* invalidates normally through the existing
|
|
21289
|
+
* L7 Phase 2.5 — seed the full-slot cached graph from a prerender
|
|
21290
|
+
* envelope. Populates the full slot (graph + key, with formatting and
|
|
21291
|
+
* mapper computed lazily on first read) so the next viewport-
|
|
21292
|
+
* independent `getPageGraph` query returns the seeded graph directly.
|
|
21293
|
+
* Any subsequent mutation invalidates normally through the existing
|
|
21294
|
+
* path; sibling eviction in `commitSlot` clears `cachedWindowed` if
|
|
21295
|
+
* it carried a different document tuple.
|
|
21120
21296
|
*/
|
|
21121
21297
|
seedCachedGraph(graph, document2) {
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21128
|
-
|
|
21298
|
+
commitSlot({
|
|
21299
|
+
key: {
|
|
21300
|
+
content: document2.content,
|
|
21301
|
+
styles: document2.styles,
|
|
21302
|
+
subParts: document2.subParts,
|
|
21303
|
+
viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
|
|
21304
|
+
},
|
|
21305
|
+
graph,
|
|
21306
|
+
formatting: null,
|
|
21307
|
+
mapper: null
|
|
21308
|
+
});
|
|
21129
21309
|
previousPageCount = graph.contentPageCount;
|
|
21130
21310
|
}
|
|
21131
21311
|
};
|
|
@@ -22032,7 +22212,17 @@ function TwSelectionToolStructure(props) {
|
|
|
22032
22212
|
onSetCellVerticalAlign: props.onSetCellVerticalAlign
|
|
22033
22213
|
}
|
|
22034
22214
|
);
|
|
22035
|
-
case "list":
|
|
22215
|
+
case "list": {
|
|
22216
|
+
const continueState = resolveListToolbarButtonState({
|
|
22217
|
+
canMutate: props.model.canMutate,
|
|
22218
|
+
callback: props.onContinueNumbering,
|
|
22219
|
+
availability: getListCommandAvailability2(props.activeListReadback, "continue-numbering")
|
|
22220
|
+
});
|
|
22221
|
+
const restartState = resolveListToolbarButtonState({
|
|
22222
|
+
canMutate: props.model.canMutate,
|
|
22223
|
+
callback: props.onRestartNumbering,
|
|
22224
|
+
availability: getListCommandAvailability2(props.activeListReadback, "restart-numbering")
|
|
22225
|
+
});
|
|
22036
22226
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
22037
22227
|
"div",
|
|
22038
22228
|
{
|
|
@@ -22044,7 +22234,8 @@ function TwSelectionToolStructure(props) {
|
|
|
22044
22234
|
ToolbarButton3,
|
|
22045
22235
|
{
|
|
22046
22236
|
ariaLabel: "Continue numbering",
|
|
22047
|
-
disabled:
|
|
22237
|
+
disabled: continueState.disabled,
|
|
22238
|
+
disabledReason: continueState.disabledReason,
|
|
22048
22239
|
onClick: props.onContinueNumbering,
|
|
22049
22240
|
children: "Continue"
|
|
22050
22241
|
}
|
|
@@ -22053,7 +22244,8 @@ function TwSelectionToolStructure(props) {
|
|
|
22053
22244
|
ToolbarButton3,
|
|
22054
22245
|
{
|
|
22055
22246
|
ariaLabel: "Restart numbering",
|
|
22056
|
-
disabled:
|
|
22247
|
+
disabled: restartState.disabled,
|
|
22248
|
+
disabledReason: restartState.disabledReason,
|
|
22057
22249
|
onClick: props.onRestartNumbering,
|
|
22058
22250
|
children: "Restart"
|
|
22059
22251
|
}
|
|
@@ -22061,15 +22253,31 @@ function TwSelectionToolStructure(props) {
|
|
|
22061
22253
|
]
|
|
22062
22254
|
}
|
|
22063
22255
|
);
|
|
22256
|
+
}
|
|
22064
22257
|
}
|
|
22065
22258
|
}
|
|
22259
|
+
function getListCommandAvailability2(readback, command) {
|
|
22260
|
+
return readback?.commandSupport.find((entry) => entry.command === command);
|
|
22261
|
+
}
|
|
22262
|
+
function resolveListToolbarButtonState(input) {
|
|
22263
|
+
if (!input.canMutate || !input.callback) {
|
|
22264
|
+
return { disabled: true };
|
|
22265
|
+
}
|
|
22266
|
+
if (input.availability?.enabled === false) {
|
|
22267
|
+
return { disabled: true, disabledReason: input.availability.reason };
|
|
22268
|
+
}
|
|
22269
|
+
return { disabled: false };
|
|
22270
|
+
}
|
|
22066
22271
|
function ToolbarButton3(props) {
|
|
22272
|
+
const disabledReason = props.disabled && props.disabledReason ? props.disabledReason : void 0;
|
|
22067
22273
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
22068
22274
|
"button",
|
|
22069
22275
|
{
|
|
22070
22276
|
type: "button",
|
|
22071
22277
|
"aria-label": props.ariaLabel,
|
|
22072
22278
|
disabled: props.disabled,
|
|
22279
|
+
"data-disabled-reason": disabledReason,
|
|
22280
|
+
title: disabledReason ? `Not available: ${disabledReason}` : void 0,
|
|
22073
22281
|
onMouseDown: preserveEditorSelectionMouseDown,
|
|
22074
22282
|
onClick: props.onClick,
|
|
22075
22283
|
className: "inline-flex h-7 items-center rounded-md border border-border px-2 text-[length:var(--text-xs)] font-medium text-secondary transition-colors hover:bg-surface disabled:cursor-not-allowed disabled:opacity-40",
|
|
@@ -22458,6 +22666,7 @@ function renderTool(props, tool, density) {
|
|
|
22458
22666
|
onSetImageFrame: props.onSetImageFrame,
|
|
22459
22667
|
onRestartNumbering: props.onRestartNumbering,
|
|
22460
22668
|
onContinueNumbering: props.onContinueNumbering,
|
|
22669
|
+
activeListReadback: props.activeListReadback,
|
|
22461
22670
|
onToggleRowHeader: props.onToggleRowHeader,
|
|
22462
22671
|
onToggleRowCantSplit: props.onToggleRowCantSplit,
|
|
22463
22672
|
onDistributeColumnsEvenly: props.onDistributeColumnsEvenly,
|
|
@@ -24419,6 +24628,7 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
24419
24628
|
group: "clipboard",
|
|
24420
24629
|
targetKinds: [
|
|
24421
24630
|
"plain-text",
|
|
24631
|
+
"list-item",
|
|
24422
24632
|
"table-cell",
|
|
24423
24633
|
"image",
|
|
24424
24634
|
"hyperlink",
|
|
@@ -24437,9 +24647,11 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
24437
24647
|
group: "clipboard",
|
|
24438
24648
|
targetKinds: [
|
|
24439
24649
|
"plain-text",
|
|
24650
|
+
"list-item",
|
|
24440
24651
|
"table-cell",
|
|
24441
24652
|
"image",
|
|
24442
24653
|
"hyperlink",
|
|
24654
|
+
"generated-field",
|
|
24443
24655
|
"suggestion",
|
|
24444
24656
|
"comment-anchor",
|
|
24445
24657
|
"opaque-block",
|
|
@@ -24454,6 +24666,7 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
24454
24666
|
group: "clipboard",
|
|
24455
24667
|
targetKinds: [
|
|
24456
24668
|
"plain-text",
|
|
24669
|
+
"list-item",
|
|
24457
24670
|
"table-cell",
|
|
24458
24671
|
"hyperlink",
|
|
24459
24672
|
"suggestion",
|
|
@@ -24614,28 +24827,28 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
24614
24827
|
id: "list-bulleted",
|
|
24615
24828
|
label: "Bulleted list",
|
|
24616
24829
|
group: "formatting",
|
|
24617
|
-
targetKinds: ["plain-text", "table-cell"],
|
|
24830
|
+
targetKinds: ["list-item", "plain-text", "table-cell"],
|
|
24618
24831
|
callback: "onToggleBulletedList"
|
|
24619
24832
|
}),
|
|
24620
24833
|
mk({
|
|
24621
24834
|
id: "list-numbered",
|
|
24622
24835
|
label: "Numbered list",
|
|
24623
24836
|
group: "formatting",
|
|
24624
|
-
targetKinds: ["plain-text", "table-cell"],
|
|
24837
|
+
targetKinds: ["list-item", "plain-text", "table-cell"],
|
|
24625
24838
|
callback: "onToggleNumberedList"
|
|
24626
24839
|
}),
|
|
24627
24840
|
mk({
|
|
24628
24841
|
id: "paragraph-outdent",
|
|
24629
24842
|
label: "Decrease indent",
|
|
24630
24843
|
group: "formatting",
|
|
24631
|
-
targetKinds: ["plain-text", "table-cell"],
|
|
24844
|
+
targetKinds: ["list-item", "plain-text", "table-cell"],
|
|
24632
24845
|
callback: "onOutdent"
|
|
24633
24846
|
}),
|
|
24634
24847
|
mk({
|
|
24635
24848
|
id: "paragraph-indent",
|
|
24636
24849
|
label: "Increase indent",
|
|
24637
24850
|
group: "formatting",
|
|
24638
|
-
targetKinds: ["plain-text", "table-cell"],
|
|
24851
|
+
targetKinds: ["list-item", "plain-text", "table-cell"],
|
|
24639
24852
|
callback: "onIndent"
|
|
24640
24853
|
}),
|
|
24641
24854
|
mkArg({
|
|
@@ -24984,6 +25197,15 @@ var EDITOR_ACTION_REGISTRY = [
|
|
|
24984
25197
|
targetKinds: ["hyperlink"],
|
|
24985
25198
|
callback: "onOpenHyperlink"
|
|
24986
25199
|
}),
|
|
25200
|
+
// -------- Generated fields --------
|
|
25201
|
+
mk({
|
|
25202
|
+
id: "field-refresh",
|
|
25203
|
+
label: "Refresh field",
|
|
25204
|
+
description: "Refresh generated field results through the runtime field updater.",
|
|
25205
|
+
group: "misc",
|
|
25206
|
+
targetKinds: ["generated-field"],
|
|
25207
|
+
callback: "onUpdateFields"
|
|
25208
|
+
}),
|
|
24987
25209
|
// -------- Workflow scope --------
|
|
24988
25210
|
mk({
|
|
24989
25211
|
id: "scope-open-card",
|
|
@@ -25882,8 +26104,18 @@ function resolveTargetKind(target, options = {}) {
|
|
|
25882
26104
|
const el = toElement(target);
|
|
25883
26105
|
if (el) {
|
|
25884
26106
|
const { root } = options;
|
|
26107
|
+
const insideNumberingMarker = hasAncestorAttributeValue(
|
|
26108
|
+
el,
|
|
26109
|
+
"data-numbering-marker",
|
|
26110
|
+
"true",
|
|
26111
|
+
root
|
|
26112
|
+
);
|
|
26113
|
+
const insideListItem = insideNumberingMarker || hasAncestorAttributeValue(el, "data-numbered", "true", root);
|
|
26114
|
+
const insideGeneratedField = hasAncestorAttributeValue(el, "data-generated-field", "true", root) || hasAncestorAttributeValue(el, "data-node-type", "field_ref_atom", root) || hasAncestorAttributeValue(el, "data-node-type", "field_ref", root);
|
|
26115
|
+
if (insideListItem) kinds.push("list-item");
|
|
26116
|
+
if (insideGeneratedField) kinds.push("generated-field");
|
|
25885
26117
|
if (hasAncestorTag(el, "a", root)) kinds.push("hyperlink");
|
|
25886
|
-
if (hasAncestorTag(el, "img", root)) {
|
|
26118
|
+
if (!insideNumberingMarker && hasAncestorTag(el, "img", root)) {
|
|
25887
26119
|
kinds.push("image");
|
|
25888
26120
|
}
|
|
25889
26121
|
if (hasAncestorTag(el, "td", root) || hasAncestorTag(el, "th", root)) {
|
|
@@ -25919,7 +26151,9 @@ function resolveTargetKind(target, options = {}) {
|
|
|
25919
26151
|
if (!kinds.includes("template-slot")) kinds.push("template-slot");
|
|
25920
26152
|
}
|
|
25921
26153
|
}
|
|
25922
|
-
if (!kinds.includes("
|
|
26154
|
+
if (!kinds.includes("generated-field") && !kinds.includes("plain-text")) {
|
|
26155
|
+
kinds.push("plain-text");
|
|
26156
|
+
}
|
|
25923
26157
|
return kinds;
|
|
25924
26158
|
}
|
|
25925
26159
|
|
|
@@ -28140,6 +28374,18 @@ function emuToPx(emu, pxPerTwip) {
|
|
|
28140
28374
|
return emu / EMU_PER_PX * zoomFactor;
|
|
28141
28375
|
}
|
|
28142
28376
|
|
|
28377
|
+
// src/ui-tailwind/editor-surface/media-src-policy.ts
|
|
28378
|
+
var SAFE_DATA_IMAGE_PREFIX_RE = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/iu;
|
|
28379
|
+
var MAX_NUMBERING_PICTURE_BULLET_DATA_URL_LENGTH = 1024 * 1024;
|
|
28380
|
+
function sanitizeNumberingPictureBulletSrc(src) {
|
|
28381
|
+
if (typeof src !== "string") return null;
|
|
28382
|
+
const trimmed = src.trim();
|
|
28383
|
+
if (trimmed.length === 0) return null;
|
|
28384
|
+
if (trimmed.length > MAX_NUMBERING_PICTURE_BULLET_DATA_URL_LENGTH) return null;
|
|
28385
|
+
if (!SAFE_DATA_IMAGE_PREFIX_RE.test(trimmed)) return null;
|
|
28386
|
+
return trimmed;
|
|
28387
|
+
}
|
|
28388
|
+
|
|
28143
28389
|
// src/ui-tailwind/page-stack/tw-region-block-renderer.tsx
|
|
28144
28390
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
28145
28391
|
var EMU_PER_PX2 = 9525;
|
|
@@ -28254,6 +28500,10 @@ function renderSegment(seg, mediaPreviews, fallbackDisplay, tabInfoBySegment) {
|
|
|
28254
28500
|
"span",
|
|
28255
28501
|
{
|
|
28256
28502
|
"data-node-type": "field_ref",
|
|
28503
|
+
"data-generated-field": "true",
|
|
28504
|
+
"data-field-family": seg.fieldFamily,
|
|
28505
|
+
"data-field-target": seg.fieldTarget,
|
|
28506
|
+
"data-field-refresh-status": seg.refreshStatus,
|
|
28257
28507
|
style: { opacity: 0.6, fontSize: "0.85em" },
|
|
28258
28508
|
children: seg.displayText ?? seg.label
|
|
28259
28509
|
},
|
|
@@ -28303,6 +28553,9 @@ function RegionParagraph({
|
|
|
28303
28553
|
const markerWidth = resolvedNumbering?.geometry?.markerLane?.width;
|
|
28304
28554
|
const markerStart = resolvedNumbering?.geometry?.markerLane?.start;
|
|
28305
28555
|
const markerJustification = resolvedNumbering?.geometry?.markerJustification;
|
|
28556
|
+
const pictureBulletSrc = sanitizeNumberingPictureBulletSrc(
|
|
28557
|
+
resolvedNumbering?.picBulletMediaId ? mediaPreviews[resolvedNumbering.picBulletMediaId]?.src : null
|
|
28558
|
+
);
|
|
28306
28559
|
const prefixSpan = numberingPrefix != null ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28307
28560
|
"span",
|
|
28308
28561
|
{
|
|
@@ -28313,7 +28566,9 @@ function RegionParagraph({
|
|
|
28313
28566
|
...!markerRunProperties ? ["text-tertiary", "font-[family-name:var(--font-legal-sans)]"] : []
|
|
28314
28567
|
].join(" "),
|
|
28315
28568
|
contentEditable: false,
|
|
28316
|
-
"data-numbering-
|
|
28569
|
+
"data-numbering-marker": "true",
|
|
28570
|
+
"data-numbering-prefix": pictureBulletSrc ? "" : numberingPrefix,
|
|
28571
|
+
...pictureBulletSrc ? { "data-numbering-picture-bullet": resolvedNumbering?.pictureBulletPosture?.status ?? "media-rendered" } : {},
|
|
28317
28572
|
...typeof resolvedNumbering?.level === "number" ? { "data-numbering-level": String(resolvedNumbering.level) } : {},
|
|
28318
28573
|
...numberingSuffix ? { "data-numbering-suffix": numberingSuffix } : {},
|
|
28319
28574
|
style: buildMarkerStyle(
|
|
@@ -28324,7 +28579,20 @@ function RegionParagraph({
|
|
|
28324
28579
|
markerStart,
|
|
28325
28580
|
markerJustification
|
|
28326
28581
|
),
|
|
28327
|
-
children:
|
|
28582
|
+
children: pictureBulletSrc ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28583
|
+
"img",
|
|
28584
|
+
{
|
|
28585
|
+
src: pictureBulletSrc,
|
|
28586
|
+
alt: "",
|
|
28587
|
+
"aria-hidden": "true",
|
|
28588
|
+
style: {
|
|
28589
|
+
maxWidth: "100%",
|
|
28590
|
+
maxHeight: "100%",
|
|
28591
|
+
objectFit: "contain",
|
|
28592
|
+
display: "block"
|
|
28593
|
+
}
|
|
28594
|
+
}
|
|
28595
|
+
) : numberingPrefix
|
|
28328
28596
|
}
|
|
28329
28597
|
) : null;
|
|
28330
28598
|
const attrs = {
|
|
@@ -33694,6 +33962,21 @@ function resolveRoleChromePreset(basePreset, role) {
|
|
|
33694
33962
|
}
|
|
33695
33963
|
return basePreset;
|
|
33696
33964
|
}
|
|
33965
|
+
function resolveActiveListReadback(rows, activeListContext, selection) {
|
|
33966
|
+
if (!activeListContext) {
|
|
33967
|
+
return null;
|
|
33968
|
+
}
|
|
33969
|
+
const selectionPoint = selection.activeRange.kind === "range" ? selection.head : selection.activeRange.kind === "node" ? selection.activeRange.at : selection.activeRange.lastKnownRange.from;
|
|
33970
|
+
const matchingSelectionRow = rows.find(
|
|
33971
|
+
(row) => row.numberingInstanceId === activeListContext.numberingInstanceId && row.level === activeListContext.level && selectionPoint >= row.authoredTextRange.from && selectionPoint <= row.authoredTextRange.to
|
|
33972
|
+
);
|
|
33973
|
+
if (matchingSelectionRow) {
|
|
33974
|
+
return matchingSelectionRow;
|
|
33975
|
+
}
|
|
33976
|
+
return rows.find(
|
|
33977
|
+
(row) => row.numberingInstanceId === activeListContext.numberingInstanceId && row.level === activeListContext.level
|
|
33978
|
+
) ?? null;
|
|
33979
|
+
}
|
|
33697
33980
|
function TwReviewWorkspace(inputProps) {
|
|
33698
33981
|
const props = {
|
|
33699
33982
|
...inputProps,
|
|
@@ -33808,6 +34091,14 @@ function TwReviewWorkspace(inputProps) {
|
|
|
33808
34091
|
() => uiApi?.scope.list().length,
|
|
33809
34092
|
[uiApi, renderFrameRevision]
|
|
33810
34093
|
);
|
|
34094
|
+
const activeListReadback = (0, import_react51.useMemo)(
|
|
34095
|
+
() => resolveActiveListReadback(
|
|
34096
|
+
uiApi?.lists.list() ?? [],
|
|
34097
|
+
props.activeListContext,
|
|
34098
|
+
viewState.selection
|
|
34099
|
+
),
|
|
34100
|
+
[uiApi, props.activeListContext, viewState.selection, renderFrameRevision]
|
|
34101
|
+
);
|
|
33811
34102
|
const headings = props.documentNavigation?.headings ?? [];
|
|
33812
34103
|
const headerVariant = snapshot.pageLayout?.headerVariants[0]?.variant ?? "default";
|
|
33813
34104
|
const footerVariant = snapshot.pageLayout?.footerVariants[0]?.variant ?? "default";
|
|
@@ -34076,6 +34367,7 @@ function TwReviewWorkspace(inputProps) {
|
|
|
34076
34367
|
zoomLevel: props.zoomLevel,
|
|
34077
34368
|
formattingState: props.formattingState,
|
|
34078
34369
|
activeListContext: props.activeListContext,
|
|
34370
|
+
activeListReadback,
|
|
34079
34371
|
styleCatalog: props.styleCatalog,
|
|
34080
34372
|
showTrackedChanges: trackedChangesAuthoringEnabled,
|
|
34081
34373
|
showSidebarToggle: responsiveChrome.showSidebarToggle,
|
|
@@ -34287,6 +34579,7 @@ function TwReviewWorkspace(inputProps) {
|
|
|
34287
34579
|
onSetImageFrame: props.onSetImageFrame,
|
|
34288
34580
|
onRestartNumbering: props.onRestartNumbering,
|
|
34289
34581
|
onContinueNumbering: props.onContinueNumbering,
|
|
34582
|
+
activeListReadback,
|
|
34290
34583
|
onToggleRowHeader: props.onToggleRowHeader,
|
|
34291
34584
|
onToggleRowCantSplit: props.onToggleRowCantSplit,
|
|
34292
34585
|
onDistributeColumnsEvenly: props.onDistributeColumnsEvenly,
|