@manuscripts/track-changes-plugin 1.5.2 → 1.6.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.
package/dist/index.cjs CHANGED
@@ -448,7 +448,8 @@ function deleteNode(node, pos, tr) {
448
448
  const resPos = tr.doc.resolve(pos);
449
449
  // Block nodes can be deleted by just removing their start token which should then merge the text
450
450
  // content to above node's content (if there is one)
451
- const canMergeToNodeAbove = (resPos.parent !== tr.doc || resPos.nodeBefore) && node.isBlock && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
451
+ // this will work just for the node after the first child
452
+ const canMergeToNodeAbove = resPos.parent !== tr.doc && resPos.nodeBefore && node.isBlock && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
452
453
  if (canMergeToNodeAbove) {
453
454
  return tr.replaceWith(pos - 1, pos + 1, prosemirrorModel.Fragment.empty);
454
455
  }
@@ -509,9 +510,9 @@ function mergeNode(node, pos, tr) {
509
510
  if (prosemirrorTransform.canJoin(tr.doc, pos)) {
510
511
  return tr.join(pos);
511
512
  }
512
- else if (prosemirrorTransform.canJoin(tr.doc, pos + node.nodeSize)) {
513
- // TODO should copy the attributes from the merged node below
514
- return tr.join(pos + node.nodeSize);
513
+ else if (!tr.doc.resolve(pos).nodeBefore) {
514
+ // for this case will just delete that node in `deleteNode.ts` as the join will not work
515
+ return undefined;
515
516
  }
516
517
  // TODO is this the same thing as join to above?
517
518
  const resPos = tr.doc.resolve(pos);
package/dist/index.js CHANGED
@@ -440,7 +440,8 @@ function deleteNode(node, pos, tr) {
440
440
  const resPos = tr.doc.resolve(pos);
441
441
  // Block nodes can be deleted by just removing their start token which should then merge the text
442
442
  // content to above node's content (if there is one)
443
- const canMergeToNodeAbove = (resPos.parent !== tr.doc || resPos.nodeBefore) && node.isBlock && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
443
+ // this will work just for the node after the first child
444
+ const canMergeToNodeAbove = resPos.parent !== tr.doc && resPos.nodeBefore && node.isBlock && ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.isText);
444
445
  if (canMergeToNodeAbove) {
445
446
  return tr.replaceWith(pos - 1, pos + 1, Fragment.empty);
446
447
  }
@@ -501,9 +502,9 @@ function mergeNode(node, pos, tr) {
501
502
  if (canJoin(tr.doc, pos)) {
502
503
  return tr.join(pos);
503
504
  }
504
- else if (canJoin(tr.doc, pos + node.nodeSize)) {
505
- // TODO should copy the attributes from the merged node below
506
- return tr.join(pos + node.nodeSize);
505
+ else if (!tr.doc.resolve(pos).nodeBefore) {
506
+ // for this case will just delete that node in `deleteNode.ts` as the join will not work
507
+ return undefined;
507
508
  }
508
509
  // TODO is this the same thing as join to above?
509
510
  const resPos = tr.doc.resolve(pos);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/track-changes-plugin",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "author": "Atypon Systems LLC",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Atypon-OpenSource/manuscripts-quarterback/tree/main/quarterback-packages/track-changes-plugin",