docx-diff-editor 1.0.40 → 1.0.41
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/README.md +55 -0
- package/dist/index.d.mts +349 -2
- package/dist/index.d.ts +349 -2
- package/dist/index.js +1543 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1532 -15
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +389 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,10 @@ A React component for DOCX document comparison with track changes visualization.
|
|
|
6
6
|
|
|
7
7
|
- 📄 Compare two DOCX documents side by side
|
|
8
8
|
- 🔍 Character-level diff with track changes
|
|
9
|
+
- 📊 **Block-level diffing** for tables, lists, and images
|
|
9
10
|
- ✅ Accept/reject individual changes
|
|
10
11
|
- 🎨 Visual track changes (insert, delete, format)
|
|
12
|
+
- 📋 **Structural Changes Pane** for table rows, list items, images
|
|
11
13
|
- 🤖 Extract enriched change context for LLM processing
|
|
12
14
|
- 📤 Export merged document to DOCX
|
|
13
15
|
|
|
@@ -103,6 +105,9 @@ await editor.setSource({ type: 'doc', content: [...] });
|
|
|
103
105
|
| `className` | `string` | - | Container class |
|
|
104
106
|
| `toolbarClassName` | `string` | - | Toolbar container class |
|
|
105
107
|
| `editorClassName` | `string` | - | Editor container class |
|
|
108
|
+
| `structuralPanePosition` | `StructuralPanePosition` | `'bottom-right'` | Position of structural changes pane |
|
|
109
|
+
| `structuralPaneCollapsed` | `boolean` | `false` | Start with pane collapsed |
|
|
110
|
+
| `hideStructuralPane` | `boolean` | `false` | Hide structural changes pane entirely |
|
|
106
111
|
|
|
107
112
|
### Ref Methods
|
|
108
113
|
|
|
@@ -155,8 +160,10 @@ interface ComparisonResult {
|
|
|
155
160
|
insertions: number;
|
|
156
161
|
deletions: number;
|
|
157
162
|
formatChanges: number;
|
|
163
|
+
structuralChanges: number; // New: count of structural changes
|
|
158
164
|
summary: string[];
|
|
159
165
|
mergedJson: ProseMirrorJSON;
|
|
166
|
+
structuralChangeInfos: StructuralChangeInfo[]; // New: metadata for pane
|
|
160
167
|
}
|
|
161
168
|
```
|
|
162
169
|
|
|
@@ -281,6 +288,54 @@ The component supports three types of track changes:
|
|
|
281
288
|
| **Delete** | Red strikethrough | Text removed |
|
|
282
289
|
| **Format** | Gold highlight | Formatting changed |
|
|
283
290
|
|
|
291
|
+
## Structural Changes Pane
|
|
292
|
+
|
|
293
|
+
When comparing documents with structural differences (tables, lists, images), a floating pane appears showing these changes with Accept/Reject controls.
|
|
294
|
+
|
|
295
|
+
### What's Detected
|
|
296
|
+
|
|
297
|
+
| Change Type | Description |
|
|
298
|
+
|-------------|-------------|
|
|
299
|
+
| **Table Rows** | Inserted or deleted rows |
|
|
300
|
+
| **Table Columns** | Added or removed columns |
|
|
301
|
+
| **List Items** | New or removed list items (including nested) |
|
|
302
|
+
| **Paragraphs** | Entire paragraphs added or deleted |
|
|
303
|
+
| **Images** | New or removed images |
|
|
304
|
+
|
|
305
|
+
### Pane Features
|
|
306
|
+
|
|
307
|
+
- **Floating Position**: Configurable position (`top-right`, `bottom-right`, `top-left`, `bottom-left`)
|
|
308
|
+
- **Collapsible**: Click header to minimize to just the title bar
|
|
309
|
+
- **Accept/Reject**: Per-change or bulk actions
|
|
310
|
+
- **Counter Badge**: Shows remaining changes
|
|
311
|
+
- **Auto-Hide**: Disappears when all changes are resolved
|
|
312
|
+
- **Bubble Sync**: Stays in sync when changes are accepted via SuperDoc's bubbles
|
|
313
|
+
|
|
314
|
+
### Configuration
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
<DocxDiffEditor
|
|
318
|
+
ref={editorRef}
|
|
319
|
+
structuralPanePosition="bottom-right" // Position of the pane
|
|
320
|
+
structuralPaneCollapsed={false} // Start expanded
|
|
321
|
+
hideStructuralPane={false} // Show the pane
|
|
322
|
+
/>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Accessing Structural Changes Programmatically
|
|
326
|
+
|
|
327
|
+
```tsx
|
|
328
|
+
const result = await editorRef.current?.compareWith(newDocument);
|
|
329
|
+
|
|
330
|
+
// Get structural change count
|
|
331
|
+
console.log(`${result.structuralChanges} structural changes detected`);
|
|
332
|
+
|
|
333
|
+
// Access detailed info
|
|
334
|
+
result.structuralChangeInfos.forEach(change => {
|
|
335
|
+
console.log(`${change.type}: ${change.location} - ${change.preview}`);
|
|
336
|
+
});
|
|
337
|
+
```
|
|
338
|
+
|
|
284
339
|
## License
|
|
285
340
|
|
|
286
341
|
Apache 2.0
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import react__default from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Type definitions for DocxDiffEditor
|
|
@@ -54,6 +55,114 @@ interface DiffResult {
|
|
|
54
55
|
/** Human-readable summary */
|
|
55
56
|
summary: string[];
|
|
56
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Type of structural change
|
|
60
|
+
*/
|
|
61
|
+
type StructuralChangeType = 'rowInsert' | 'rowDelete' | 'columnInsert' | 'columnDelete' | 'paragraphInsert' | 'paragraphDelete' | 'listItemInsert' | 'listItemDelete' | 'imageInsert' | 'imageDelete' | 'attrChange';
|
|
62
|
+
/**
|
|
63
|
+
* A structural change (node added/removed/moved)
|
|
64
|
+
*/
|
|
65
|
+
interface StructuralChange {
|
|
66
|
+
/** Unique ID shared across all marks in this structural change */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Type of structural change */
|
|
69
|
+
type: StructuralChangeType;
|
|
70
|
+
/** The node type affected (e.g., 'tableRow', 'paragraph', 'listItem') */
|
|
71
|
+
nodeType: string;
|
|
72
|
+
/** Path to the node in the document tree */
|
|
73
|
+
path: number[];
|
|
74
|
+
/** The affected node */
|
|
75
|
+
node: ProseMirrorJSON;
|
|
76
|
+
/** For moves: original path */
|
|
77
|
+
fromPath?: number[];
|
|
78
|
+
/** For moves: new path */
|
|
79
|
+
toPath?: number[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Single attribute difference
|
|
83
|
+
*/
|
|
84
|
+
interface AttrDiff {
|
|
85
|
+
/** Attribute key (e.g., "borders.top.color") */
|
|
86
|
+
key: string;
|
|
87
|
+
/** Value before the change */
|
|
88
|
+
before: unknown;
|
|
89
|
+
/** Value after the change */
|
|
90
|
+
after: unknown;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* An attribute change on a matched node
|
|
94
|
+
*/
|
|
95
|
+
interface AttributeChange {
|
|
96
|
+
/** Unique ID for this attribute change */
|
|
97
|
+
id: string;
|
|
98
|
+
/** The node type affected */
|
|
99
|
+
nodeType: string;
|
|
100
|
+
/** Path in original document */
|
|
101
|
+
pathA: number[];
|
|
102
|
+
/** Path in new document */
|
|
103
|
+
pathB: number[];
|
|
104
|
+
/** List of attribute differences */
|
|
105
|
+
changes: AttrDiff[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Record of matched nodes between documents
|
|
109
|
+
*/
|
|
110
|
+
interface NodeMatch {
|
|
111
|
+
/** Path in original document */
|
|
112
|
+
pathA: number[];
|
|
113
|
+
/** Path in new document */
|
|
114
|
+
pathB: number[];
|
|
115
|
+
/** Fingerprint used for matching */
|
|
116
|
+
fingerprint: string;
|
|
117
|
+
/** Similarity score (0.0 - 1.0) */
|
|
118
|
+
similarity: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Node with computed fingerprint (used in alignment)
|
|
122
|
+
*/
|
|
123
|
+
interface FingerprintedNode {
|
|
124
|
+
/** The original node */
|
|
125
|
+
node: ProseMirrorJSON;
|
|
126
|
+
/** Content-based fingerprint */
|
|
127
|
+
fingerprint: string;
|
|
128
|
+
/** Path in the document tree */
|
|
129
|
+
path: number[];
|
|
130
|
+
/** Child fingerprinted nodes */
|
|
131
|
+
children?: FingerprintedNode[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Extended diff result with structural awareness
|
|
135
|
+
*/
|
|
136
|
+
interface HybridDiffResult extends DiffResult {
|
|
137
|
+
/** Structural changes (rows, paragraphs, list items added/removed) */
|
|
138
|
+
structuralChanges: StructuralChange[];
|
|
139
|
+
/** Attribute changes on matched nodes */
|
|
140
|
+
attributeChanges: AttributeChange[];
|
|
141
|
+
/** Node matching information (for debugging) */
|
|
142
|
+
nodeMatches: NodeMatch[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Metadata for the Structural Changes Pane
|
|
146
|
+
* Generated during merge, stored in component state
|
|
147
|
+
*/
|
|
148
|
+
interface StructuralChangeInfo {
|
|
149
|
+
/** Shared ID across all marks in this structural change */
|
|
150
|
+
id: string;
|
|
151
|
+
/** Type of structural change */
|
|
152
|
+
type: StructuralChangeType;
|
|
153
|
+
/** The node type affected */
|
|
154
|
+
nodeType: string;
|
|
155
|
+
/** Human-readable location (e.g., "Table 1, Row 3") */
|
|
156
|
+
location: string;
|
|
157
|
+
/** Truncated content preview */
|
|
158
|
+
preview: string;
|
|
159
|
+
/** Author of the change */
|
|
160
|
+
author: TrackChangeAuthor;
|
|
161
|
+
/** ISO timestamp */
|
|
162
|
+
date: string;
|
|
163
|
+
/** For attribute changes, the specific diffs */
|
|
164
|
+
attrChanges?: AttrDiff[];
|
|
165
|
+
}
|
|
57
166
|
/**
|
|
58
167
|
* Result returned after comparing two documents
|
|
59
168
|
*/
|
|
@@ -66,20 +175,33 @@ interface ComparisonResult {
|
|
|
66
175
|
deletions: number;
|
|
67
176
|
/** Number of format changes */
|
|
68
177
|
formatChanges: number;
|
|
178
|
+
/** Number of structural changes (rows, paragraphs, etc.) */
|
|
179
|
+
structuralChanges: number;
|
|
69
180
|
/** Human-readable summary strings */
|
|
70
181
|
summary: string[];
|
|
71
182
|
/** The merged JSON document with track changes */
|
|
72
183
|
mergedJson: ProseMirrorJSON;
|
|
184
|
+
/** Metadata for structural changes (for the pane) */
|
|
185
|
+
structuralChangeInfos: StructuralChangeInfo[];
|
|
73
186
|
}
|
|
74
187
|
/**
|
|
75
188
|
* Location context for a change
|
|
76
189
|
*/
|
|
77
190
|
interface ChangeLocation {
|
|
78
|
-
nodeType: 'heading' | 'paragraph' | 'listItem' | 'tableCell' | 'unknown';
|
|
191
|
+
nodeType: 'heading' | 'paragraph' | 'listItem' | 'tableCell' | 'table' | 'image' | 'unknown';
|
|
79
192
|
headingLevel?: number;
|
|
80
193
|
paragraphIndex?: number;
|
|
81
194
|
sectionTitle?: string;
|
|
82
195
|
description: string;
|
|
196
|
+
/** Table coordinates (for table-related changes) */
|
|
197
|
+
tableCoords?: {
|
|
198
|
+
row: number;
|
|
199
|
+
column: number;
|
|
200
|
+
};
|
|
201
|
+
/** List item index */
|
|
202
|
+
listIndex?: number;
|
|
203
|
+
/** List nesting depth */
|
|
204
|
+
listDepth?: number;
|
|
83
205
|
}
|
|
84
206
|
/**
|
|
85
207
|
* Format change details
|
|
@@ -101,6 +223,20 @@ interface EnrichedChange {
|
|
|
101
223
|
charCount?: number;
|
|
102
224
|
/** The sentence or clause containing the change */
|
|
103
225
|
surroundingText?: string;
|
|
226
|
+
/** Structural change type (for block-level changes) */
|
|
227
|
+
structuralType?: StructuralChangeType;
|
|
228
|
+
/** Attribute changes (for attribute-only changes) */
|
|
229
|
+
attributeChanges?: AttrDiff[];
|
|
230
|
+
/** Table position (for table-related changes) */
|
|
231
|
+
tablePosition?: {
|
|
232
|
+
row: number;
|
|
233
|
+
column: number;
|
|
234
|
+
};
|
|
235
|
+
/** List position (for list-related changes) */
|
|
236
|
+
listPosition?: {
|
|
237
|
+
index: number;
|
|
238
|
+
depth: number;
|
|
239
|
+
};
|
|
104
240
|
}
|
|
105
241
|
/**
|
|
106
242
|
* Author information for track changes
|
|
@@ -153,6 +289,10 @@ interface DocumentInfo {
|
|
|
153
289
|
/** Page count */
|
|
154
290
|
pages: number;
|
|
155
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Position of the structural changes pane
|
|
294
|
+
*/
|
|
295
|
+
type StructuralPanePosition = 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
|
|
156
296
|
/**
|
|
157
297
|
* Props for DocxDiffEditor component
|
|
158
298
|
*/
|
|
@@ -181,6 +321,12 @@ interface DocxDiffEditorProps {
|
|
|
181
321
|
toolbarClassName?: string;
|
|
182
322
|
/** Editor container className */
|
|
183
323
|
editorClassName?: string;
|
|
324
|
+
/** Position of structural changes pane (default: 'bottom-right') */
|
|
325
|
+
structuralPanePosition?: StructuralPanePosition;
|
|
326
|
+
/** Start with pane collapsed (default: false) */
|
|
327
|
+
structuralPaneCollapsed?: boolean;
|
|
328
|
+
/** Hide structural changes pane entirely (default: false) */
|
|
329
|
+
hideStructuralPane?: boolean;
|
|
184
330
|
}
|
|
185
331
|
/**
|
|
186
332
|
* Ref methods exposed by DocxDiffEditor
|
|
@@ -223,6 +369,38 @@ interface DocxDiffEditorRef {
|
|
|
223
369
|
*/
|
|
224
370
|
declare const DocxDiffEditor: react.ForwardRefExoticComponent<DocxDiffEditorProps & react.RefAttributes<DocxDiffEditorRef>>;
|
|
225
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Structural Changes Pane Component
|
|
374
|
+
*
|
|
375
|
+
* A floating, collapsible panel that displays structural changes
|
|
376
|
+
* (table rows, list items, images, etc.) with Accept/Reject controls.
|
|
377
|
+
*
|
|
378
|
+
* Uses SuperDoc's acceptTrackedChangeById/rejectTrackedChangeById commands
|
|
379
|
+
* to handle accept/reject actions.
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
interface StructuralChangesPaneProps {
|
|
383
|
+
/** Array of structural changes to display */
|
|
384
|
+
changes: StructuralChangeInfo[];
|
|
385
|
+
/** Position of the pane */
|
|
386
|
+
position?: StructuralPanePosition;
|
|
387
|
+
/** Start collapsed? */
|
|
388
|
+
initiallyCollapsed?: boolean;
|
|
389
|
+
/** Callback when a change is accepted */
|
|
390
|
+
onAccept: (changeId: string) => void;
|
|
391
|
+
/** Callback when a change is rejected */
|
|
392
|
+
onReject: (changeId: string) => void;
|
|
393
|
+
/** Callback when Accept All is clicked */
|
|
394
|
+
onAcceptAll: () => void;
|
|
395
|
+
/** Callback when Reject All is clicked */
|
|
396
|
+
onRejectAll: () => void;
|
|
397
|
+
/** Callback when a change is clicked (for navigation) */
|
|
398
|
+
onNavigate?: (changeId: string) => void;
|
|
399
|
+
/** Callback when pane is dismissed */
|
|
400
|
+
onDismiss?: () => void;
|
|
401
|
+
}
|
|
402
|
+
declare const StructuralChangesPane: react__default.FC<StructuralChangesPaneProps>;
|
|
403
|
+
|
|
226
404
|
/**
|
|
227
405
|
* Content Resolver Service
|
|
228
406
|
* Detects content type and parses DOCX files to ProseMirror JSON.
|
|
@@ -303,12 +481,181 @@ declare function createTrackFormatMark(before: ProseMirrorMark[], after: ProseMi
|
|
|
303
481
|
* Change Context Extractor
|
|
304
482
|
* Extracts enriched changes with semantic context from merged document.
|
|
305
483
|
* Provides surrounding text so the LLM can understand what the change is about.
|
|
484
|
+
*
|
|
485
|
+
* Updated to include structural change information (tables, lists, images).
|
|
306
486
|
*/
|
|
307
487
|
|
|
308
488
|
/**
|
|
309
489
|
* Main entry point - extract enriched changes from merged document
|
|
310
490
|
*/
|
|
311
491
|
declare function extractEnrichedChanges(mergedJson: ProseMirrorJSON): EnrichedChange[];
|
|
492
|
+
/**
|
|
493
|
+
* Extract enriched changes with structural change infos included.
|
|
494
|
+
* This merges inline text changes with structural change metadata.
|
|
495
|
+
*/
|
|
496
|
+
declare function extractEnrichedChangesWithStructural(mergedJson: ProseMirrorJSON, structuralInfos: StructuralChangeInfo[]): EnrichedChange[];
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Node Fingerprint Service
|
|
500
|
+
*
|
|
501
|
+
* Generates content-based fingerprints for ProseMirror nodes.
|
|
502
|
+
* Fingerprints are used to match nodes between documents during diffing.
|
|
503
|
+
*
|
|
504
|
+
* Key principle: Two nodes with the same content (ignoring styles/attrs)
|
|
505
|
+
* should produce the same or similar fingerprints.
|
|
506
|
+
*/
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Generate a fingerprint for a single node.
|
|
510
|
+
*
|
|
511
|
+
* Fingerprint format by node type:
|
|
512
|
+
* - text: "t:{hash}"
|
|
513
|
+
* - paragraph: "p:{hash}"
|
|
514
|
+
* - heading: "h{level}:{hash}"
|
|
515
|
+
* - table: "table:{rowCount}:{hash}"
|
|
516
|
+
* - tableRow: "tr:{cellCount}:{hash}"
|
|
517
|
+
* - tableCell: "tc:{hash}"
|
|
518
|
+
* - listItem: "li:{hash}"
|
|
519
|
+
* - image: "img:{srcHash}"
|
|
520
|
+
* - hardBreak: "br"
|
|
521
|
+
* - horizontalRule: "hr"
|
|
522
|
+
* - other: "{type}:{hash}"
|
|
523
|
+
*/
|
|
524
|
+
declare function generateFingerprint(node: ProseMirrorJSON): string;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Node Aligner Service
|
|
528
|
+
*
|
|
529
|
+
* Aligns nodes between two documents using fingerprints and LCS algorithm.
|
|
530
|
+
* Produces matched pairs, insertions, and deletions.
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Result of aligning two node sequences
|
|
535
|
+
*/
|
|
536
|
+
interface AlignmentResult {
|
|
537
|
+
/** Nodes that match between documents */
|
|
538
|
+
matched: NodeMatch[];
|
|
539
|
+
/** Nodes only in document A (deleted) */
|
|
540
|
+
deletions: FingerprintedNode[];
|
|
541
|
+
/** Nodes only in document B (inserted) */
|
|
542
|
+
insertions: FingerprintedNode[];
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Align top-level blocks between two documents.
|
|
546
|
+
*/
|
|
547
|
+
declare function alignDocuments(docA: ProseMirrorJSON, docB: ProseMirrorJSON): AlignmentResult;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Table Block Differ Service
|
|
551
|
+
*
|
|
552
|
+
* Specialized diffing logic for tables:
|
|
553
|
+
* - Row insertions/deletions
|
|
554
|
+
* - Column insertions/deletions
|
|
555
|
+
* - Cell-level content changes
|
|
556
|
+
* - Table/cell attribute changes
|
|
557
|
+
*/
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Result of diffing two tables
|
|
561
|
+
*/
|
|
562
|
+
interface TableDiffResult {
|
|
563
|
+
/** Row-level structural changes */
|
|
564
|
+
rowChanges: StructuralChange[];
|
|
565
|
+
/** Column-level structural changes (detected from cell patterns) */
|
|
566
|
+
columnChanges: StructuralChange[];
|
|
567
|
+
/** Cell-level matches for content diffing */
|
|
568
|
+
cellMatches: NodeMatch[];
|
|
569
|
+
/** Attribute changes on the table itself */
|
|
570
|
+
tableAttrChanges: AttributeChange | null;
|
|
571
|
+
/** Attribute changes on cells */
|
|
572
|
+
cellAttrChanges: AttributeChange[];
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Diff two tables and return all detected changes.
|
|
576
|
+
*/
|
|
577
|
+
declare function diffTables(tableA: ProseMirrorJSON, tableB: ProseMirrorJSON, tablePathA: number[], tablePathB: number[]): TableDiffResult;
|
|
578
|
+
/**
|
|
579
|
+
* Check if a node is a table.
|
|
580
|
+
*/
|
|
581
|
+
declare function isTable(node: ProseMirrorJSON): boolean;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* List Block Differ Service
|
|
585
|
+
*
|
|
586
|
+
* Specialized diffing logic for lists:
|
|
587
|
+
* - List item insertions/deletions
|
|
588
|
+
* - List item reordering detection
|
|
589
|
+
* - Nested list handling
|
|
590
|
+
*/
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Result of diffing two lists
|
|
594
|
+
*/
|
|
595
|
+
interface ListDiffResult {
|
|
596
|
+
/** Item-level structural changes */
|
|
597
|
+
itemChanges: StructuralChange[];
|
|
598
|
+
/** Item matches for content diffing */
|
|
599
|
+
itemMatches: NodeMatch[];
|
|
600
|
+
/** Nested list changes (recursive) */
|
|
601
|
+
nestedChanges: ListDiffResult[];
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Check if a node is a list (ordered or unordered).
|
|
605
|
+
*/
|
|
606
|
+
declare function isList(node: ProseMirrorJSON): boolean;
|
|
607
|
+
/**
|
|
608
|
+
* Diff two lists and return all detected changes.
|
|
609
|
+
*/
|
|
610
|
+
declare function diffLists(listA: ProseMirrorJSON, listB: ProseMirrorJSON, listPathA: number[], listPathB: number[], depth?: number): ListDiffResult;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Non-Text Node Differ Service
|
|
614
|
+
*
|
|
615
|
+
* Handles diffing of atomic non-text nodes:
|
|
616
|
+
* - Images
|
|
617
|
+
* - Horizontal rules
|
|
618
|
+
* - Page breaks
|
|
619
|
+
* - Embedded objects (equations, etc.)
|
|
620
|
+
*/
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Check if a node is an image.
|
|
624
|
+
*/
|
|
625
|
+
declare function isImage(node: ProseMirrorJSON): boolean;
|
|
626
|
+
/**
|
|
627
|
+
* Check if a node is an atomic (non-text, leaf) node.
|
|
628
|
+
*/
|
|
629
|
+
declare function isAtomicNode(node: ProseMirrorJSON): boolean;
|
|
630
|
+
/**
|
|
631
|
+
* Diff images between two documents.
|
|
632
|
+
*/
|
|
633
|
+
declare function diffImages(docA: ProseMirrorJSON, docB: ProseMirrorJSON): {
|
|
634
|
+
inserted: StructuralChange[];
|
|
635
|
+
deleted: StructuralChange[];
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Block Level Merger Service
|
|
640
|
+
*
|
|
641
|
+
* Handles merging of structural changes (tables, lists, images)
|
|
642
|
+
* with shared IDs for all marks within a structural change.
|
|
643
|
+
*
|
|
644
|
+
* This allows the Structural Changes Pane to accept/reject
|
|
645
|
+
* entire structural units (e.g., a whole table row) with a single action.
|
|
646
|
+
*/
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Process structural changes and generate marked blocks with shared IDs.
|
|
650
|
+
*/
|
|
651
|
+
declare function processStructuralChanges(docA: ProseMirrorNode, docB: ProseMirrorNode, author?: TrackChangeAuthor): {
|
|
652
|
+
changes: StructuralChange[];
|
|
653
|
+
infos: StructuralChangeInfo[];
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Generate a summary of structural changes.
|
|
657
|
+
*/
|
|
658
|
+
declare function generateStructuralChangeSummary(infos: StructuralChangeInfo[]): string[];
|
|
312
659
|
|
|
313
660
|
/**
|
|
314
661
|
* Constants for DocxDiffEditor
|
|
@@ -363,4 +710,4 @@ declare function getBlankTemplateBlob(): Blob;
|
|
|
363
710
|
*/
|
|
364
711
|
declare function isValidDocxFile(file: File): boolean;
|
|
365
712
|
|
|
366
|
-
export { CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, type DocumentInfo, type DocumentProperties, type DocxContent, DocxDiffEditor, type DocxDiffEditorProps, type DocxDiffEditorRef, type EnrichedChange, type FormatChange, type FormatDetails, type ProseMirrorJSON, type ProseMirrorMark, type ProseMirrorNode, type TrackChangeAuthor, createTrackDeleteMark, createTrackFormatMark, createTrackInsertMark, DocxDiffEditor as default, detectContentType, diffDocuments, extractEnrichedChanges, getBlankTemplateBlob, getBlankTemplateFile, isProseMirrorJSON, isValidDocxFile, mergeDocuments, parseDocxFile };
|
|
713
|
+
export { type AttrDiff, type AttributeChange, CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, type DocumentInfo, type DocumentProperties, type DocxContent, DocxDiffEditor, type DocxDiffEditorProps, type DocxDiffEditorRef, type EnrichedChange, type FingerprintedNode, type FormatChange, type FormatDetails, type HybridDiffResult, type NodeMatch, type ProseMirrorJSON, type ProseMirrorMark, type ProseMirrorNode, type StructuralChange, type StructuralChangeInfo, type StructuralChangeType, StructuralChangesPane, type StructuralPanePosition, type TrackChangeAuthor, alignDocuments, createTrackDeleteMark, createTrackFormatMark, createTrackInsertMark, DocxDiffEditor as default, detectContentType, diffDocuments, diffImages, diffLists, diffTables, extractEnrichedChanges, extractEnrichedChangesWithStructural, generateFingerprint, generateStructuralChangeSummary, getBlankTemplateBlob, getBlankTemplateFile, isAtomicNode, isImage, isList, isProseMirrorJSON, isTable, isValidDocxFile, mergeDocuments, parseDocxFile, processStructuralChanges };
|