docx-diff-editor 1.0.56 → 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.mjs CHANGED
@@ -1102,17 +1102,31 @@ function getMarksAtPosition(spans, pos) {
1102
1102
  }
1103
1103
  return [];
1104
1104
  }
1105
+ var INHERENT_FORMAT_MARKS = /* @__PURE__ */ new Set([
1106
+ "bold",
1107
+ "italic",
1108
+ "strike",
1109
+ "underline",
1110
+ "code",
1111
+ "subscript",
1112
+ "superscript"
1113
+ ]);
1105
1114
  function hasDefinedAttributes(marks) {
1106
1115
  if (!marks || marks.length === 0) return false;
1107
1116
  for (const mark of marks) {
1108
- if (!mark.attrs) continue;
1117
+ if (INHERENT_FORMAT_MARKS.has(mark.type)) {
1118
+ return true;
1119
+ }
1120
+ if (!mark.attrs) {
1121
+ return true;
1122
+ }
1109
1123
  for (const value of Object.values(mark.attrs)) {
1110
- if (value !== void 0 && value !== null) {
1124
+ if (value !== void 0 && value !== null && value !== "") {
1111
1125
  return true;
1112
1126
  }
1113
1127
  }
1114
1128
  }
1115
- return marks.some((m) => !m.attrs);
1129
+ return false;
1116
1130
  }
1117
1131
  function detectFormatChanges(spansA, spansB, segments) {
1118
1132
  const formatChanges = [];