@manuscripts/track-changes-plugin 1.10.4 → 1.10.5-LEAN-4372.1

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.
@@ -149,11 +149,16 @@ class ChangeSet {
149
149
  canJoinAdjacentInlineChanges(change, index) {
150
150
  const nextChange = this.changeTree.at(index + 1);
151
151
  const isInline = (c) => c.type === 'text-change' || (c.type === 'node-change' && c.node.isInline);
152
+ const hasMatchingOperation = (c1, c2) => c1.dataTracked.operation === c2.dataTracked.operation ||
153
+ (c1.dataTracked.operation === 'wrap_with_node' &&
154
+ (c2.dataTracked.operation === 'insert' || c2.dataTracked.operation === 'set_attrs')) ||
155
+ (c2.dataTracked.operation === 'wrap_with_node' &&
156
+ (c1.dataTracked.operation === 'insert' || c1.dataTracked.operation === 'set_attrs'));
152
157
  return (isInline(change) &&
153
158
  nextChange &&
154
159
  isInline(nextChange) &&
155
160
  change.to === nextChange.from &&
156
- change.dataTracked.operation === nextChange.dataTracked.operation);
161
+ hasMatchingOperation(change, nextChange));
157
162
  }
158
163
  static flattenTreeToIds(changes) {
159
164
  return changes.flatMap((c) => (this.isNodeChange(c) ? [c.id, ...c.children.map((c) => c.id)] : c.id));
@@ -146,11 +146,16 @@ export class ChangeSet {
146
146
  canJoinAdjacentInlineChanges(change, index) {
147
147
  const nextChange = this.changeTree.at(index + 1);
148
148
  const isInline = (c) => c.type === 'text-change' || (c.type === 'node-change' && c.node.isInline);
149
+ const hasMatchingOperation = (c1, c2) => c1.dataTracked.operation === c2.dataTracked.operation ||
150
+ (c1.dataTracked.operation === 'wrap_with_node' &&
151
+ (c2.dataTracked.operation === 'insert' || c2.dataTracked.operation === 'set_attrs')) ||
152
+ (c2.dataTracked.operation === 'wrap_with_node' &&
153
+ (c1.dataTracked.operation === 'insert' || c1.dataTracked.operation === 'set_attrs'));
149
154
  return (isInline(change) &&
150
155
  nextChange &&
151
156
  isInline(nextChange) &&
152
157
  change.to === nextChange.from &&
153
- change.dataTracked.operation === nextChange.dataTracked.operation);
158
+ hasMatchingOperation(change, nextChange));
154
159
  }
155
160
  static flattenTreeToIds(changes) {
156
161
  return changes.flatMap((c) => (this.isNodeChange(c) ? [c.id, ...c.children.map((c) => c.id)] : c.id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/track-changes-plugin",
3
- "version": "1.10.4",
3
+ "version": "1.10.5-LEAN-4372.1",
4
4
  "author": "Atypon Systems LLC",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@manuscripts/eslint-config": "^0.5.1",
29
- "@manuscripts/transform": "3.0.45",
29
+ "@manuscripts/transform": "3.0.48",
30
30
  "@types/debug": "^4.1.7",
31
31
  "@types/jest": "27.5.1",
32
32
  "@types/node": "^18.7.18",