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/dist/index.mjs
CHANGED
|
@@ -1169,6 +1169,65 @@ var DocxDiffEditor = forwardRef(
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
isReady() {
|
|
1171
1171
|
return readyRef.current;
|
|
1172
|
+
},
|
|
1173
|
+
/**
|
|
1174
|
+
* Get the current page count from the presentation editor.
|
|
1175
|
+
* Returns 0 if editor is not ready or pages are unavailable.
|
|
1176
|
+
*/
|
|
1177
|
+
getPages() {
|
|
1178
|
+
if (!readyRef.current || !superdocRef.current) {
|
|
1179
|
+
return 0;
|
|
1180
|
+
}
|
|
1181
|
+
try {
|
|
1182
|
+
const sd = superdocRef.current;
|
|
1183
|
+
const doc = sd.superdocStore?.documents?.[0];
|
|
1184
|
+
if (!doc) {
|
|
1185
|
+
return 0;
|
|
1186
|
+
}
|
|
1187
|
+
const presentationEditor = doc.getPresentationEditor?.();
|
|
1188
|
+
const pages = presentationEditor?.getPages?.();
|
|
1189
|
+
return pages?.length ?? 0;
|
|
1190
|
+
} catch (err) {
|
|
1191
|
+
console.warn("[DocxDiffEditor] Failed to get page count:", err);
|
|
1192
|
+
return 0;
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
/**
|
|
1196
|
+
* Get combined document metadata and statistics.
|
|
1197
|
+
* Returns null if editor is not ready.
|
|
1198
|
+
*/
|
|
1199
|
+
getDocumentInfo() {
|
|
1200
|
+
if (!readyRef.current || !superdocRef.current) {
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
1203
|
+
try {
|
|
1204
|
+
const sd = superdocRef.current;
|
|
1205
|
+
const doc = sd.superdocStore?.documents?.[0];
|
|
1206
|
+
if (!doc) {
|
|
1207
|
+
return null;
|
|
1208
|
+
}
|
|
1209
|
+
const editor = doc.getEditor?.();
|
|
1210
|
+
const metadata = editor?.getMetadata?.() ?? {};
|
|
1211
|
+
const stats = editor?.commands?.getDocumentStats?.() ?? {};
|
|
1212
|
+
const presentationEditor = doc.getPresentationEditor?.();
|
|
1213
|
+
const pages = presentationEditor?.getPages?.();
|
|
1214
|
+
const pageCount = pages?.length ?? 0;
|
|
1215
|
+
return {
|
|
1216
|
+
// Metadata
|
|
1217
|
+
documentGuid: metadata.documentGuid ?? null,
|
|
1218
|
+
isModified: metadata.isModified ?? false,
|
|
1219
|
+
version: metadata.version ?? null,
|
|
1220
|
+
// Stats
|
|
1221
|
+
words: stats.words ?? 0,
|
|
1222
|
+
characters: stats.characters ?? 0,
|
|
1223
|
+
paragraphs: stats.paragraphs ?? 0,
|
|
1224
|
+
// Pages
|
|
1225
|
+
pages: pageCount
|
|
1226
|
+
};
|
|
1227
|
+
} catch (err) {
|
|
1228
|
+
console.warn("[DocxDiffEditor] Failed to get document info:", err);
|
|
1229
|
+
return null;
|
|
1230
|
+
}
|
|
1172
1231
|
}
|
|
1173
1232
|
}),
|
|
1174
1233
|
[
|