@manuscripts/track-changes-plugin 2.0.10 → 2.0.11

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.
@@ -12,6 +12,7 @@ var TrackChangesAction;
12
12
  TrackChangesAction["setChangeStatuses"] = "track-changes-set-change-statuses";
13
13
  TrackChangesAction["refreshChanges"] = "track-changes-refresh-changes";
14
14
  TrackChangesAction["updateMetaNode"] = "track-changes-update-meta-node";
15
+ TrackChangesAction["indentationAction"] = "track-changes-indentation-action";
15
16
  })(TrackChangesAction || (exports.TrackChangesAction = TrackChangesAction = {}));
16
17
  function hasAction(tr) {
17
18
  return Object.values(TrackChangesAction).some((action) => !!tr.getMeta(action));
@@ -82,7 +82,10 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema, delete
82
82
  }
83
83
  const nodeAtMappedPos = newTr.doc.nodeAt(mapping.map(c.pos));
84
84
  const nodeWasAlreadyDeleted = !nodeAtMappedPos || nodeAtMappedPos !== c.node;
85
- if ((isInserted && deletesCounter > 1) || (childOfDeleted && prevDeletedNodeInserted) || nodeWasAlreadyDeleted) {
85
+ const isMoveOperation = !!emptyAttrs.moveNodeId;
86
+ if ((isInserted && deletesCounter > 1 && !isMoveOperation) ||
87
+ (childOfDeleted && prevDeletedNodeInserted) ||
88
+ nodeWasAlreadyDeleted) {
86
89
  return false;
87
90
  }
88
91
  (0, deleteNode_1.deleteOrSetNodeDeleted)(c.node, mapping.map(c.pos), newTr, deleteAttrs);
@@ -10,6 +10,21 @@ const change_1 = require("../types/change");
10
10
  const logger_1 = require("../utils/logger");
11
11
  const revertChange_1 = require("./revertChange");
12
12
  const updateChangeAttrs_1 = require("./updateChangeAttrs");
13
+ function collectMoveNodeIds(containerNode, primaryMoveNodeId) {
14
+ const moveNodeIds = new Set();
15
+ moveNodeIds.add(primaryMoveNodeId);
16
+ containerNode.descendants((childNode) => {
17
+ const dataTracked = childNode.attrs.dataTracked;
18
+ if (Array.isArray(dataTracked)) {
19
+ dataTracked.forEach((trackingData) => {
20
+ if (trackingData.moveNodeId) {
21
+ moveNodeIds.add(trackingData.moveNodeId);
22
+ }
23
+ });
24
+ }
25
+ });
26
+ return moveNodeIds;
27
+ }
13
28
  function getUpdatedDataTracked(dataTracked, changeId) {
14
29
  if (!dataTracked) {
15
30
  return null;
@@ -29,6 +44,9 @@ function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, deleteMap
29
44
  if (change.dataTracked.operation === change_1.CHANGE_OPERATION.move) {
30
45
  return;
31
46
  }
47
+ if (change.dataTracked.operation === change_1.CHANGE_OPERATION.delete && change.dataTracked.moveNodeId) {
48
+ return;
49
+ }
32
50
  const { pos: from, deleted } = deleteMap.mapResult(change.from);
33
51
  const node = tr.doc.nodeAt(from);
34
52
  const noChangeNeeded = !ChangeSet_1.ChangeSet.shouldDeleteChange(change);
@@ -94,25 +112,49 @@ function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, deleteMap
94
112
  return;
95
113
  }
96
114
  if (change.dataTracked.status === change_1.CHANGE_STATUS.accepted) {
97
- const originalChange = changeSet.changes.find((c) => c.dataTracked.moveNodeId === change.dataTracked.moveNodeId &&
115
+ const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) });
116
+ tr.setNodeMarkup(from, undefined, attrs, node.marks);
117
+ const originalChanges = changeSet.changes.filter((c) => c.dataTracked.moveNodeId === change.dataTracked.moveNodeId &&
98
118
  c.dataTracked.operation === change_1.CHANGE_OPERATION.delete);
99
- if (originalChange) {
100
- const { pos: originalFrom } = deleteMap.mapResult(originalChange.from);
119
+ if (originalChanges.length === 0) {
120
+ logger_1.log.warn('No original change found for move operation', { change });
121
+ }
122
+ originalChanges.forEach((originalChange) => {
123
+ const { pos: originalFrom, deleted } = deleteMap.mapResult(originalChange.from);
124
+ if (deleted) {
125
+ return;
126
+ }
101
127
  const originalNode = tr.doc.nodeAt(originalFrom);
102
- const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) });
103
- tr.setNodeMarkup(from, undefined, attrs, node.marks);
104
128
  if (originalNode) {
105
129
  tr.delete(originalFrom, originalFrom + originalNode.nodeSize);
106
130
  deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
107
131
  }
108
- }
109
- else {
110
- logger_1.log.warn('No original change found for move operation', { change });
111
- }
132
+ });
112
133
  }
113
134
  else if (change.dataTracked.status === change_1.CHANGE_STATUS.rejected) {
135
+ const moveNodeIdsToRestore = collectMoveNodeIds(node, change.dataTracked.moveNodeId);
114
136
  tr.delete(from, from + node.nodeSize);
115
137
  deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
138
+ changeSet.changes
139
+ .filter((c) => c.dataTracked.operation === change_1.CHANGE_OPERATION.delete &&
140
+ c.dataTracked.moveNodeId &&
141
+ moveNodeIdsToRestore.has(c.dataTracked.moveNodeId) &&
142
+ ChangeSet_1.ChangeSet.isNodeChange(c))
143
+ .forEach((orig) => {
144
+ const { pos } = deleteMap.mapResult(orig.from);
145
+ const node = tr.doc.nodeAt(pos);
146
+ if (!node) {
147
+ return;
148
+ }
149
+ const dataTracked = node.attrs.dataTracked || [];
150
+ const hasMoved = dataTracked.some((d) => d.operation === change_1.CHANGE_OPERATION.move && d.status === change_1.CHANGE_STATUS.pending);
151
+ if (hasMoved) {
152
+ tr.delete(pos, pos + node.nodeSize);
153
+ deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
154
+ return;
155
+ }
156
+ (0, updateChangeAttrs_1.restoreNode)(tr, node, pos, schema);
157
+ });
116
158
  }
117
159
  });
118
160
  return deleteMap;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateChangeAttrs = updateChangeAttrs;
4
4
  exports.updateChangeChildrenAttributes = updateChangeChildrenAttributes;
5
+ exports.restoreNode = restoreNode;
5
6
  const ChangeSet_1 = require("../ChangeSet");
6
7
  const nodeHelpers_1 = require("../compute/nodeHelpers");
7
8
  const change_1 = require("../types/change");
@@ -83,3 +84,9 @@ function updateChangeChildrenAttributes(changes, tr, mapping) {
83
84
  }
84
85
  });
85
86
  }
87
+ function restoreNode(tr, node, pos, schema) {
88
+ const updatedAttrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: null });
89
+ tr.setNodeMarkup(pos, undefined, updatedAttrs, node.marks);
90
+ tr.removeMark(pos, pos + node.nodeSize, schema.marks.tracked_insert);
91
+ tr.removeMark(pos, pos + node.nodeSize, schema.marks.tracked_delete);
92
+ }
@@ -95,10 +95,10 @@ function setFragmentAsWrapChange(inserted, attrs, schema) {
95
95
  });
96
96
  return prosemirror_model_1.Fragment.from(content);
97
97
  }
98
- function setFragmentAsMoveChange(fragment, attrs) {
98
+ function setFragmentAsMoveChange(fragment, moveAttrs) {
99
99
  const content = [];
100
100
  fragment.forEach((node) => {
101
- content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [(0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewMoveAttrs(attrs))] }), node.content, node.marks));
101
+ content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [(0, nodeHelpers_1.addTrackIdIfDoesntExist)(moveAttrs)] }), node.content, node.marks));
102
102
  });
103
103
  return prosemirror_model_1.Fragment.from(content);
104
104
  }
package/dist/cjs/index.js CHANGED
@@ -36,12 +36,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ChangeSet = exports.enableDebug = exports.trackCommands = exports.skipTracking = exports.trackChangesPlugin = exports.trackChangesPluginKey = void 0;
39
+ exports.ChangeSet = exports.enableDebug = exports.trackCommands = exports.TrackChangesAction = exports.setAction = exports.skipTracking = exports.trackChangesPlugin = exports.trackChangesPluginKey = void 0;
40
40
  var plugin_1 = require("./plugin");
41
41
  Object.defineProperty(exports, "trackChangesPluginKey", { enumerable: true, get: function () { return plugin_1.trackChangesPluginKey; } });
42
42
  Object.defineProperty(exports, "trackChangesPlugin", { enumerable: true, get: function () { return plugin_1.trackChangesPlugin; } });
43
43
  var actions_1 = require("./actions");
44
44
  Object.defineProperty(exports, "skipTracking", { enumerable: true, get: function () { return actions_1.skipTracking; } });
45
+ Object.defineProperty(exports, "setAction", { enumerable: true, get: function () { return actions_1.setAction; } });
46
+ Object.defineProperty(exports, "TrackChangesAction", { enumerable: true, get: function () { return actions_1.TrackChangesAction; } });
45
47
  exports.trackCommands = __importStar(require("./commands"));
46
48
  var logger_1 = require("./utils/logger");
47
49
  Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return logger_1.enableDebug; } });
@@ -23,6 +23,7 @@ function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
23
23
  const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => (d.operation === change_1.CHANGE_OPERATION.insert || d.operation === change_1.CHANGE_OPERATION.wrap_with_node) &&
24
24
  (d.status === change_1.CHANGE_STATUS.pending || d.status === change_1.CHANGE_STATUS.accepted));
25
25
  const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.set_node_attributes || d.operation === change_1.CHANGE_OPERATION.reference);
26
+ const moved = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.move && d.status === change_1.CHANGE_STATUS.pending);
26
27
  if (inserted) {
27
28
  return deleteNode(node, pos, newTr);
28
29
  }
@@ -35,5 +36,5 @@ function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
35
36
  return;
36
37
  }
37
38
  const newDeleted = (0, nodeHelpers_1.addTrackIdIfDoesntExist)(deleteAttrs);
38
- newTr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: updated ? [newDeleted, updated] : [newDeleted] }), node.marks);
39
+ newTr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: updated ? [newDeleted, updated] : moved ? [newDeleted, moved] : [newDeleted] }), node.marks);
39
40
  }
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.trackReplaceStep = trackReplaceStep;
37
37
  const prosemirror_model_1 = require("prosemirror-model");
38
+ const actions_1 = require("../actions");
38
39
  const setFragmentAsInserted_1 = require("../compute/setFragmentAsInserted");
39
40
  const deleteAndMergeSplitNodes_1 = require("../mutate/deleteAndMergeSplitNodes");
40
41
  const logger_1 = require("../utils/logger");
@@ -50,7 +51,7 @@ function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResult, curr
50
51
  attrs.moveNodeId = moveID;
51
52
  }
52
53
  step.getMap().forEach((fromA, toA, fromB, toB) => {
53
- var _a, _b, _c;
54
+ var _a, _b, _c, _d;
54
55
  logger_1.log.info(`changed ranges: ${fromA} ${toA} ${fromB} ${toB}`);
55
56
  const { slice } = step;
56
57
  logger_1.log.info('TR: steps before applying delete', [...newTr.steps]);
@@ -81,12 +82,13 @@ function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResult, curr
81
82
  fragment = (0, setFragmentAsInserted_1.setFragmentAsNodeSplit)(newTr.doc.resolve(step.from), newTr, fragment, attrs);
82
83
  }
83
84
  if (moveID) {
84
- fragment = (0, setFragmentAsInserted_1.setFragmentAsMoveChange)(newSliceContent, trackUtils.createNewMoveAttrs(attrs));
85
+ const indentationType = (_a = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.indentationAction)) === null || _a === void 0 ? void 0 : _a.action;
86
+ fragment = (0, setFragmentAsInserted_1.setFragmentAsMoveChange)(newSliceContent, trackUtils.createNewMoveAttrs(attrs, indentationType));
85
87
  }
86
88
  const openStart = slice.openStart !== slice.openEnd ? 0 : slice.openStart;
87
89
  const openEnd = slice.openStart !== slice.openEnd ? 0 : slice.openEnd;
88
90
  const textWasDeleted = !!changeSteps.length && !(fromA === fromB);
89
- const isBlock = !!((_a = fragment.firstChild) === null || _a === void 0 ? void 0 : _a.isBlock);
91
+ const isBlock = !!((_b = fragment.firstChild) === null || _b === void 0 ? void 0 : _b.isBlock);
90
92
  changeSteps.push({
91
93
  type: 'insert-slice',
92
94
  from: textWasDeleted ? fromB : isBlock ? toA : fromA,
@@ -96,8 +98,8 @@ function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResult, curr
96
98
  });
97
99
  }
98
100
  else {
99
- const isDeleteEvent = ((_b = window.event) === null || _b === void 0 ? void 0 : _b.code) === 'Delete';
100
- const isDeleteContentForward = ((_c = window.event) === null || _c === void 0 ? void 0 : _c.inputType) === 'deleteContentForward';
101
+ const isDeleteEvent = ((_c = window.event) === null || _c === void 0 ? void 0 : _c.code) === 'Delete';
102
+ const isDeleteContentForward = ((_d = window.event) === null || _d === void 0 ? void 0 : _d.inputType) === 'deleteContentForward';
101
103
  selectionPos = isDeleteEvent || isDeleteContentForward ? toA : fromA;
102
104
  }
103
105
  });
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.trackTransaction = trackTransaction;
7
7
  const prosemirror_state_1 = require("prosemirror-state");
8
8
  const prosemirror_transform_1 = require("prosemirror-transform");
9
+ const actions_1 = require("../actions");
9
10
  const diffChangeSteps_1 = require("../change-steps/diffChangeSteps");
10
11
  const processChangeSteps_1 = require("../change-steps/processChangeSteps");
11
12
  const updateChangeAttrs_1 = require("../changes/updateChangeAttrs");
@@ -21,7 +22,7 @@ const trackReplaceStep_1 = require("./trackReplaceStep");
21
22
  const getSelectionStaticConstructor = (sel) => Object.getPrototypeOf(sel).constructor;
22
23
  const isHighlightMarkerNode = (node) => node && node.type === node.type.schema.nodes.highlight_marker;
23
24
  function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
24
- var _a, _b, _c, _d, _e;
25
+ var _a, _b, _c, _d, _e, _f;
25
26
  const emptyAttrs = {
26
27
  authorID,
27
28
  reviewedByID: null,
@@ -30,13 +31,23 @@ function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
30
31
  statusUpdateAt: 0,
31
32
  status: change_1.CHANGE_STATUS.pending,
32
33
  };
34
+ const action = (_a = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.indentationAction)) === null || _a === void 0 ? void 0 : _a.action;
35
+ const isIndentation = action === 'indent' || action === 'unindent';
33
36
  const wasNodeSelection = tr.selection instanceof prosemirror_state_1.NodeSelection;
34
37
  const setsNewSelection = tr.selectionSet;
35
38
  const deletedNodeMapping = new prosemirror_transform_1.Mapping();
36
39
  let iters = 0;
37
40
  logger_1.log.info('ORIGINAL transaction', tr);
38
41
  let trContext = {};
39
- const movingStepsAssociated = (0, track_utils_1.HasMoveOperations)(tr);
42
+ let movingStepsAssociated = (0, track_utils_1.HasMoveOperations)(tr);
43
+ if (isIndentation) {
44
+ const moveId = (0, uuidv4_1.uuidv4)();
45
+ tr.steps.forEach((step) => {
46
+ if (step instanceof prosemirror_transform_1.ReplaceStep) {
47
+ movingStepsAssociated.set(step, moveId);
48
+ }
49
+ });
50
+ }
40
51
  (0, track_utils_1.handleDirectPendingMoveDeletions)(tr, newTr, movingStepsAssociated);
41
52
  const cleanSteps = (0, track_utils_1.filterMeaninglessMoveSteps)(tr, movingStepsAssociated);
42
53
  for (let i = cleanSteps.length - 1; i >= 0; i--) {
@@ -57,7 +68,7 @@ function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
57
68
  }
58
69
  else if (step instanceof prosemirror_transform_1.ReplaceStep) {
59
70
  const { slice } = step;
60
- if (((_b = (_a = slice === null || slice === void 0 ? void 0 : slice.content) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.length) === 1 && isHighlightMarkerNode(slice.content.content[0])) {
71
+ if (((_c = (_b = slice === null || slice === void 0 ? void 0 : slice.content) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.length) === 1 && isHighlightMarkerNode(slice.content.content[0])) {
61
72
  continue;
62
73
  }
63
74
  const invertedStep = step.invert(tr.docs[i]);
@@ -71,7 +82,7 @@ function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
71
82
  let [steps, startPos] = (0, trackReplaceStep_1.trackReplaceStep)(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i], tr, movingStepsAssociated.get(step));
72
83
  if (steps.length === 1) {
73
84
  const step = steps[0];
74
- if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_d = (_c = step === null || step === void 0 ? void 0 : step.slice) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.content[0]))) {
85
+ if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_e = (_d = step === null || step === void 0 ? void 0 : step.slice) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.content[0]))) {
75
86
  continue;
76
87
  }
77
88
  }
@@ -104,7 +115,7 @@ function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
104
115
  const [mapping, selectionPos] = (0, processChangeSteps_1.processChangeSteps)(changeSteps, tr.selection.from, newTr, emptyAttrs, oldState.schema, deletedNodeMapping);
105
116
  }
106
117
  else if (step instanceof prosemirror_transform_1.AddMarkStep) {
107
- const dataTracked = (_e = (0, nodeHelpers_1.getNodeTrackedData)(newTr.doc.nodeAt(step.from), oldState.schema)) === null || _e === void 0 ? void 0 : _e.pop();
118
+ const dataTracked = (_f = (0, nodeHelpers_1.getNodeTrackedData)(newTr.doc.nodeAt(step.from), oldState.schema)) === null || _f === void 0 ? void 0 : _f.pop();
108
119
  if (dataTracked) {
109
120
  (0, updateChangeAttrs_1.updateChangeAttrs)(newTr, { id: dataTracked.id, from: step.from, to: step.to, type: 'text-change', dataTracked }, Object.assign(Object.assign({}, dataTracked), { id: (0, uuidv4_1.uuidv4)() }), oldState.schema);
110
121
  }
@@ -38,8 +38,8 @@ function createNewReferenceAttrs(attrs, id) {
38
38
  function createNewDeleteAttrs(attrs) {
39
39
  return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.delete });
40
40
  }
41
- function createNewMoveAttrs(attrs) {
42
- return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.move });
41
+ function createNewMoveAttrs(attrs, indentationType) {
42
+ return Object.assign(Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.move }), (indentationType && { indentationType }));
43
43
  }
44
44
  function createNewUpdateAttrs(attrs, oldAttrs) {
45
45
  const { dataTracked } = oldAttrs, restAttrs = __rest(oldAttrs, ["dataTracked"]);
@@ -6,6 +6,7 @@ export var TrackChangesAction;
6
6
  TrackChangesAction["setChangeStatuses"] = "track-changes-set-change-statuses";
7
7
  TrackChangesAction["refreshChanges"] = "track-changes-refresh-changes";
8
8
  TrackChangesAction["updateMetaNode"] = "track-changes-update-meta-node";
9
+ TrackChangesAction["indentationAction"] = "track-changes-indentation-action";
9
10
  })(TrackChangesAction || (TrackChangesAction = {}));
10
11
  export function hasAction(tr) {
11
12
  return Object.values(TrackChangesAction).some((action) => !!tr.getMeta(action));
@@ -46,7 +46,10 @@ export function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema,
46
46
  }
47
47
  const nodeAtMappedPos = newTr.doc.nodeAt(mapping.map(c.pos));
48
48
  const nodeWasAlreadyDeleted = !nodeAtMappedPos || nodeAtMappedPos !== c.node;
49
- if ((isInserted && deletesCounter > 1) || (childOfDeleted && prevDeletedNodeInserted) || nodeWasAlreadyDeleted) {
49
+ const isMoveOperation = !!emptyAttrs.moveNodeId;
50
+ if ((isInserted && deletesCounter > 1 && !isMoveOperation) ||
51
+ (childOfDeleted && prevDeletedNodeInserted) ||
52
+ nodeWasAlreadyDeleted) {
50
53
  return false;
51
54
  }
52
55
  deleteOrSetNodeDeleted(c.node, mapping.map(c.pos), newTr, deleteAttrs);
@@ -5,7 +5,22 @@ import { mergeNode } from '../mutate/mergeNode';
5
5
  import { CHANGE_OPERATION, CHANGE_STATUS } from '../types/change';
6
6
  import { log } from '../utils/logger';
7
7
  import { revertSplitNodeChange, revertWrapNodeChange } from './revertChange';
8
- import { updateChangeChildrenAttributes } from './updateChangeAttrs';
8
+ import { restoreNode, updateChangeChildrenAttributes } from './updateChangeAttrs';
9
+ function collectMoveNodeIds(containerNode, primaryMoveNodeId) {
10
+ const moveNodeIds = new Set();
11
+ moveNodeIds.add(primaryMoveNodeId);
12
+ containerNode.descendants((childNode) => {
13
+ const dataTracked = childNode.attrs.dataTracked;
14
+ if (Array.isArray(dataTracked)) {
15
+ dataTracked.forEach((trackingData) => {
16
+ if (trackingData.moveNodeId) {
17
+ moveNodeIds.add(trackingData.moveNodeId);
18
+ }
19
+ });
20
+ }
21
+ });
22
+ return moveNodeIds;
23
+ }
9
24
  export function getUpdatedDataTracked(dataTracked, changeId) {
10
25
  if (!dataTracked) {
11
26
  return null;
@@ -25,6 +40,9 @@ export function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, del
25
40
  if (change.dataTracked.operation === CHANGE_OPERATION.move) {
26
41
  return;
27
42
  }
43
+ if (change.dataTracked.operation === CHANGE_OPERATION.delete && change.dataTracked.moveNodeId) {
44
+ return;
45
+ }
28
46
  const { pos: from, deleted } = deleteMap.mapResult(change.from);
29
47
  const node = tr.doc.nodeAt(from);
30
48
  const noChangeNeeded = !ChangeSet.shouldDeleteChange(change);
@@ -90,25 +108,49 @@ export function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, del
90
108
  return;
91
109
  }
92
110
  if (change.dataTracked.status === CHANGE_STATUS.accepted) {
93
- const originalChange = changeSet.changes.find((c) => c.dataTracked.moveNodeId === change.dataTracked.moveNodeId &&
111
+ const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) });
112
+ tr.setNodeMarkup(from, undefined, attrs, node.marks);
113
+ const originalChanges = changeSet.changes.filter((c) => c.dataTracked.moveNodeId === change.dataTracked.moveNodeId &&
94
114
  c.dataTracked.operation === CHANGE_OPERATION.delete);
95
- if (originalChange) {
96
- const { pos: originalFrom } = deleteMap.mapResult(originalChange.from);
115
+ if (originalChanges.length === 0) {
116
+ log.warn('No original change found for move operation', { change });
117
+ }
118
+ originalChanges.forEach((originalChange) => {
119
+ const { pos: originalFrom, deleted } = deleteMap.mapResult(originalChange.from);
120
+ if (deleted) {
121
+ return;
122
+ }
97
123
  const originalNode = tr.doc.nodeAt(originalFrom);
98
- const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) });
99
- tr.setNodeMarkup(from, undefined, attrs, node.marks);
100
124
  if (originalNode) {
101
125
  tr.delete(originalFrom, originalFrom + originalNode.nodeSize);
102
126
  deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
103
127
  }
104
- }
105
- else {
106
- log.warn('No original change found for move operation', { change });
107
- }
128
+ });
108
129
  }
109
130
  else if (change.dataTracked.status === CHANGE_STATUS.rejected) {
131
+ const moveNodeIdsToRestore = collectMoveNodeIds(node, change.dataTracked.moveNodeId);
110
132
  tr.delete(from, from + node.nodeSize);
111
133
  deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
134
+ changeSet.changes
135
+ .filter((c) => c.dataTracked.operation === CHANGE_OPERATION.delete &&
136
+ c.dataTracked.moveNodeId &&
137
+ moveNodeIdsToRestore.has(c.dataTracked.moveNodeId) &&
138
+ ChangeSet.isNodeChange(c))
139
+ .forEach((orig) => {
140
+ const { pos } = deleteMap.mapResult(orig.from);
141
+ const node = tr.doc.nodeAt(pos);
142
+ if (!node) {
143
+ return;
144
+ }
145
+ const dataTracked = node.attrs.dataTracked || [];
146
+ const hasMoved = dataTracked.some((d) => d.operation === CHANGE_OPERATION.move && d.status === CHANGE_STATUS.pending);
147
+ if (hasMoved) {
148
+ tr.delete(pos, pos + node.nodeSize);
149
+ deleteMap.appendMap(tr.steps[tr.steps.length - 1].getMap());
150
+ return;
151
+ }
152
+ restoreNode(tr, node, pos, schema);
153
+ });
112
154
  }
113
155
  });
114
156
  return deleteMap;
@@ -79,3 +79,9 @@ export function updateChangeChildrenAttributes(changes, tr, mapping) {
79
79
  }
80
80
  });
81
81
  }
82
+ export function restoreNode(tr, node, pos, schema) {
83
+ const updatedAttrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: null });
84
+ tr.setNodeMarkup(pos, undefined, updatedAttrs, node.marks);
85
+ tr.removeMark(pos, pos + node.nodeSize, schema.marks.tracked_insert);
86
+ tr.removeMark(pos, pos + node.nodeSize, schema.marks.tracked_delete);
87
+ }
@@ -56,10 +56,10 @@ export function setFragmentAsWrapChange(inserted, attrs, schema) {
56
56
  });
57
57
  return Fragment.from(content);
58
58
  }
59
- export function setFragmentAsMoveChange(fragment, attrs) {
59
+ export function setFragmentAsMoveChange(fragment, moveAttrs) {
60
60
  const content = [];
61
61
  fragment.forEach((node) => {
62
- content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [addTrackIdIfDoesntExist(trackUtils.createNewMoveAttrs(attrs))] }), node.content, node.marks));
62
+ content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [addTrackIdIfDoesntExist(moveAttrs)] }), node.content, node.marks));
63
63
  });
64
64
  return Fragment.from(content);
65
65
  }
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { trackChangesPluginKey, trackChangesPlugin } from './plugin';
2
- export { skipTracking } from './actions';
2
+ export { skipTracking, setAction, TrackChangesAction } from './actions';
3
3
  export * as trackCommands from './commands';
4
4
  export { enableDebug } from './utils/logger';
5
5
  export { ChangeSet } from './ChangeSet';
@@ -19,6 +19,7 @@ export function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
19
19
  const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => (d.operation === CHANGE_OPERATION.insert || d.operation === CHANGE_OPERATION.wrap_with_node) &&
20
20
  (d.status === CHANGE_STATUS.pending || d.status === CHANGE_STATUS.accepted));
21
21
  const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === CHANGE_OPERATION.set_node_attributes || d.operation === CHANGE_OPERATION.reference);
22
+ const moved = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === CHANGE_OPERATION.move && d.status === CHANGE_STATUS.pending);
22
23
  if (inserted) {
23
24
  return deleteNode(node, pos, newTr);
24
25
  }
@@ -31,5 +32,5 @@ export function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
31
32
  return;
32
33
  }
33
34
  const newDeleted = addTrackIdIfDoesntExist(deleteAttrs);
34
- newTr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: updated ? [newDeleted, updated] : [newDeleted] }), node.marks);
35
+ newTr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: updated ? [newDeleted, updated] : moved ? [newDeleted, moved] : [newDeleted] }), node.marks);
35
36
  }
@@ -1,4 +1,5 @@
1
1
  import { Slice } from 'prosemirror-model';
2
+ import { getAction, TrackChangesAction } from '../actions';
2
3
  import { setFragmentAsInserted, setFragmentAsMoveChange, setFragmentAsNodeSplit, } from '../compute/setFragmentAsInserted';
3
4
  import { deleteAndMergeSplitNodes } from '../mutate/deleteAndMergeSplitNodes';
4
5
  import { log } from '../utils/logger';
@@ -14,7 +15,7 @@ export function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResul
14
15
  attrs.moveNodeId = moveID;
15
16
  }
16
17
  step.getMap().forEach((fromA, toA, fromB, toB) => {
17
- var _a, _b, _c;
18
+ var _a, _b, _c, _d;
18
19
  log.info(`changed ranges: ${fromA} ${toA} ${fromB} ${toB}`);
19
20
  const { slice } = step;
20
21
  log.info('TR: steps before applying delete', [...newTr.steps]);
@@ -45,12 +46,13 @@ export function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResul
45
46
  fragment = setFragmentAsNodeSplit(newTr.doc.resolve(step.from), newTr, fragment, attrs);
46
47
  }
47
48
  if (moveID) {
48
- fragment = setFragmentAsMoveChange(newSliceContent, trackUtils.createNewMoveAttrs(attrs));
49
+ const indentationType = (_a = getAction(tr, TrackChangesAction.indentationAction)) === null || _a === void 0 ? void 0 : _a.action;
50
+ fragment = setFragmentAsMoveChange(newSliceContent, trackUtils.createNewMoveAttrs(attrs, indentationType));
49
51
  }
50
52
  const openStart = slice.openStart !== slice.openEnd ? 0 : slice.openStart;
51
53
  const openEnd = slice.openStart !== slice.openEnd ? 0 : slice.openEnd;
52
54
  const textWasDeleted = !!changeSteps.length && !(fromA === fromB);
53
- const isBlock = !!((_a = fragment.firstChild) === null || _a === void 0 ? void 0 : _a.isBlock);
55
+ const isBlock = !!((_b = fragment.firstChild) === null || _b === void 0 ? void 0 : _b.isBlock);
54
56
  changeSteps.push({
55
57
  type: 'insert-slice',
56
58
  from: textWasDeleted ? fromB : isBlock ? toA : fromA,
@@ -60,8 +62,8 @@ export function trackReplaceStep(step, oldState, newTr, attrsTemplate, stepResul
60
62
  });
61
63
  }
62
64
  else {
63
- const isDeleteEvent = ((_b = window.event) === null || _b === void 0 ? void 0 : _b.code) === 'Delete';
64
- const isDeleteContentForward = ((_c = window.event) === null || _c === void 0 ? void 0 : _c.inputType) === 'deleteContentForward';
65
+ const isDeleteEvent = ((_c = window.event) === null || _c === void 0 ? void 0 : _c.code) === 'Delete';
66
+ const isDeleteContentForward = ((_d = window.event) === null || _d === void 0 ? void 0 : _d.inputType) === 'deleteContentForward';
65
67
  selectionPos = isDeleteEvent || isDeleteContentForward ? toA : fromA;
66
68
  }
67
69
  });
@@ -1,5 +1,6 @@
1
1
  import { NodeSelection as NodeSelectionClass, TextSelection, } from 'prosemirror-state';
2
2
  import { AddMarkStep, AttrStep, Mapping, ReplaceAroundStep, ReplaceStep, } from 'prosemirror-transform';
3
+ import { getAction, TrackChangesAction } from '../actions';
3
4
  import { diffChangeSteps } from '../change-steps/diffChangeSteps';
4
5
  import { processChangeSteps } from '../change-steps/processChangeSteps';
5
6
  import { updateChangeAttrs } from '../changes/updateChangeAttrs';
@@ -15,7 +16,7 @@ import { trackReplaceStep } from './trackReplaceStep';
15
16
  const getSelectionStaticConstructor = (sel) => Object.getPrototypeOf(sel).constructor;
16
17
  const isHighlightMarkerNode = (node) => node && node.type === node.type.schema.nodes.highlight_marker;
17
18
  export function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
18
- var _a, _b, _c, _d, _e;
19
+ var _a, _b, _c, _d, _e, _f;
19
20
  const emptyAttrs = {
20
21
  authorID,
21
22
  reviewedByID: null,
@@ -24,13 +25,23 @@ export function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
24
25
  statusUpdateAt: 0,
25
26
  status: CHANGE_STATUS.pending,
26
27
  };
28
+ const action = (_a = getAction(tr, TrackChangesAction.indentationAction)) === null || _a === void 0 ? void 0 : _a.action;
29
+ const isIndentation = action === 'indent' || action === 'unindent';
27
30
  const wasNodeSelection = tr.selection instanceof NodeSelectionClass;
28
31
  const setsNewSelection = tr.selectionSet;
29
32
  const deletedNodeMapping = new Mapping();
30
33
  let iters = 0;
31
34
  log.info('ORIGINAL transaction', tr);
32
35
  let trContext = {};
33
- const movingStepsAssociated = HasMoveOperations(tr);
36
+ let movingStepsAssociated = HasMoveOperations(tr);
37
+ if (isIndentation) {
38
+ const moveId = uuidv4();
39
+ tr.steps.forEach((step) => {
40
+ if (step instanceof ReplaceStep) {
41
+ movingStepsAssociated.set(step, moveId);
42
+ }
43
+ });
44
+ }
34
45
  handleDirectPendingMoveDeletions(tr, newTr, movingStepsAssociated);
35
46
  const cleanSteps = filterMeaninglessMoveSteps(tr, movingStepsAssociated);
36
47
  for (let i = cleanSteps.length - 1; i >= 0; i--) {
@@ -51,7 +62,7 @@ export function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
51
62
  }
52
63
  else if (step instanceof ReplaceStep) {
53
64
  const { slice } = step;
54
- if (((_b = (_a = slice === null || slice === void 0 ? void 0 : slice.content) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.length) === 1 && isHighlightMarkerNode(slice.content.content[0])) {
65
+ if (((_c = (_b = slice === null || slice === void 0 ? void 0 : slice.content) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.length) === 1 && isHighlightMarkerNode(slice.content.content[0])) {
55
66
  continue;
56
67
  }
57
68
  const invertedStep = step.invert(tr.docs[i]);
@@ -65,7 +76,7 @@ export function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
65
76
  let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i], tr, movingStepsAssociated.get(step));
66
77
  if (steps.length === 1) {
67
78
  const step = steps[0];
68
- if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_d = (_c = step === null || step === void 0 ? void 0 : step.slice) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.content[0]))) {
79
+ if (isHighlightMarkerNode((step === null || step === void 0 ? void 0 : step.node) || ((_e = (_d = step === null || step === void 0 ? void 0 : step.slice) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.content[0]))) {
69
80
  continue;
70
81
  }
71
82
  }
@@ -98,7 +109,7 @@ export function trackTransaction(tr, oldState, newTr, authorID, changeSet) {
98
109
  const [mapping, selectionPos] = processChangeSteps(changeSteps, tr.selection.from, newTr, emptyAttrs, oldState.schema, deletedNodeMapping);
99
110
  }
100
111
  else if (step instanceof AddMarkStep) {
101
- const dataTracked = (_e = getNodeTrackedData(newTr.doc.nodeAt(step.from), oldState.schema)) === null || _e === void 0 ? void 0 : _e.pop();
112
+ const dataTracked = (_f = getNodeTrackedData(newTr.doc.nodeAt(step.from), oldState.schema)) === null || _f === void 0 ? void 0 : _f.pop();
102
113
  if (dataTracked) {
103
114
  updateChangeAttrs(newTr, { id: dataTracked.id, from: step.from, to: step.to, type: 'text-change', dataTracked }, Object.assign(Object.assign({}, dataTracked), { id: uuidv4() }), oldState.schema);
104
115
  }
@@ -27,8 +27,8 @@ export function createNewReferenceAttrs(attrs, id) {
27
27
  export function createNewDeleteAttrs(attrs) {
28
28
  return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.delete });
29
29
  }
30
- export function createNewMoveAttrs(attrs) {
31
- return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.move });
30
+ export function createNewMoveAttrs(attrs, indentationType) {
31
+ return Object.assign(Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.move }), (indentationType && { indentationType }));
32
32
  }
33
33
  export function createNewUpdateAttrs(attrs, oldAttrs) {
34
34
  const { dataTracked } = oldAttrs, restAttrs = __rest(oldAttrs, ["dataTracked"]);
@@ -7,7 +7,8 @@ export declare enum TrackChangesAction {
7
7
  setPluginStatus = "track-changes-set-track-status",
8
8
  setChangeStatuses = "track-changes-set-change-statuses",
9
9
  refreshChanges = "track-changes-refresh-changes",
10
- updateMetaNode = "track-changes-update-meta-node"
10
+ updateMetaNode = "track-changes-update-meta-node",
11
+ indentationAction = "track-changes-indentation-action"
11
12
  }
12
13
  export type TrackChangesActionParams = {
13
14
  [TrackChangesAction.skipTrack]: boolean;
@@ -19,6 +20,9 @@ export type TrackChangesActionParams = {
19
20
  };
20
21
  [TrackChangesAction.refreshChanges]: boolean;
21
22
  [TrackChangesAction.updateMetaNode]: boolean;
23
+ [TrackChangesAction.indentationAction]: {
24
+ action: 'indent' | 'unindent';
25
+ };
22
26
  };
23
27
  export declare function hasAction(tr: Transaction): boolean;
24
28
  export declare function getAction<K extends keyof TrackChangesActionParams>(tr: Transaction, action: K): TrackChangesActionParams[K] | undefined;
@@ -4,3 +4,4 @@ import { Mapping } from 'prosemirror-transform';
4
4
  import { IncompleteChange, TrackedAttrs, TrackedChange } from '../types/change';
5
5
  export declare function updateChangeAttrs(tr: Transaction, change: IncompleteChange, trackedAttrs: Partial<TrackedAttrs>, schema: Schema): Transaction;
6
6
  export declare function updateChangeChildrenAttributes(changes: TrackedChange[], tr: Transaction, mapping: Mapping): void;
7
+ export declare function restoreNode(tr: Transaction, node: any, pos: number, schema: Schema): void;
@@ -1,7 +1,7 @@
1
1
  import { Fragment, ResolvedPos, Schema } from 'prosemirror-model';
2
2
  import { Transaction } from 'prosemirror-state';
3
- import { NewEmptyAttrs, NewInsertAttrs } from '../types/track';
3
+ import { NewEmptyAttrs, NewInsertAttrs, NewMoveAttrs } from '../types/track';
4
4
  export declare function setFragmentAsInserted(inserted: Fragment, insertAttrs: NewInsertAttrs, schema: Schema): Fragment;
5
5
  export declare function setFragmentAsWrapChange(inserted: Fragment, attrs: NewEmptyAttrs, schema: Schema): Fragment;
6
- export declare function setFragmentAsMoveChange(fragment: Fragment, attrs: NewEmptyAttrs): Fragment;
6
+ export declare function setFragmentAsMoveChange(fragment: Fragment, moveAttrs: NewMoveAttrs): Fragment;
7
7
  export declare function setFragmentAsNodeSplit($pos: ResolvedPos, newTr: Transaction, inserted: Fragment, attrs: NewEmptyAttrs): Fragment;
@@ -1,5 +1,5 @@
1
1
  export { trackChangesPluginKey, trackChangesPlugin } from './plugin';
2
- export { skipTracking } from './actions';
2
+ export { skipTracking, setAction, TrackChangesAction } from './actions';
3
3
  export * as trackCommands from './commands';
4
4
  export { enableDebug } from './utils/logger';
5
5
  export { ChangeSet } from './ChangeSet';
@@ -55,6 +55,7 @@ export type ReferenceAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
55
55
  };
56
56
  export type NodeMoveAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
57
57
  operation: CHANGE_OPERATION.move;
58
+ indentationType?: 'indent' | 'unindent';
58
59
  };
59
60
  export type TrackedAttrs = InsertDeleteAttrs | UpdateAttrs | WrapAttrs | NodeSplitAttrs | ReferenceAttrs | NodeMoveAttrs;
60
61
  type Change = {
@@ -16,7 +16,7 @@ export interface TrackChangesState {
16
16
  }
17
17
  export type NewEmptyAttrs = Omit<TrackedAttrs, 'id' | 'operation'>;
18
18
  export type NewInsertAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
19
- operation: CHANGE_OPERATION.insert | CHANGE_OPERATION.wrap_with_node | CHANGE_OPERATION.move;
19
+ operation: CHANGE_OPERATION.insert | CHANGE_OPERATION.wrap_with_node;
20
20
  };
21
21
  export type NewDeleteAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
22
22
  operation: CHANGE_OPERATION.delete;
@@ -28,11 +28,15 @@ export type NewUpdateAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
28
28
  export type NewSplitNodeAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
29
29
  operation: CHANGE_OPERATION.node_split;
30
30
  };
31
+ export type NewMoveAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
32
+ operation: CHANGE_OPERATION.move;
33
+ indentationType?: 'indent' | 'unindent';
34
+ };
31
35
  export type NewReferenceAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
32
36
  operation: CHANGE_OPERATION.reference;
33
37
  referenceId: string;
34
38
  };
35
- export type NewTrackedAttrs = NewInsertAttrs | NewDeleteAttrs | NewUpdateAttrs;
39
+ export type NewTrackedAttrs = NewInsertAttrs | NewDeleteAttrs | NewUpdateAttrs | NewMoveAttrs;
36
40
  export declare enum TrackChangesStatus {
37
41
  enabled = "enabled",
38
42
  viewSnapshots = "view-snapshots",
@@ -2,13 +2,13 @@ import { Node as PMNode, Slice } from 'prosemirror-model';
2
2
  import { Selection, Transaction } from 'prosemirror-state';
3
3
  import { ReplaceAroundStep, ReplaceStep, Step } from 'prosemirror-transform';
4
4
  import { CHANGE_OPERATION, TrackedAttrs } from '../types/change';
5
- import { NewDeleteAttrs, NewEmptyAttrs, NewInsertAttrs, NewReferenceAttrs, NewSplitNodeAttrs, NewUpdateAttrs } from '../types/track';
5
+ import { NewDeleteAttrs, NewEmptyAttrs, NewInsertAttrs, NewMoveAttrs, NewReferenceAttrs, NewSplitNodeAttrs, NewUpdateAttrs } from '../types/track';
6
6
  export declare function createNewInsertAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
7
7
  export declare function createNewWrapAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
8
8
  export declare function createNewSplitAttrs(attrs: NewEmptyAttrs): NewSplitNodeAttrs;
9
9
  export declare function createNewReferenceAttrs(attrs: NewEmptyAttrs, id: string): NewReferenceAttrs;
10
10
  export declare function createNewDeleteAttrs(attrs: NewEmptyAttrs): NewDeleteAttrs;
11
- export declare function createNewMoveAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
11
+ export declare function createNewMoveAttrs(attrs: NewEmptyAttrs, indentationType?: 'indent' | 'unindent'): NewMoveAttrs;
12
12
  export declare function createNewUpdateAttrs(attrs: NewEmptyAttrs, oldAttrs: Record<string, any>): NewUpdateAttrs;
13
13
  export declare const isSplitStep: (step: ReplaceStep, selection: Selection, uiEvent: string) => boolean;
14
14
  export declare const isWrapStep: (step: ReplaceAroundStep) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manuscripts/track-changes-plugin",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "author": "Atypon Systems LLC",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",