docx-diff-editor 1.0.35 → 1.0.37
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 +22 -0
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,6 +132,12 @@ interface DocxDiffEditorRef {
|
|
|
132
132
|
|
|
133
133
|
// Check if ready
|
|
134
134
|
isReady(): boolean;
|
|
135
|
+
|
|
136
|
+
// Get current page count
|
|
137
|
+
getPages(): number;
|
|
138
|
+
|
|
139
|
+
// Get document metadata and statistics
|
|
140
|
+
getDocumentInfo(): DocumentInfo | null;
|
|
135
141
|
}
|
|
136
142
|
```
|
|
137
143
|
|
|
@@ -148,6 +154,22 @@ interface ComparisonResult {
|
|
|
148
154
|
}
|
|
149
155
|
```
|
|
150
156
|
|
|
157
|
+
### DocumentInfo
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
interface DocumentInfo {
|
|
161
|
+
// Metadata
|
|
162
|
+
documentGuid: string | null;
|
|
163
|
+
isModified: boolean;
|
|
164
|
+
version: number | null;
|
|
165
|
+
// Statistics
|
|
166
|
+
words: number;
|
|
167
|
+
characters: number;
|
|
168
|
+
paragraphs: number;
|
|
169
|
+
pages: number;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
151
173
|
## Getting LLM Context
|
|
152
174
|
|
|
153
175
|
Extract enriched changes with semantic context for AI/LLM processing:
|
package/dist/index.d.mts
CHANGED
|
@@ -109,6 +109,25 @@ interface TrackChangeAuthor {
|
|
|
109
109
|
name: string;
|
|
110
110
|
email: string;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Combined document metadata and statistics
|
|
114
|
+
*/
|
|
115
|
+
interface DocumentInfo {
|
|
116
|
+
/** Document unique identifier */
|
|
117
|
+
documentGuid: string | null;
|
|
118
|
+
/** Whether the document has unsaved changes */
|
|
119
|
+
isModified: boolean;
|
|
120
|
+
/** Document version number */
|
|
121
|
+
version: number | null;
|
|
122
|
+
/** Word count */
|
|
123
|
+
words: number;
|
|
124
|
+
/** Character count */
|
|
125
|
+
characters: number;
|
|
126
|
+
/** Paragraph count */
|
|
127
|
+
paragraphs: number;
|
|
128
|
+
/** Page count */
|
|
129
|
+
pages: number;
|
|
130
|
+
}
|
|
112
131
|
/**
|
|
113
132
|
* Props for DocxDiffEditor component
|
|
114
133
|
*/
|
|
@@ -164,6 +183,10 @@ interface DocxDiffEditorRef {
|
|
|
164
183
|
acceptAllChanges(): Promise<ProseMirrorJSON>;
|
|
165
184
|
/** Check if editor is ready */
|
|
166
185
|
isReady(): boolean;
|
|
186
|
+
/** Get the current page count from the presentation editor */
|
|
187
|
+
getPages(): number;
|
|
188
|
+
/** Get combined document metadata and statistics */
|
|
189
|
+
getDocumentInfo(): DocumentInfo | null;
|
|
167
190
|
}
|
|
168
191
|
|
|
169
192
|
/**
|
|
@@ -311,4 +334,4 @@ declare function getBlankTemplateBlob(): Blob;
|
|
|
311
334
|
*/
|
|
312
335
|
declare function isValidDocxFile(file: File): boolean;
|
|
313
336
|
|
|
314
|
-
export { CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, 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 };
|
|
337
|
+
export { CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, type DocumentInfo, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -109,6 +109,25 @@ interface TrackChangeAuthor {
|
|
|
109
109
|
name: string;
|
|
110
110
|
email: string;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Combined document metadata and statistics
|
|
114
|
+
*/
|
|
115
|
+
interface DocumentInfo {
|
|
116
|
+
/** Document unique identifier */
|
|
117
|
+
documentGuid: string | null;
|
|
118
|
+
/** Whether the document has unsaved changes */
|
|
119
|
+
isModified: boolean;
|
|
120
|
+
/** Document version number */
|
|
121
|
+
version: number | null;
|
|
122
|
+
/** Word count */
|
|
123
|
+
words: number;
|
|
124
|
+
/** Character count */
|
|
125
|
+
characters: number;
|
|
126
|
+
/** Paragraph count */
|
|
127
|
+
paragraphs: number;
|
|
128
|
+
/** Page count */
|
|
129
|
+
pages: number;
|
|
130
|
+
}
|
|
112
131
|
/**
|
|
113
132
|
* Props for DocxDiffEditor component
|
|
114
133
|
*/
|
|
@@ -164,6 +183,10 @@ interface DocxDiffEditorRef {
|
|
|
164
183
|
acceptAllChanges(): Promise<ProseMirrorJSON>;
|
|
165
184
|
/** Check if editor is ready */
|
|
166
185
|
isReady(): boolean;
|
|
186
|
+
/** Get the current page count from the presentation editor */
|
|
187
|
+
getPages(): number;
|
|
188
|
+
/** Get combined document metadata and statistics */
|
|
189
|
+
getDocumentInfo(): DocumentInfo | null;
|
|
167
190
|
}
|
|
168
191
|
|
|
169
192
|
/**
|
|
@@ -311,4 +334,4 @@ declare function getBlankTemplateBlob(): Blob;
|
|
|
311
334
|
*/
|
|
312
335
|
declare function isValidDocxFile(file: File): boolean;
|
|
313
336
|
|
|
314
|
-
export { CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, 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 };
|
|
337
|
+
export { CSS_PREFIX, type ChangeLocation, type ComparisonResult, DEFAULT_AUTHOR, DEFAULT_SUPERDOC_USER, type DiffResult, type DiffSegment, type DocumentInfo, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1177,6 +1177,65 @@ var DocxDiffEditor = react.forwardRef(
|
|
|
1177
1177
|
*/
|
|
1178
1178
|
isReady() {
|
|
1179
1179
|
return readyRef.current;
|
|
1180
|
+
},
|
|
1181
|
+
/**
|
|
1182
|
+
* Get the current page count from the presentation editor.
|
|
1183
|
+
* Returns 0 if editor is not ready or pages are unavailable.
|
|
1184
|
+
*/
|
|
1185
|
+
getPages() {
|
|
1186
|
+
if (!readyRef.current || !superdocRef.current) {
|
|
1187
|
+
return 0;
|
|
1188
|
+
}
|
|
1189
|
+
try {
|
|
1190
|
+
const sd = superdocRef.current;
|
|
1191
|
+
const doc = sd.superdocStore?.documents?.[0];
|
|
1192
|
+
if (!doc) {
|
|
1193
|
+
return 0;
|
|
1194
|
+
}
|
|
1195
|
+
const presentationEditor = doc.getPresentationEditor?.();
|
|
1196
|
+
const pages = presentationEditor?.getPages?.();
|
|
1197
|
+
return pages?.length ?? 0;
|
|
1198
|
+
} catch (err) {
|
|
1199
|
+
console.warn("[DocxDiffEditor] Failed to get page count:", err);
|
|
1200
|
+
return 0;
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
/**
|
|
1204
|
+
* Get combined document metadata and statistics.
|
|
1205
|
+
* Returns null if editor is not ready.
|
|
1206
|
+
*/
|
|
1207
|
+
getDocumentInfo() {
|
|
1208
|
+
if (!readyRef.current || !superdocRef.current) {
|
|
1209
|
+
return null;
|
|
1210
|
+
}
|
|
1211
|
+
try {
|
|
1212
|
+
const sd = superdocRef.current;
|
|
1213
|
+
const doc = sd.superdocStore?.documents?.[0];
|
|
1214
|
+
if (!doc) {
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
const editor = doc.getEditor?.();
|
|
1218
|
+
const metadata = editor?.getMetadata?.() ?? {};
|
|
1219
|
+
const stats = editor?.commands?.getDocumentStats?.() ?? {};
|
|
1220
|
+
const presentationEditor = doc.getPresentationEditor?.();
|
|
1221
|
+
const pages = presentationEditor?.getPages?.();
|
|
1222
|
+
const pageCount = pages?.length ?? 0;
|
|
1223
|
+
return {
|
|
1224
|
+
// Metadata
|
|
1225
|
+
documentGuid: metadata.documentGuid ?? null,
|
|
1226
|
+
isModified: metadata.isModified ?? false,
|
|
1227
|
+
version: metadata.version ?? null,
|
|
1228
|
+
// Stats
|
|
1229
|
+
words: stats.words ?? 0,
|
|
1230
|
+
characters: stats.characters ?? 0,
|
|
1231
|
+
paragraphs: stats.paragraphs ?? 0,
|
|
1232
|
+
// Pages
|
|
1233
|
+
pages: pageCount
|
|
1234
|
+
};
|
|
1235
|
+
} catch (err) {
|
|
1236
|
+
console.warn("[DocxDiffEditor] Failed to get document info:", err);
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1180
1239
|
}
|
|
1181
1240
|
}),
|
|
1182
1241
|
[
|