docx-diff-editor 1.0.28 → 1.0.30
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/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -158,6 +158,8 @@ interface DocxDiffEditorRef {
|
|
|
158
158
|
exportDocx(): Promise<Blob>;
|
|
159
159
|
/** Reset to source state (clear comparison) */
|
|
160
160
|
resetComparison(): void;
|
|
161
|
+
/** Accept all track changes and return the clean document */
|
|
162
|
+
acceptAllChanges(): Promise<ProseMirrorJSON>;
|
|
161
163
|
/** Check if editor is ready */
|
|
162
164
|
isReady(): boolean;
|
|
163
165
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -158,6 +158,8 @@ interface DocxDiffEditorRef {
|
|
|
158
158
|
exportDocx(): Promise<Blob>;
|
|
159
159
|
/** Reset to source state (clear comparison) */
|
|
160
160
|
resetComparison(): void;
|
|
161
|
+
/** Accept all track changes and return the clean document */
|
|
162
|
+
acceptAllChanges(): Promise<ProseMirrorJSON>;
|
|
161
163
|
/** Check if editor is ready */
|
|
162
164
|
isReady(): boolean;
|
|
163
165
|
}
|
package/dist/index.js
CHANGED
|
@@ -1108,6 +1108,31 @@ var DocxDiffEditor = react.forwardRef(
|
|
|
1108
1108
|
setDiffResult(null);
|
|
1109
1109
|
}
|
|
1110
1110
|
},
|
|
1111
|
+
/**
|
|
1112
|
+
* Accept all track changes and return the clean document
|
|
1113
|
+
*/
|
|
1114
|
+
async acceptAllChanges() {
|
|
1115
|
+
const editor = superdocRef.current?.activeEditor;
|
|
1116
|
+
const sd = superdocRef.current;
|
|
1117
|
+
if (!editor || !sd) {
|
|
1118
|
+
throw new Error("Editor not ready");
|
|
1119
|
+
}
|
|
1120
|
+
const editorAny = editor;
|
|
1121
|
+
const sdAny = sd;
|
|
1122
|
+
if (typeof editorAny.commands?.acceptAllChanges === "function") {
|
|
1123
|
+
editorAny.commands.acceptAllChanges();
|
|
1124
|
+
} else if (typeof sdAny.commands?.acceptAllChanges === "function") {
|
|
1125
|
+
sdAny.commands.acceptAllChanges();
|
|
1126
|
+
} else if (typeof sdAny.acceptAllChanges === "function") {
|
|
1127
|
+
sdAny.acceptAllChanges();
|
|
1128
|
+
} else {
|
|
1129
|
+
sd.setTrackedChangesPreferences?.({ mode: "final", enabled: true });
|
|
1130
|
+
}
|
|
1131
|
+
const cleanJson = editor.getJSON();
|
|
1132
|
+
setMergedJson(null);
|
|
1133
|
+
setDiffResult(null);
|
|
1134
|
+
return cleanJson;
|
|
1135
|
+
},
|
|
1111
1136
|
/**
|
|
1112
1137
|
* Check if editor is ready
|
|
1113
1138
|
*/
|