docx-diff-editor 1.0.55 → 1.0.57

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.js CHANGED
@@ -1110,17 +1110,31 @@ function getMarksAtPosition(spans, pos) {
1110
1110
  }
1111
1111
  return [];
1112
1112
  }
1113
+ var INHERENT_FORMAT_MARKS = /* @__PURE__ */ new Set([
1114
+ "bold",
1115
+ "italic",
1116
+ "strike",
1117
+ "underline",
1118
+ "code",
1119
+ "subscript",
1120
+ "superscript"
1121
+ ]);
1113
1122
  function hasDefinedAttributes(marks) {
1114
1123
  if (!marks || marks.length === 0) return false;
1115
1124
  for (const mark of marks) {
1116
- if (!mark.attrs) continue;
1125
+ if (INHERENT_FORMAT_MARKS.has(mark.type)) {
1126
+ return true;
1127
+ }
1128
+ if (!mark.attrs) {
1129
+ return true;
1130
+ }
1117
1131
  for (const value of Object.values(mark.attrs)) {
1118
- if (value !== void 0 && value !== null) {
1132
+ if (value !== void 0 && value !== null && value !== "") {
1119
1133
  return true;
1120
1134
  }
1121
1135
  }
1122
1136
  }
1123
- return marks.some((m) => !m.attrs);
1137
+ return false;
1124
1138
  }
1125
1139
  function detectFormatChanges(spansA, spansB, segments) {
1126
1140
  const formatChanges = [];
@@ -3295,11 +3309,12 @@ var DocxDiffEditor = react.forwardRef(
3295
3309
  );
3296
3310
  const merged = structuralResult.mergedDoc;
3297
3311
  const structInfos = structuralResult.structuralInfos;
3298
- setMergedJson(merged);
3312
+ const normalizedMerged = normalizeRunProperties(merged);
3313
+ setMergedJson(normalizedMerged);
3299
3314
  const diff = diffDocuments(cleanBaseline, cleanNewJson);
3300
3315
  setDiffResult(diff);
3301
3316
  if (superdocRef.current?.activeEditor) {
3302
- setEditorContent(superdocRef.current.activeEditor, merged);
3317
+ setEditorContent(superdocRef.current.activeEditor, normalizedMerged);
3303
3318
  enableReviewMode(superdocRef.current);
3304
3319
  const sd = superdocRef.current;
3305
3320
  if (sd.commentsStore?.processLoadedDocxComments) {