@beyondwork/docx-react-component 1.0.4 → 1.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beyondwork/docx-react-component",
3
3
  "publisher": "beyondwork",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
6
6
  "type": "module",
7
7
  "files": [
@@ -384,6 +384,7 @@ export type WordReviewEditorEvent =
384
384
  source: "docx" | "snapshot" | "datastore" | "canonical";
385
385
  stats: DocumentStats;
386
386
  compatibility: CompatibilityReport;
387
+ comments: CommentSidebarSnapshot;
387
388
  }
388
389
  | {
389
390
  type: "dirty_changed";
@@ -504,6 +505,7 @@ export interface WordReviewEditorRef {
504
505
  getSnapshot(): PersistedEditorSnapshot;
505
506
  getCompatibilityReport(): CompatibilityReport;
506
507
  getWarnings(): EditorWarning[];
508
+ getComments(): CommentSidebarSnapshot;
507
509
  }
508
510
 
509
511
  export interface WordReviewEditorProps {
@@ -517,6 +519,7 @@ export interface WordReviewEditorProps {
517
519
  readOnly?: boolean;
518
520
  reviewMode?: "editing" | "review";
519
521
  markupDisplay?: "clean" | "simple" | "all";
522
+ showReviewPanel?: boolean;
520
523
  datastore?: EditorDatastoreAdapter;
521
524
  autosave?: AutosaveConfig;
522
525
  onEvent?: (event: WordReviewEditorEvent) => void;
@@ -133,6 +133,7 @@ export function createDocumentRuntime(
133
133
  source: options.sourceKind ?? (options.initialSnapshot ? "snapshot" : "canonical"),
134
134
  stats: toPublicDocumentStats(state),
135
135
  compatibility: toPublicCompatibilityReport(createDerivedCompatibility(state)),
136
+ comments: cachedRenderSnapshot.comments,
136
137
  });
137
138
  if (options.fatalError) {
138
139
  emit({
@@ -112,6 +112,7 @@ export function __createWordReviewEditorRefBridge(
112
112
  getSnapshot: () => runtime.getPersistedSnapshot(),
113
113
  getCompatibilityReport: () => runtime.getCompatibilityReport(),
114
114
  getWarnings: () => runtime.getWarnings(),
115
+ getComments: () => runtime.getRenderSnapshot().comments,
115
116
  };
116
117
  }
117
118
 
@@ -252,6 +253,7 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
252
253
  onWarning,
253
254
  readOnly = false,
254
255
  reviewMode = "review",
256
+ showReviewPanel = true,
255
257
  } = props;
256
258
 
257
259
  const [runtime, setRuntime] = useState<WordReviewEditorRuntime | null>(null);
@@ -495,6 +497,7 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
495
497
  getSnapshot: () => activeRuntime.getPersistedSnapshot(),
496
498
  getCompatibilityReport: () => activeRuntime.getCompatibilityReport(),
497
499
  getWarnings: () => activeRuntime.getWarnings(),
500
+ getComments: () => activeRuntime.getRenderSnapshot().comments,
498
501
  }),
499
502
  [activeRuntime, currentUser.userId, documentId, runtime],
500
503
  );
@@ -623,7 +626,10 @@ export const WordReviewEditor = forwardRef<WordReviewEditorRef, WordReviewEditor
623
626
  }
624
627
 
625
628
  const selectionPreview = summarizeSelectionPreview(snapshot);
626
- const capabilities = deriveCapabilities(snapshot, reviewMode);
629
+ const derivedCapabilities = deriveCapabilities(snapshot, reviewMode);
630
+ const capabilities = showReviewPanel
631
+ ? derivedCapabilities
632
+ : { ...derivedCapabilities, reviewRailVisible: false };
627
633
  const diagnosticsModeMessage = getDiagnosticsModeMessage(loadError ?? snapshot.fatalError);
628
634
  const accessibilityInstructionsId = `${documentId}-accessibility-instructions`;
629
635
  const accessibilityStatusId = `${documentId}-accessibility-status`;
@@ -1285,6 +1291,7 @@ function createReadyEvent(
1285
1291
  source,
1286
1292
  stats: snapshot.documentStats,
1287
1293
  compatibility: runtime.getCompatibilityReport(),
1294
+ comments: snapshot.comments,
1288
1295
  };
1289
1296
  }
1290
1297