@beyondwork/docx-react-component 1.0.21 → 1.0.23

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.
Files changed (33) hide show
  1. package/README.md +763 -38
  2. package/package.json +25 -36
  3. package/src/api/public-types.ts +66 -1
  4. package/src/core/commands/index.ts +574 -5
  5. package/src/index.ts +5 -0
  6. package/src/io/docx-session.ts +181 -2
  7. package/src/io/export/serialize-main-document.ts +21 -1
  8. package/src/io/normalize/normalize-text.ts +4 -0
  9. package/src/io/ooxml/parse-main-document.ts +88 -7
  10. package/src/model/canonical-document.ts +22 -0
  11. package/src/review/store/revision-store.ts +1 -0
  12. package/src/review/store/revision-types.ts +2 -0
  13. package/src/runtime/document-runtime.ts +503 -51
  14. package/src/runtime/session-capabilities.ts +6 -5
  15. package/src/runtime/surface-projection.ts +2 -0
  16. package/src/runtime/table-schema.ts +2 -0
  17. package/src/runtime/workflow-markup.ts +5 -1
  18. package/src/ui/WordReviewEditor.tsx +661 -132
  19. package/src/ui/editor-runtime-boundary.ts +10 -1
  20. package/src/ui/editor-shell-view.tsx +8 -0
  21. package/src/ui/editor-surface-controller.tsx +5 -0
  22. package/src/ui/headless/selection-toolbar-model.ts +12 -0
  23. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +139 -0
  24. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +6 -0
  25. package/src/ui-tailwind/editor-surface/pm-decorations.ts +44 -16
  26. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +2 -0
  27. package/src/ui-tailwind/editor-surface/surface-build-keys.ts +4 -0
  28. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +127 -10
  29. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +82 -1
  30. package/src/ui-tailwind/status/tw-status-bar.tsx +4 -1
  31. package/src/ui-tailwind/theme/editor-theme.css +10 -0
  32. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +21 -5
  33. package/src/ui-tailwind/tw-review-workspace.tsx +110 -32
@@ -129,6 +129,8 @@ export function deriveCapabilities(
129
129
  const unsupportedFatalCount = snapshot.compatibility.featureEntries.filter(
130
130
  (e) => e.featureClass === "unsupported-fatal",
131
131
  ).length;
132
+ const workflowOverlayPresent = workflowScope?.overlayPresent ?? false;
133
+ const workflowBlocked = (workflowScope?.blockedReasons?.length ?? 0) > 0;
132
134
 
133
135
  // Review visibility
134
136
  const trackChangesSupported = snapshot.trackedChanges.totalCount > 0;
@@ -138,8 +140,10 @@ export function deriveCapabilities(
138
140
  // stays reachable in both modes).
139
141
  const hasTrustConcerns = exportBlocked || preserveOnlyCount > 0 || unsupportedFatalCount > 0
140
142
  || snapshot.warnings.length > 0 || hasFatalError;
141
- const reviewRailVisible = mode === "review" || mode === "read-only-diagnostics"
142
- || (mode === "editing" && hasTrustConcerns);
143
+ const reviewRailVisible = workflowOverlayPresent
144
+ ? false
145
+ : mode === "review" || mode === "read-only-diagnostics"
146
+ || (mode === "editing" && hasTrustConcerns);
143
147
 
144
148
  const healthIssueCount = preserveOnlyCount + unsupportedFatalCount + snapshot.warnings.length;
145
149
 
@@ -147,9 +151,6 @@ export function deriveCapabilities(
147
151
  const hasDocumentProtection = protection?.hasDocumentProtection ?? false;
148
152
  const protectedRangeCount = protection?.ranges?.length ?? 0;
149
153
 
150
- const workflowOverlayPresent = workflowScope?.overlayPresent ?? false;
151
- const workflowBlocked = (workflowScope?.blockedReasons?.length ?? 0) > 0;
152
-
153
154
  return {
154
155
  phase,
155
156
  mode,
@@ -296,6 +296,8 @@ function createTableBlock(
296
296
  }
297
297
  rows.push({
298
298
  cells,
299
+ ...(row.gridBefore !== undefined ? { gridBefore: row.gridBefore } : {}),
300
+ ...(row.gridAfter !== undefined ? { gridAfter: row.gridAfter } : {}),
299
301
  ...(row.height !== undefined ? { height: row.height } : {}),
300
302
  ...(row.heightRule ? { heightRule: row.heightRule } : {}),
301
303
  ...(row.isHeader ? { isHeader: row.isHeader } : {}),
@@ -223,6 +223,8 @@ export const tableRowNodeSpec: NodeSpec = {
223
223
  tableRole: "row",
224
224
  attrs: {
225
225
  propertiesXml: { default: null },
226
+ gridBefore: { default: 0, validate: "number" },
227
+ gridAfter: { default: 0, validate: "number" },
226
228
  height: { default: null },
227
229
  heightRule: { default: null },
228
230
  isHeader: { default: false },
@@ -301,7 +301,11 @@ function collectOpaqueFragmentMarkup(
301
301
  const seen = new Set(existing.map((item) => item.fragmentId));
302
302
 
303
303
  return Object.values(preservation.opaqueFragments)
304
- .filter((fragment) => !seen.has(fragment.fragmentId))
304
+ .filter(
305
+ (fragment) =>
306
+ !seen.has(fragment.fragmentId)
307
+ && fragment.packagePartName === "/word/document.xml",
308
+ )
305
309
  .map((fragment) => {
306
310
  const descriptor = describeOpaqueFragment(fragment);
307
311
  const blockedReasonCode = BLOCKED_IMPORT_FEATURE_KEYS.has(descriptor.featureKey)