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.mjs
CHANGED
|
@@ -1100,6 +1100,31 @@ var DocxDiffEditor = forwardRef(
|
|
|
1100
1100
|
setDiffResult(null);
|
|
1101
1101
|
}
|
|
1102
1102
|
},
|
|
1103
|
+
/**
|
|
1104
|
+
* Accept all track changes and return the clean document
|
|
1105
|
+
*/
|
|
1106
|
+
async acceptAllChanges() {
|
|
1107
|
+
const editor = superdocRef.current?.activeEditor;
|
|
1108
|
+
const sd = superdocRef.current;
|
|
1109
|
+
if (!editor || !sd) {
|
|
1110
|
+
throw new Error("Editor not ready");
|
|
1111
|
+
}
|
|
1112
|
+
const editorAny = editor;
|
|
1113
|
+
const sdAny = sd;
|
|
1114
|
+
if (typeof editorAny.commands?.acceptAllChanges === "function") {
|
|
1115
|
+
editorAny.commands.acceptAllChanges();
|
|
1116
|
+
} else if (typeof sdAny.commands?.acceptAllChanges === "function") {
|
|
1117
|
+
sdAny.commands.acceptAllChanges();
|
|
1118
|
+
} else if (typeof sdAny.acceptAllChanges === "function") {
|
|
1119
|
+
sdAny.acceptAllChanges();
|
|
1120
|
+
} else {
|
|
1121
|
+
sd.setTrackedChangesPreferences?.({ mode: "final", enabled: true });
|
|
1122
|
+
}
|
|
1123
|
+
const cleanJson = editor.getJSON();
|
|
1124
|
+
setMergedJson(null);
|
|
1125
|
+
setDiffResult(null);
|
|
1126
|
+
return cleanJson;
|
|
1127
|
+
},
|
|
1103
1128
|
/**
|
|
1104
1129
|
* Check if editor is ready
|
|
1105
1130
|
*/
|