@manuscripts/track-changes-plugin 0.4.5 → 1.0.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
@@ -1395,7 +1395,7 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema) {
1395
1395
  }
1396
1396
  else if (c.type === 'update-node-attrs') {
1397
1397
  const oldDataTracked = getBlockInlineTrackedData(c.node) || [];
1398
- const oldUpdate = oldDataTracked.find((d) => d.operation === exports.CHANGE_OPERATION.set_node_attributes);
1398
+ const oldUpdate = oldDataTracked.find((d) => d.operation === exports.CHANGE_OPERATION.set_node_attributes && d.status === exports.CHANGE_STATUS.pending);
1399
1399
  const { dataTracked, ...oldAttrs } = (oldUpdate === null || oldUpdate === void 0 ? void 0 : oldUpdate.oldAttrs) || c.node.attrs;
1400
1400
  const newDataTracked = [...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id)];
1401
1401
  const newUpdate = oldUpdate
@@ -1644,7 +1644,7 @@ function trackTransaction(tr, oldState, newTr, authorID) {
1644
1644
  };
1645
1645
  // Must use constructor.name instead of instanceof as aliasing prosemirror-state is a lot more
1646
1646
  // difficult than prosemirror-transform
1647
- const wasNodeSelection = tr.selection.constructor.name === 'NodeSelection';
1647
+ const wasNodeSelection = tr.selection instanceof prosemirrorState.NodeSelection;
1648
1648
  let iters = 0;
1649
1649
  log.info('ORIGINAL transaction', tr);
1650
1650
  tr.steps.forEach((step) => {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginKey, Plugin } from 'prosemirror-state';
1
+ import { NodeSelection, PluginKey, Plugin } from 'prosemirror-state';
2
2
  import debug from 'debug';
3
3
  import { liftTarget, canJoin, Mapping, ReplaceStep, ReplaceAroundStep } from 'prosemirror-transform';
4
4
  import { Fragment, Slice } from 'prosemirror-model';
@@ -1387,7 +1387,7 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema) {
1387
1387
  }
1388
1388
  else if (c.type === 'update-node-attrs') {
1389
1389
  const oldDataTracked = getBlockInlineTrackedData(c.node) || [];
1390
- const oldUpdate = oldDataTracked.find((d) => d.operation === CHANGE_OPERATION.set_node_attributes);
1390
+ const oldUpdate = oldDataTracked.find((d) => d.operation === CHANGE_OPERATION.set_node_attributes && d.status === CHANGE_STATUS.pending);
1391
1391
  const { dataTracked, ...oldAttrs } = (oldUpdate === null || oldUpdate === void 0 ? void 0 : oldUpdate.oldAttrs) || c.node.attrs;
1392
1392
  const newDataTracked = [...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id)];
1393
1393
  const newUpdate = oldUpdate
@@ -1636,7 +1636,7 @@ function trackTransaction(tr, oldState, newTr, authorID) {
1636
1636
  };
1637
1637
  // Must use constructor.name instead of instanceof as aliasing prosemirror-state is a lot more
1638
1638
  // difficult than prosemirror-transform
1639
- const wasNodeSelection = tr.selection.constructor.name === 'NodeSelection';
1639
+ const wasNodeSelection = tr.selection instanceof NodeSelection;
1640
1640
  let iters = 0;
1641
1641
  log.info('ORIGINAL transaction', tr);
1642
1642
  tr.steps.forEach((step) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/track-changes-plugin",
3
- "version": "0.4.5",
3
+ "version": "1.0.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",
@@ -24,7 +24,9 @@
24
24
  "access": "public"
25
25
  },
26
26
  "devDependencies": {
27
- "@manuscripts/manuscript-transform": "^0.54.0",
27
+ "@manuscripts/data": "^0.1.12",
28
+ "@manuscripts/json-schema": "^1.1.0",
29
+ "@manuscripts/transform": "^1.0.1",
28
30
  "@rollup/plugin-commonjs": "^22.0.2",
29
31
  "@types/debug": "^4.1.7",
30
32
  "@types/jest": "27.5.1",
@@ -32,15 +34,15 @@
32
34
  "jest": "27.5.1",
33
35
  "jest-environment-jsdom": "27.5.1",
34
36
  "jsdom": "^20.0.0",
35
- "prosemirror-commands": "^1.3.1",
37
+ "prosemirror-commands": "^1.5.0",
36
38
  "prosemirror-example-setup": "^1.2.1",
37
39
  "prosemirror-history": "^1.3.0",
38
40
  "prosemirror-keymap": "^1.2.0",
39
- "prosemirror-model": "^1.18.1",
41
+ "prosemirror-model": "^1.18.3",
40
42
  "prosemirror-schema-list": "^1.2.2",
41
- "prosemirror-state": "^1.4.1",
43
+ "prosemirror-state": "^1.4.2",
42
44
  "prosemirror-transform": "^1.7.0",
43
- "prosemirror-view": "^1.28.1",
45
+ "prosemirror-view": "^1.29.1",
44
46
  "rollup": "^2.79.0",
45
47
  "rollup-plugin-typescript2": "^0.34.0",
46
48
  "ts-jest": "27.1.4",