@manuscripts/track-changes-plugin 1.9.3 → 1.9.5-LEAN-4312.0

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.
@@ -14,7 +14,7 @@ function mergeNode(node, pos, tr) {
14
14
  const resPos = tr.doc.resolve(pos);
15
15
  const canMergeToNodeAbove = (resPos.parent !== tr.doc || resPos.nodeBefore) && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
16
16
  if (canMergeToNodeAbove) {
17
- return tr.replaceWith(pos - 1, pos + 1, prosemirror_model_1.Fragment.empty);
17
+ return tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos + node.nodeSize), prosemirror_model_1.Fragment.empty);
18
18
  }
19
19
  return undefined;
20
20
  }
@@ -39,7 +39,8 @@ function trackTransaction(tr, oldState, newTr, authorID) {
39
39
  logger_1.log.info('transaction step', step);
40
40
  iters += 1;
41
41
  const uiEvent = tr.getMeta('uiEvent');
42
- if (iters > 20 && uiEvent != 'cut') {
42
+ const isMassReplace = tr.getMeta('massSearchReplace');
43
+ if (iters > 20 && uiEvent != 'cut' && !isMassReplace) {
43
44
  console.error('@manuscripts/track-changes-plugin: Possible infinite loop in iterating tr.steps, tracking skipped!\n' +
44
45
  'This is probably an error with the library, please report back to maintainers with a reproduction if possible', newTr);
45
46
  continue;
@@ -11,7 +11,7 @@ export function mergeNode(node, pos, tr) {
11
11
  const resPos = tr.doc.resolve(pos);
12
12
  const canMergeToNodeAbove = (resPos.parent !== tr.doc || resPos.nodeBefore) && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
13
13
  if (canMergeToNodeAbove) {
14
- return tr.replaceWith(pos - 1, pos + 1, Fragment.empty);
14
+ return tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos + node.nodeSize), Fragment.empty);
15
15
  }
16
16
  return undefined;
17
17
  }
@@ -33,7 +33,8 @@ export function trackTransaction(tr, oldState, newTr, authorID) {
33
33
  log.info('transaction step', step);
34
34
  iters += 1;
35
35
  const uiEvent = tr.getMeta('uiEvent');
36
- if (iters > 20 && uiEvent != 'cut') {
36
+ const isMassReplace = tr.getMeta('massSearchReplace');
37
+ if (iters > 20 && uiEvent != 'cut' && !isMassReplace) {
37
38
  console.error('@manuscripts/track-changes-plugin: Possible infinite loop in iterating tr.steps, tracking skipped!\n' +
38
39
  'This is probably an error with the library, please report back to maintainers with a reproduction if possible', newTr);
39
40
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/track-changes-plugin",
3
- "version": "1.9.3",
3
+ "version": "1.9.5-LEAN-4312.0",
4
4
  "author": "Atypon Systems LLC",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",