@beyondwork/docx-react-component 1.0.46 → 1.0.48
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/public-types.ts +115 -1
- package/src/compare/diff-engine.ts +4 -0
- package/src/core/commands/add-scope.ts +257 -0
- package/src/core/commands/formatting-commands.ts +2 -0
- package/src/core/commands/index.ts +120 -1
- package/src/core/schema/text-schema.ts +95 -1
- package/src/core/state/text-transaction.ts +17 -5
- package/src/io/chart-preview-resolver.ts +27 -0
- package/src/io/docx-session.ts +219 -2
- package/src/io/export/serialize-main-document.ts +37 -0
- package/src/io/export/serialize-settings.ts +421 -0
- package/src/io/export/serialize-styles.ts +10 -0
- package/src/io/normalize/normalize-text.ts +1 -0
- package/src/io/ooxml/chart/parse-axis.ts +277 -0
- package/src/io/ooxml/chart/parse-chart-space.ts +813 -0
- package/src/io/ooxml/chart/parse-series.ts +570 -0
- package/src/io/ooxml/chart/resolve-color.ts +251 -0
- package/src/io/ooxml/chart/types.ts +420 -0
- package/src/io/ooxml/parse-block-structure.ts +99 -0
- package/src/io/ooxml/parse-complex-content.ts +87 -2
- package/src/io/ooxml/parse-main-document.ts +115 -1
- package/src/io/ooxml/parse-scope-markers.ts +184 -0
- package/src/io/ooxml/parse-settings-blueprint.ts +349 -0
- package/src/io/ooxml/parse-settings.ts +97 -1
- package/src/io/ooxml/parse-styles.ts +65 -0
- package/src/io/ooxml/parse-theme.ts +2 -127
- package/src/io/ooxml/workflow-payload.ts +27 -0
- package/src/io/ooxml/xml-attr-helpers.ts +59 -1
- package/src/io/ooxml/xml-parser.ts +142 -0
- package/src/model/canonical-document.ts +94 -0
- package/src/model/scope-markers.ts +144 -0
- package/src/runtime/collab/base-doc-fingerprint.ts +99 -0
- package/src/runtime/collab/checkpoint-election.ts +75 -0
- package/src/runtime/collab/checkpoint-scheduler.ts +204 -0
- package/src/runtime/collab/checkpoint-store.ts +115 -0
- package/src/runtime/collab/event-types.ts +37 -5
- package/src/runtime/collab/index.ts +22 -0
- package/src/runtime/collab/remote-cursor-awareness.ts +167 -0
- package/src/runtime/collab/runtime-collab-sync.ts +404 -1
- package/src/runtime/document-runtime.ts +221 -16
- package/src/runtime/editor-surface/capabilities.ts +63 -50
- package/src/runtime/layout/layout-engine-version.ts +27 -2
- package/src/runtime/prerender/cache-envelope.ts +19 -7
- package/src/runtime/prerender/cache-key.ts +25 -14
- package/src/runtime/prerender/canonical-document-hash.ts +63 -0
- package/src/runtime/prerender/customxml-cache.ts +211 -0
- package/src/runtime/prerender/customxml-probe.ts +78 -0
- package/src/runtime/prerender/prerender-document.ts +74 -7
- package/src/runtime/scope-resolver.ts +148 -0
- package/src/runtime/scope-tag-registry.ts +10 -0
- package/src/runtime/surface-projection.ts +8 -1
- package/src/runtime/text-ack-range.ts +3 -3
- package/src/ui/WordReviewEditor.tsx +30 -0
- package/src/ui/editor-runtime-boundary.ts +6 -1
- package/src/ui/runtime-shortcut-dispatch.ts +12 -7
|
@@ -1047,7 +1047,11 @@ function appendInlineSegments(
|
|
|
1047
1047
|
}
|
|
1048
1048
|
case "bookmark_start":
|
|
1049
1049
|
case "bookmark_end":
|
|
1050
|
-
|
|
1050
|
+
case "scope_marker_start":
|
|
1051
|
+
case "scope_marker_end":
|
|
1052
|
+
// Zero-width markers — no visual, no cursor advancement. Scope markers
|
|
1053
|
+
// (S1) follow the bookmark precedent: structural anchors whose positions
|
|
1054
|
+
// track with surrounding text but which don't occupy cursor positions.
|
|
1051
1055
|
return { nextCursor: start, lockedFragmentIds: [] };
|
|
1052
1056
|
default:
|
|
1053
1057
|
return { nextCursor: start + 1, lockedFragmentIds: [] };
|
|
@@ -1466,6 +1470,9 @@ function summarizePreviewInline(node: InlineNode): string {
|
|
|
1466
1470
|
return node.name ? `[Bookmark: ${node.name}]` : "[Bookmark]";
|
|
1467
1471
|
case "bookmark_end":
|
|
1468
1472
|
return "";
|
|
1473
|
+
case "scope_marker_start":
|
|
1474
|
+
case "scope_marker_end":
|
|
1475
|
+
return "";
|
|
1469
1476
|
case "image":
|
|
1470
1477
|
return node.altText ? `[Image: ${node.altText}]` : "[Image]";
|
|
1471
1478
|
case "opaque_inline":
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* as `adjustedRange`. The semantics: the union of all step post-edit ranges
|
|
4
4
|
* (where each step covers `[step.from, step.from + step.insertSize]` in the
|
|
5
5
|
* new document). When the transaction has no steps (e.g., a non-main-story
|
|
6
|
-
* `document.replace` that uses `createEmptyMapping()`),
|
|
7
|
-
* normalized prior selection range so consumers still
|
|
8
|
-
* pointer.
|
|
6
|
+
* `document.replace` or `document.patch` that uses `createEmptyMapping()`),
|
|
7
|
+
* fall back to the normalized prior selection range so consumers still
|
|
8
|
+
* receive a meaningful pointer.
|
|
9
9
|
*
|
|
10
10
|
* Note: only `step.from` and `step.insertSize` are considered; `step.to`
|
|
11
11
|
* (the pre-edit end of the replaced range) is intentionally ignored. A pure
|
|
@@ -494,6 +494,9 @@ export function __createWordReviewEditorRefBridge(
|
|
|
494
494
|
deleteComment: (commentId) => {
|
|
495
495
|
applyRuntimeDeleteComment(runtime, commentId);
|
|
496
496
|
},
|
|
497
|
+
addScope: (params) => runtime.addScope(params),
|
|
498
|
+
getScope: (scopeId) => runtime.getScope(scopeId),
|
|
499
|
+
removeScope: (scopeId) => runtime.removeScope(scopeId),
|
|
497
500
|
acceptChange: (changeId) => runtime.acceptChange(changeId),
|
|
498
501
|
rejectChange: (changeId) => runtime.rejectChange(changeId),
|
|
499
502
|
acceptAllChanges: () => runtime.acceptAllChanges(),
|
|
@@ -1042,6 +1045,12 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
|
|
|
1042
1045
|
onFindRequested,
|
|
1043
1046
|
onPrintRequested,
|
|
1044
1047
|
onZoomRequested,
|
|
1048
|
+
onReplaceRequested,
|
|
1049
|
+
onGoToRequested,
|
|
1050
|
+
onSpellRequested,
|
|
1051
|
+
onThesaurusRequested,
|
|
1052
|
+
onExtendSelectionRequested,
|
|
1053
|
+
onLastEditRequested,
|
|
1045
1054
|
readOnly = false,
|
|
1046
1055
|
reviewMode = "review",
|
|
1047
1056
|
suggestionsEnabled = false,
|
|
@@ -1477,6 +1486,9 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
|
|
|
1477
1486
|
deleteComment: (commentId) => {
|
|
1478
1487
|
applyRuntimeDeleteComment(activeRuntime, commentId);
|
|
1479
1488
|
},
|
|
1489
|
+
addScope: (params) => activeRuntime.addScope(params),
|
|
1490
|
+
getScope: (scopeId) => activeRuntime.getScope(scopeId),
|
|
1491
|
+
removeScope: (scopeId) => activeRuntime.removeScope(scopeId),
|
|
1480
1492
|
acceptChange: (changeId) => activeRuntime.acceptChange(changeId),
|
|
1481
1493
|
rejectChange: (changeId) => activeRuntime.rejectChange(changeId),
|
|
1482
1494
|
acceptAllChanges: () => activeRuntime.acceptAllChanges(),
|
|
@@ -2608,6 +2620,24 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
|
|
|
2608
2620
|
shortcut.shortcut === "zoom-out" ? "out" : "reset";
|
|
2609
2621
|
onZoomRequested(direction);
|
|
2610
2622
|
handled = true;
|
|
2623
|
+
} else if (shortcut.shortcut === "replace" && onReplaceRequested) {
|
|
2624
|
+
onReplaceRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2625
|
+
handled = true;
|
|
2626
|
+
} else if (shortcut.shortcut === "go-to" && onGoToRequested) {
|
|
2627
|
+
onGoToRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2628
|
+
handled = true;
|
|
2629
|
+
} else if (shortcut.shortcut === "spell" && onSpellRequested) {
|
|
2630
|
+
onSpellRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2631
|
+
handled = true;
|
|
2632
|
+
} else if (shortcut.shortcut === "thesaurus" && onThesaurusRequested) {
|
|
2633
|
+
onThesaurusRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2634
|
+
handled = true;
|
|
2635
|
+
} else if (shortcut.shortcut === "extend-selection" && onExtendSelectionRequested) {
|
|
2636
|
+
onExtendSelectionRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2637
|
+
handled = true;
|
|
2638
|
+
} else if (shortcut.shortcut === "last-edit" && onLastEditRequested) {
|
|
2639
|
+
onLastEditRequested({ selectionText: "", selectionRange: snapshot.selection });
|
|
2640
|
+
handled = true;
|
|
2611
2641
|
}
|
|
2612
2642
|
if (handled) {
|
|
2613
2643
|
event.preventDefault();
|
|
@@ -900,6 +900,11 @@ function createLoadingRuntimeBridge(input: {
|
|
|
900
900
|
throw createLoadingBoundaryError(input.snapshot.documentId, "comment");
|
|
901
901
|
},
|
|
902
902
|
editCommentBody: () => undefined,
|
|
903
|
+
addScope: () => {
|
|
904
|
+
throw createLoadingBoundaryError(input.snapshot.documentId, "scope");
|
|
905
|
+
},
|
|
906
|
+
getScope: () => null,
|
|
907
|
+
removeScope: () => undefined,
|
|
903
908
|
acceptChange: () => undefined,
|
|
904
909
|
rejectChange: () => undefined,
|
|
905
910
|
acceptAllChanges: () => undefined,
|
|
@@ -1016,7 +1021,7 @@ function createLoadingRuntimeBridge(input: {
|
|
|
1016
1021
|
|
|
1017
1022
|
function createLoadingBoundaryError(
|
|
1018
1023
|
documentId: string,
|
|
1019
|
-
target: "comment" | "session" | "snapshot" | "export",
|
|
1024
|
+
target: "comment" | "session" | "snapshot" | "export" | "scope",
|
|
1020
1025
|
): EditorError {
|
|
1021
1026
|
return {
|
|
1022
1027
|
errorId: `${documentId}-loading-${target}`,
|
|
@@ -23,7 +23,12 @@ export interface SurfaceShortcutContext {
|
|
|
23
23
|
|
|
24
24
|
export type ShellShortcutResolution =
|
|
25
25
|
| { kind: "none" }
|
|
26
|
-
| { kind: "delegate"; shortcut:
|
|
26
|
+
| { kind: "delegate"; shortcut:
|
|
27
|
+
| "find" | "print"
|
|
28
|
+
| "zoom-in" | "zoom-out" | "zoom-reset"
|
|
29
|
+
| "replace" | "go-to"
|
|
30
|
+
| "spell" | "thesaurus"
|
|
31
|
+
| "extend-selection" | "last-edit" }
|
|
27
32
|
| { kind: "block"; command: string; reason: WorkflowBlockedCommandReason }
|
|
28
33
|
| { kind: "history"; history: "undo" | "redo" }
|
|
29
34
|
| { kind: "focus-region"; direction: 1 | -1 }
|
|
@@ -115,14 +120,14 @@ export function resolveShellShortcut(
|
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
if (isReplaceShortcut(input, key)) {
|
|
118
|
-
return
|
|
123
|
+
return { kind: "delegate", shortcut: "replace" };
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
if (
|
|
122
127
|
isGoToShortcut(input, key) ||
|
|
123
128
|
(key === "f5" && !input.shiftKey)
|
|
124
129
|
) {
|
|
125
|
-
return
|
|
130
|
+
return { kind: "delegate", shortcut: "go-to" };
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
if (isModShiftShortcut(input, key, "e")) {
|
|
@@ -130,19 +135,19 @@ export function resolveShellShortcut(
|
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
if (key === "f7" && !input.shiftKey) {
|
|
133
|
-
return
|
|
138
|
+
return { kind: "delegate", shortcut: "spell" };
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
if (key === "f7" && input.shiftKey) {
|
|
137
|
-
return
|
|
142
|
+
return { kind: "delegate", shortcut: "thesaurus" };
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
if (key === "f8") {
|
|
141
|
-
return
|
|
146
|
+
return { kind: "delegate", shortcut: "extend-selection" };
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
if (key === "f5" && input.shiftKey) {
|
|
145
|
-
return
|
|
150
|
+
return { kind: "delegate", shortcut: "last-edit" };
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
return { kind: "none" };
|