@beyondwork/docx-react-component 1.0.83 → 1.0.85
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/package.json +1 -1
- package/src/api/internal/build-ref-projections.ts +3 -0
- package/src/api/public-types.ts +86 -4
- package/src/api/v3/_runtime-handle.ts +15 -0
- package/src/api/v3/runtime/content.ts +148 -1
- package/src/api/v3/runtime/formatting.ts +41 -0
- package/src/api/v3/runtime/review.ts +98 -0
- package/src/api/v3/runtime/workflow.ts +154 -6
- package/src/core/commands/index.ts +81 -25
- package/src/core/state/editor-state.ts +15 -0
- package/src/io/export/serialize-main-document.ts +72 -6
- package/src/io/ooxml/header-footer-reference.ts +38 -0
- package/src/io/ooxml/parse-headers-footers.ts +11 -23
- package/src/io/ooxml/parse-main-document.ts +7 -10
- package/src/io/ooxml/workflow-payload-validator.ts +24 -0
- package/src/io/ooxml/workflow-payload.ts +12 -0
- package/src/model/canonical-document.ts +9 -0
- package/src/model/review/comment-types.ts +2 -0
- package/src/runtime/document-runtime.ts +718 -68
- package/src/runtime/formatting/field/resolver.ts +73 -8
- package/src/runtime/layout/layout-engine-version.ts +31 -12
- package/src/runtime/layout/paginated-layout-engine.ts +18 -11
- package/src/runtime/layout/public-facet.ts +119 -16
- package/src/runtime/layout/resolve-page-fields.ts +68 -6
- package/src/runtime/layout/resolve-page-previews.ts +1 -1
- package/src/runtime/scopes/_scope-dependencies.ts +1 -0
- package/src/runtime/scopes/action-validation.ts +54 -45
- package/src/runtime/scopes/workflow-overlap.ts +41 -9
- package/src/runtime/suggestions-snapshot.ts +24 -0
- package/src/runtime/surface-projection.ts +59 -2
- package/src/runtime/workflow/coordinator.ts +66 -14
- package/src/runtime/workflow/scope-writer.ts +83 -5
- package/src/shell/ref-commands.ts +3 -354
- package/src/shell/session-bootstrap.ts +10 -0
- package/src/ui/WordReviewEditor.tsx +99 -9
- package/src/ui/editor-command-bag.ts +3 -1
- package/src/ui/headless/revision-decoration-model.ts +13 -0
- package/src/ui/headless/selection-tool-types.ts +2 -0
- package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +7 -3
- package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +175 -25
- package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +1 -1
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +12 -0
- package/src/ui-tailwind/editor-surface/pm-page-break-decorations.ts +18 -30
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +1 -1
- package/src/ui-tailwind/editor-surface/tw-page-block-view.tsx +1 -1
- package/src/ui-tailwind/page-stack/tw-page-chrome-entry.tsx +20 -11
- package/src/ui-tailwind/page-stack/tw-page-footer-band.tsx +9 -4
- package/src/ui-tailwind/page-stack/tw-page-header-band.tsx +12 -7
- package/src/ui-tailwind/page-stack/tw-page-stack-chrome-layer.tsx +29 -10
- package/src/ui-tailwind/page-stack/tw-region-block-renderer.tsx +1 -1
- package/src/ui-tailwind/review-workspace/types.ts +3 -2
- package/src/ui-tailwind/review-workspace/use-page-markers.ts +11 -1
- package/src/ui-tailwind/toolbar/tw-role-action-region.tsx +2 -1
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +2 -1
- package/src/ui-tailwind/tw-review-workspace.tsx +18 -2
|
@@ -192,6 +192,7 @@ export interface TwReviewWorkspaceProps {
|
|
|
192
192
|
onZoomChange?: (level: ZoomLevel) => void;
|
|
193
193
|
onActiveRailTabChange?: (value: ReviewRailTab) => void;
|
|
194
194
|
onShowTrackedChangesChange?: (show: boolean) => void;
|
|
195
|
+
onReviewMarkupModeChange?: (mode: MarkupDisplay) => void;
|
|
195
196
|
onUndo?: () => void;
|
|
196
197
|
onRedo?: () => void;
|
|
197
198
|
onSetParagraphStyle?: (styleId: string) => void;
|
|
@@ -293,7 +294,7 @@ export interface TwReviewWorkspaceProps {
|
|
|
293
294
|
/**
|
|
294
295
|
* @deprecated P8.11 — the workspace no longer renders a workspace-level
|
|
295
296
|
* header band with an "Edit header" button; per-page header bands route
|
|
296
|
-
* clicks via `onOpenStory` / `runtime.openStory` directly.
|
|
297
|
+
* double-clicks via `onOpenStory` / `runtime.openStory` directly. The prop
|
|
297
298
|
* remains optional for one release so existing hosts continue to
|
|
298
299
|
* compile; supplying it emits a `console.warn` on mount.
|
|
299
300
|
*/
|
|
@@ -313,7 +314,7 @@ export interface TwReviewWorkspaceProps {
|
|
|
313
314
|
onOpenFooterStoryForPage?: (pageIndex: number) => void;
|
|
314
315
|
/**
|
|
315
316
|
* P8.11 — fired when a per-page chrome band (header / footer) is
|
|
316
|
-
* clicked to promote it into the active editing surface.
|
|
317
|
+
* double-clicked to promote it into the active editing surface. Wire to
|
|
317
318
|
* `runtime.openStory(target)`; the chrome layer's portal mechanism
|
|
318
319
|
* then reparents the PM surface into the matching band's active slot.
|
|
319
320
|
*/
|
|
@@ -212,6 +212,16 @@ export function usePageMarkers(options: UsePageMarkersOptions): PageMarkersResul
|
|
|
212
212
|
const [pageMarkers, setPageMarkers] = useState<readonly HTMLElement[]>([]);
|
|
213
213
|
|
|
214
214
|
useEffect(() => {
|
|
215
|
+
if (geometryFacet && layoutFacet) {
|
|
216
|
+
// Warm path: render-kernel geometry gives us page frames and the layout
|
|
217
|
+
// facet gives us page offsets, so DOM page-break markers are only legacy
|
|
218
|
+
// fallback. Skipping the marker scan avoids querySelectorAll +
|
|
219
|
+
// IntersectionObserver churn when PM swaps virtualized blocks at page
|
|
220
|
+
// dividers during scroll.
|
|
221
|
+
setPageMarkers((prev) => (prev.length === 0 ? prev : []));
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
|
|
215
225
|
const root = pageStackScrollRoot;
|
|
216
226
|
if (!root) {
|
|
217
227
|
setPageMarkers((prev) => (prev.length === 0 ? prev : []));
|
|
@@ -283,7 +293,7 @@ export function usePageMarkers(options: UsePageMarkersOptions): PageMarkersResul
|
|
|
283
293
|
// every requestViewportRefresh(), which would add two extra render passes per
|
|
284
294
|
// scroll event. The page-0 fallback uses -1 when page1First is unknown,
|
|
285
295
|
// which is correct (no page-0 blocks → synthetic marker contributes nothing).
|
|
286
|
-
}, [pageStackScrollRoot, snapshot.revisionToken]);
|
|
296
|
+
}, [geometryFacet, layoutFacet, pageStackScrollRoot, snapshot.revisionToken]);
|
|
287
297
|
|
|
288
298
|
const selectionBlockIndex = useMemo(() => {
|
|
289
299
|
const sel = snapshot.selection;
|
|
@@ -233,6 +233,7 @@ function RoleActionButton(arg: RoleActionButtonProps): React.JSX.Element | null
|
|
|
233
233
|
<Toggle.Root
|
|
234
234
|
pressed={props.showTrackedChanges ?? false}
|
|
235
235
|
onPressedChange={(v) => props.onShowTrackedChangesChange?.(v)}
|
|
236
|
+
aria-label={(props.showTrackedChanges ?? false) ? "Turn off tracked changes" : "Turn on tracked changes"}
|
|
236
237
|
disabled={props.capabilities ? !props.capabilities.trackChangesSupported : false}
|
|
237
238
|
onMouseDown={preserveEditorSelectionMouseDown}
|
|
238
239
|
className={`inline-flex h-6 w-6 items-center justify-center rounded-md text-secondary transition-colors hover:bg-surface data-[state=on]:bg-canvas data-[state=on]:text-accent data-[state=on]:ring-1 data-[state=on]:ring-accent/30 data-[state=on]:shadow-sm outline-none disabled:opacity-40 ${focusRingClass}`}
|
|
@@ -247,7 +248,7 @@ function RoleActionButton(arg: RoleActionButtonProps): React.JSX.Element | null
|
|
|
247
248
|
</Tooltip.Trigger>
|
|
248
249
|
<Tooltip.Portal>
|
|
249
250
|
<Tooltip.Content className="rounded-md bg-primary px-2 py-1 text-xs text-white shadow-md z-50" sideOffset={6}>
|
|
250
|
-
{(props.showTrackedChanges ?? false) ? "
|
|
251
|
+
{(props.showTrackedChanges ?? false) ? "Turn off tracked changes" : "Turn on tracked changes"}
|
|
251
252
|
</Tooltip.Content>
|
|
252
253
|
</Tooltip.Portal>
|
|
253
254
|
</Tooltip.Root>
|
|
@@ -669,6 +669,7 @@ export function TwToolbar(props: TwToolbarProps) {
|
|
|
669
669
|
<Toggle.Root
|
|
670
670
|
pressed={props.showTrackedChanges}
|
|
671
671
|
onPressedChange={props.onShowTrackedChangesChange}
|
|
672
|
+
aria-label={props.showTrackedChanges ? "Turn off tracked changes" : "Turn on tracked changes"}
|
|
672
673
|
disabled={caps ? !caps.trackChangesSupported : false}
|
|
673
674
|
onMouseDown={preserveEditorSelectionMouseDown}
|
|
674
675
|
className={`inline-flex h-6 w-6 items-center justify-center rounded-md text-secondary transition-colors hover:bg-surface data-[state=on]:bg-canvas data-[state=on]:text-accent data-[state=on]:ring-1 data-[state=on]:ring-accent/30 data-[state=on]:shadow-sm outline-none disabled:opacity-40 ${focusRingClass}`}
|
|
@@ -681,7 +682,7 @@ export function TwToolbar(props: TwToolbarProps) {
|
|
|
681
682
|
className="rounded-md bg-primary px-2 py-1 text-xs text-white shadow-md z-50"
|
|
682
683
|
sideOffset={6}
|
|
683
684
|
>
|
|
684
|
-
{props.showTrackedChanges ? "
|
|
685
|
+
{props.showTrackedChanges ? "Turn off tracked changes" : "Turn on tracked changes"}
|
|
685
686
|
</Tooltip.Content>
|
|
686
687
|
</Tooltip.Portal>
|
|
687
688
|
</Tooltip.Root>
|
|
@@ -85,7 +85,7 @@ export type {
|
|
|
85
85
|
TwReviewWorkspaceProps,
|
|
86
86
|
} from "./review-workspace/types.ts";
|
|
87
87
|
|
|
88
|
-
import type { EditorRole } from "../api/public-types.ts";
|
|
88
|
+
import type { EditorRole, EditorStoryTarget } from "../api/public-types.ts";
|
|
89
89
|
|
|
90
90
|
// Default shell-header modes for the workspace's default composition.
|
|
91
91
|
// Designsystem §6.1 prescribes a 4-mode switcher; all four are reachable in
|
|
@@ -185,6 +185,18 @@ export function TwReviewWorkspace(inputProps: TwReviewWorkspaceProps) {
|
|
|
185
185
|
const isPageWorkspace = props.workspaceMode === "page";
|
|
186
186
|
const markupDisplay = props.markupDisplay;
|
|
187
187
|
const [navOpen, setNavOpen] = useState(false);
|
|
188
|
+
const handleOpenPageModeStory = useCallback(
|
|
189
|
+
(target: EditorStoryTarget) => {
|
|
190
|
+
if (
|
|
191
|
+
!isPageWorkspace &&
|
|
192
|
+
(target.kind === "header" || target.kind === "footer")
|
|
193
|
+
) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
props.onOpenStory?.(target);
|
|
197
|
+
},
|
|
198
|
+
[isPageWorkspace, props.onOpenStory],
|
|
199
|
+
);
|
|
188
200
|
|
|
189
201
|
// Scope card state — tracks which scope's card is currently open so
|
|
190
202
|
// the ChromeOverlay's card layer renders the right one. Open/close
|
|
@@ -608,6 +620,10 @@ export function TwReviewWorkspace(inputProps: TwReviewWorkspaceProps) {
|
|
|
608
620
|
dismissSelectionToolbar();
|
|
609
621
|
props.onShowTrackedChangesChange(show);
|
|
610
622
|
}}
|
|
623
|
+
onReviewMarkupMode={(mode) => {
|
|
624
|
+
dismissSelectionToolbar();
|
|
625
|
+
props.onReviewMarkupModeChange?.(mode);
|
|
626
|
+
}}
|
|
611
627
|
onReviewSidebarTrackedChanges={
|
|
612
628
|
props.onReviewSidebarTrackedChanges
|
|
613
629
|
? runWithSelectionToolbarDismiss(props.onReviewSidebarTrackedChanges)
|
|
@@ -1159,7 +1175,7 @@ export function TwReviewWorkspace(inputProps: TwReviewWorkspaceProps) {
|
|
|
1159
1175
|
}
|
|
1160
1176
|
renderFrameRevision={renderFrameRevision}
|
|
1161
1177
|
activeStory={snapshot.activeStory}
|
|
1162
|
-
onOpenStory={
|
|
1178
|
+
onOpenStory={handleOpenPageModeStory}
|
|
1163
1179
|
pmSurfaceElement={pmSurfaceElement}
|
|
1164
1180
|
visiblePageIndexRange={visiblePageIndexRange}
|
|
1165
1181
|
mediaPreviews={props.mediaPreviews}
|