@manuscripts/track-changes-plugin 1.7.23 → 1.7.24-LEAN-3967.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/README.md +0 -5
- package/dist/cjs/ChangeSet.js +0 -6
- package/dist/cjs/actions.js +0 -1
- package/dist/cjs/change-steps/processChangeSteps.js +5 -10
- package/dist/cjs/changes/applyChanges.js +14 -34
- package/dist/cjs/changes/findChanges.js +6 -6
- package/dist/cjs/changes/revertChange.js +11 -22
- package/dist/cjs/changes/updateChangeAttrs.js +25 -4
- package/dist/cjs/changes/updateChangesStatus.js +60 -0
- package/dist/cjs/commands.js +1 -6
- package/dist/cjs/compute/nodeHelpers.js +1 -1
- package/dist/cjs/compute/setFragmentAsInserted.js +1 -1
- package/dist/cjs/plugin.js +9 -19
- package/dist/es/ChangeSet.js +0 -6
- package/dist/es/actions.js +0 -1
- package/dist/es/change-steps/processChangeSteps.js +5 -10
- package/dist/es/changes/applyChanges.js +15 -35
- package/dist/es/changes/findChanges.js +6 -6
- package/dist/es/changes/revertChange.js +10 -22
- package/dist/es/changes/updateChangeAttrs.js +26 -5
- package/dist/es/changes/updateChangesStatus.js +56 -0
- package/dist/es/commands.js +0 -4
- package/dist/es/compute/nodeHelpers.js +1 -1
- package/dist/es/compute/setFragmentAsInserted.js +1 -1
- package/dist/es/plugin.js +9 -19
- package/dist/types/ChangeSet.d.ts +0 -2
- package/dist/types/actions.d.ts +0 -2
- package/dist/types/changes/applyChanges.d.ts +2 -1
- package/dist/types/changes/revertChange.d.ts +3 -3
- package/dist/types/changes/updateChangesStatus.d.ts +19 -0
- package/dist/types/commands.d.ts +0 -1
- package/package.json +2 -2
- package/src/styles.css +0 -12
package/README.md
CHANGED
|
@@ -118,11 +118,6 @@ export const setChangeStatuses = (status: CHANGE_STATUS, ids: string[]) => Comma
|
|
|
118
118
|
*/
|
|
119
119
|
export const setUserID = (userID: string) => Command
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* Appends a transaction that applies all 'accepted' and 'rejected' changes to the document.
|
|
123
|
-
*/
|
|
124
|
-
export const applyAndRemoveChanges = () => Command
|
|
125
|
-
|
|
126
121
|
/**
|
|
127
122
|
* Runs `findChanges` to iterate over the document to collect changes into a new ChangeSet.
|
|
128
123
|
*/
|
package/dist/cjs/ChangeSet.js
CHANGED
|
@@ -79,12 +79,6 @@ class ChangeSet {
|
|
|
79
79
|
get pending() {
|
|
80
80
|
return this.changeTree.filter((c) => c.dataTracked.status === change_1.CHANGE_STATUS.pending);
|
|
81
81
|
}
|
|
82
|
-
get accepted() {
|
|
83
|
-
return this.changeTree.filter((c) => c.dataTracked.status === change_1.CHANGE_STATUS.accepted);
|
|
84
|
-
}
|
|
85
|
-
get rejected() {
|
|
86
|
-
return this.changeTree.filter((c) => c.dataTracked.status === change_1.CHANGE_STATUS.rejected);
|
|
87
|
-
}
|
|
88
82
|
get textChanges() {
|
|
89
83
|
return this.changes.filter((c) => c.type === 'text-change');
|
|
90
84
|
}
|
package/dist/cjs/actions.js
CHANGED
|
@@ -8,7 +8,6 @@ var TrackChangesAction;
|
|
|
8
8
|
TrackChangesAction["setPluginStatus"] = "track-changes-set-track-status";
|
|
9
9
|
TrackChangesAction["setChangeStatuses"] = "track-changes-set-change-statuses";
|
|
10
10
|
TrackChangesAction["refreshChanges"] = "track-changes-refresh-changes";
|
|
11
|
-
TrackChangesAction["applyAndRemoveChanges"] = "track-changes-apply-remove-changes";
|
|
12
11
|
TrackChangesAction["updateMetaNode"] = "track-changes-update-meta-node";
|
|
13
12
|
})(TrackChangesAction = exports.TrackChangesAction || (exports.TrackChangesAction = {}));
|
|
14
13
|
function hasAction(tr) {
|
|
@@ -111,21 +111,16 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema) {
|
|
|
111
111
|
case 'update-node-attrs':
|
|
112
112
|
const oldDataTracked = (0, nodeHelpers_1.getBlockInlineTrackedData)(c.node) || [];
|
|
113
113
|
const oldUpdate = oldDataTracked.reverse().find((d) => {
|
|
114
|
-
if (d.operation === change_1.CHANGE_OPERATION.set_node_attributes &&
|
|
115
|
-
(d.status === change_1.CHANGE_STATUS.pending || d.status === change_1.CHANGE_STATUS.rejected)) {
|
|
114
|
+
if (d.operation === change_1.CHANGE_OPERATION.set_node_attributes && d.status === change_1.CHANGE_STATUS.pending) {
|
|
116
115
|
return true;
|
|
117
116
|
}
|
|
118
117
|
return false;
|
|
119
118
|
});
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const oldAttrs = lastChangeRejected ? oldUpdate.oldAttrs : restAttrs;
|
|
124
|
-
const newDataTracked = [
|
|
125
|
-
...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id || lastChangeRejected),
|
|
126
|
-
];
|
|
119
|
+
const _a = c.node.attrs, { dataTracked } = _a, restAttrs = __rest(_a, ["dataTracked"]);
|
|
120
|
+
const oldAttrs = restAttrs;
|
|
121
|
+
const newDataTracked = [...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id)];
|
|
127
122
|
const newUpdate = oldUpdate && oldUpdate.status !== change_1.CHANGE_STATUS.rejected
|
|
128
|
-
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewUpdateAttrs(emptyAttrs,
|
|
123
|
+
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewUpdateAttrs(emptyAttrs, c.node.attrs));
|
|
129
124
|
if ((JSON.stringify(oldAttrs) !== JSON.stringify(c.newAttrs) ||
|
|
130
125
|
c.node.type === c.node.type.schema.nodes.citation) &&
|
|
131
126
|
!oldDataTracked.find((d) => (d.operation === change_1.CHANGE_OPERATION.insert || d.operation === change_1.CHANGE_OPERATION.wrap_with_node) &&
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.applyAcceptedRejectedChanges = exports.getUpdatedDataTracked = void 0;
|
|
15
4
|
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
@@ -18,6 +7,7 @@ const deleteNode_1 = require("../mutate/deleteNode");
|
|
|
18
7
|
const mergeNode_1 = require("../mutate/mergeNode");
|
|
19
8
|
const change_1 = require("../types/change");
|
|
20
9
|
const logger_1 = require("../utils/logger");
|
|
10
|
+
const revertChange_1 = require("./revertChange");
|
|
21
11
|
const updateChangeAttrs_1 = require("./updateChangeAttrs");
|
|
22
12
|
function getUpdatedDataTracked(dataTracked, changeId) {
|
|
23
13
|
if (!dataTracked) {
|
|
@@ -27,30 +17,24 @@ function getUpdatedDataTracked(dataTracked, changeId) {
|
|
|
27
17
|
return newDataTracked.length ? newDataTracked : null;
|
|
28
18
|
}
|
|
29
19
|
exports.getUpdatedDataTracked = getUpdatedDataTracked;
|
|
30
|
-
function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new prosemirror_transform_1.Mapping()) {
|
|
31
|
-
const attrsChangesLog = new Map();
|
|
32
|
-
function addAttrLog(nodeId, changeId) {
|
|
33
|
-
const arr = attrsChangesLog.get(nodeId) || attrsChangesLog.set(nodeId, []).get(nodeId);
|
|
34
|
-
arr.push(changeId);
|
|
35
|
-
}
|
|
20
|
+
function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, deleteMap = new prosemirror_transform_1.Mapping()) {
|
|
36
21
|
changes.sort((c1, c2) => c1.dataTracked.updatedAt - c2.dataTracked.updatedAt);
|
|
37
22
|
changes.forEach((change) => {
|
|
38
|
-
|
|
23
|
+
if (change.dataTracked.status == change_1.CHANGE_STATUS.rejected) {
|
|
24
|
+
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.node_split) {
|
|
25
|
+
return (0, revertChange_1.revertSplitNodeChange)(tr, change, changeSet);
|
|
26
|
+
}
|
|
27
|
+
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.wrap_with_node) {
|
|
28
|
+
return (0, revertChange_1.revertWrapNodeChange)(tr, change);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const { pos: from, deleted } = deleteMap.mapResult(change.from);
|
|
32
|
+
const node = tr.doc.nodeAt(from);
|
|
33
|
+
const noChangeNeeded = deleted || !ChangeSet_1.ChangeSet.shouldDeleteChange(change);
|
|
39
34
|
if (!node) {
|
|
40
35
|
!deleted && logger_1.log.warn('no node found to update for change', change);
|
|
41
36
|
return;
|
|
42
37
|
}
|
|
43
|
-
if (change.dataTracked.status === change_1.CHANGE_STATUS.pending) {
|
|
44
|
-
if (ChangeSet_1.ChangeSet.isNodeAttrChange(change)) {
|
|
45
|
-
const _a = change.newAttrs, { dataTracked } = _a, attrs = __rest(_a, ["dataTracked"]);
|
|
46
|
-
const changeLog = attrsChangesLog.get(node.attrs.id);
|
|
47
|
-
const newDataTracked = changeLog && changeLog.length
|
|
48
|
-
? dataTracked.filter((c) => !changeLog.includes(c.id))
|
|
49
|
-
: dataTracked;
|
|
50
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: newDataTracked.length ? newDataTracked : null }), node.marks);
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
38
|
if (ChangeSet_1.ChangeSet.isTextChange(change) && noChangeNeeded) {
|
|
55
39
|
tr.removeMark(from, deleteMap.map(change.to), schema.marks.tracked_insert);
|
|
56
40
|
tr.removeMark(from, deleteMap.map(change.to), schema.marks.tracked_delete);
|
|
@@ -73,16 +57,12 @@ function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new prose
|
|
|
73
57
|
}
|
|
74
58
|
else if (ChangeSet_1.ChangeSet.isNodeAttrChange(change) && change.dataTracked.status === change_1.CHANGE_STATUS.accepted) {
|
|
75
59
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.newAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
76
|
-
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
77
60
|
}
|
|
78
61
|
else if (ChangeSet_1.ChangeSet.isNodeAttrChange(change) && change.dataTracked.status === change_1.CHANGE_STATUS.rejected) {
|
|
79
|
-
console.log('GETTING IN ---- CHANGE_STATUS.rejected');
|
|
80
62
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.oldAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
81
|
-
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
82
63
|
}
|
|
83
64
|
else if (ChangeSet_1.ChangeSet.isReferenceChange(change)) {
|
|
84
|
-
|
|
85
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
65
|
+
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: null }), node.marks);
|
|
86
66
|
}
|
|
87
67
|
});
|
|
88
68
|
return deleteMap;
|
|
@@ -29,7 +29,7 @@ function findChanges(state) {
|
|
|
29
29
|
type: 'text-change',
|
|
30
30
|
from: pos,
|
|
31
31
|
to: pos + node.nodeSize,
|
|
32
|
-
dataTracked,
|
|
32
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
33
33
|
text: node.text,
|
|
34
34
|
nodeType: node.type,
|
|
35
35
|
};
|
|
@@ -40,10 +40,10 @@ function findChanges(state) {
|
|
|
40
40
|
type: 'node-attr-change',
|
|
41
41
|
from: pos,
|
|
42
42
|
to: pos + node.nodeSize,
|
|
43
|
-
dataTracked,
|
|
43
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
44
44
|
node: node,
|
|
45
|
-
newAttrs: node.attrs,
|
|
46
|
-
oldAttrs: dataTracked.oldAttrs,
|
|
45
|
+
newAttrs: Object.assign({}, node.attrs),
|
|
46
|
+
oldAttrs: Object.assign({}, dataTracked.oldAttrs),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
else if (dataTracked.operation === change_1.CHANGE_OPERATION.reference) {
|
|
@@ -61,10 +61,10 @@ function findChanges(state) {
|
|
|
61
61
|
type: 'node-change',
|
|
62
62
|
from: pos,
|
|
63
63
|
to: pos + node.nodeSize,
|
|
64
|
-
dataTracked,
|
|
64
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
65
65
|
node: node,
|
|
66
66
|
children: [],
|
|
67
|
-
attrs: node.attrs,
|
|
67
|
+
attrs: Object.assign({}, node.attrs),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
current = {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.revertWrapNodeChange = exports.revertSplitNodeChange = void 0;
|
|
4
4
|
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
5
5
|
const nodeHelpers_1 = require("../compute/nodeHelpers");
|
|
6
|
-
const change_1 = require("../types/change");
|
|
7
6
|
const applyChanges_1 = require("./applyChanges");
|
|
8
7
|
function revertSplitNodeChange(tr, change, changeSet) {
|
|
9
|
-
|
|
8
|
+
const sourceChange = changeSet.changes.find((c) => c.dataTracked.operation === 'reference' && c.dataTracked.referenceId === change.id);
|
|
10
9
|
const node = tr.doc.nodeAt(tr.mapping.map(change.from));
|
|
11
10
|
tr.delete(tr.mapping.map(change.from), tr.mapping.map(change.to));
|
|
12
11
|
tr.replaceWith(tr.mapping.map(sourceChange.to - 1), tr.mapping.map(sourceChange.to), node.content);
|
|
@@ -16,7 +15,8 @@ function revertSplitNodeChange(tr, change, changeSet) {
|
|
|
16
15
|
const childSource = changeSet.changes.find((c) => c.from === change.from && c.dataTracked.operation === 'reference');
|
|
17
16
|
if (childSource) {
|
|
18
17
|
const node = tr.doc.nodeAt(tr.mapping.map(sourceChange.from));
|
|
19
|
-
const
|
|
18
|
+
const data = (0, nodeHelpers_1.getBlockInlineTrackedData)(node) || [];
|
|
19
|
+
const dataTracked = data.map((c) => (c.operation === 'reference' ? childSource.dataTracked : c));
|
|
20
20
|
tr.setNodeMarkup(tr.mapping.map(sourceChange.from), undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked }), node.marks);
|
|
21
21
|
}
|
|
22
22
|
const deleteChange = changeSet.changes.find((c) => c.dataTracked.operation == 'delete' && c.from === sourceChange.from);
|
|
@@ -25,10 +25,13 @@ function revertSplitNodeChange(tr, change, changeSet) {
|
|
|
25
25
|
tr.setNodeMarkup(tr.mapping.map(deleteChange.from), undefined, (0, applyChanges_1.getUpdatedDataTracked)(node.attrs.dataTracked, deleteChange.id));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
exports.revertSplitNodeChange = revertSplitNodeChange;
|
|
28
29
|
function revertWrapNodeChange(tr, change) {
|
|
29
|
-
tr.
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const from = tr.mapping.map(change.from);
|
|
31
|
+
const to = tr.mapping.map(change.to);
|
|
32
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
33
|
+
const $fromPos = tr.doc.resolve(pos);
|
|
34
|
+
const $toPos = tr.doc.resolve(pos + node.nodeSize - 1);
|
|
32
35
|
const nodeRange = $fromPos.blockRange($toPos);
|
|
33
36
|
if (!nodeRange) {
|
|
34
37
|
return;
|
|
@@ -39,18 +42,4 @@ function revertWrapNodeChange(tr, change) {
|
|
|
39
42
|
}
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
if (status !== change_1.CHANGE_STATUS.rejected) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
ids.forEach((id) => {
|
|
47
|
-
const change = changeSet.get(id);
|
|
48
|
-
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.node_split) {
|
|
49
|
-
revertSplitNodeChange(tr, change, changeSet);
|
|
50
|
-
}
|
|
51
|
-
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.wrap_with_node) {
|
|
52
|
-
revertWrapNodeChange(tr, change);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.revertRejectedChanges = revertRejectedChanges;
|
|
45
|
+
exports.revertWrapNodeChange = revertWrapNodeChange;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateChangeChildrenAttributes = exports.updateChangeAttrs = void 0;
|
|
4
4
|
const ChangeSet_1 = require("../ChangeSet");
|
|
5
5
|
const nodeHelpers_1 = require("../compute/nodeHelpers");
|
|
6
|
+
const change_1 = require("../types/change");
|
|
6
7
|
const logger_1 = require("../utils/logger");
|
|
7
8
|
function updateChangeAttrs(tr, change, trackedAttrs, schema) {
|
|
8
9
|
const node = tr.doc.nodeAt(change.from);
|
|
@@ -24,27 +25,47 @@ function updateChangeAttrs(tr, change, trackedAttrs, schema) {
|
|
|
24
25
|
logger_1.log.warn('updateChangeAttrs: no track marks for a text-change ', change);
|
|
25
26
|
return tr;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
if (trackedAttrs.status === change_1.CHANGE_STATUS.accepted || trackedAttrs.status === change_1.CHANGE_STATUS.rejected) {
|
|
29
|
+
tr.removeMark(change.from, change.to, oldMark);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
tr.addMark(change.from, change.to, oldMark.type.create(Object.assign(Object.assign({}, oldMark.attrs), { dataTracked: Object.assign(Object.assign({}, oldTrackData), trackedAttrs) })));
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
else if ((change.type === 'node-change' || change.type === 'node-attr-change') && !operation) {
|
|
30
36
|
tr.setNodeMarkup(change.from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: null }), node.marks);
|
|
31
37
|
}
|
|
32
38
|
else if (change.type === 'node-change' || change.type === 'node-attr-change') {
|
|
39
|
+
let restoredAttrs = undefined;
|
|
40
|
+
if (trackedAttrs.operation === change_1.CHANGE_OPERATION.set_node_attributes &&
|
|
41
|
+
trackedAttrs.status === change_1.CHANGE_STATUS.rejected) {
|
|
42
|
+
restoredAttrs = trackedAttrs.oldAttrs;
|
|
43
|
+
}
|
|
33
44
|
const trackedDataSource = (0, nodeHelpers_1.getBlockInlineTrackedData)(node) || [];
|
|
34
45
|
const targetDataTracked = trackedDataSource.find((t) => change.id === t.id);
|
|
35
|
-
const newDataTracked = trackedDataSource
|
|
46
|
+
const newDataTracked = trackedDataSource
|
|
47
|
+
.map((oldTrack) => {
|
|
36
48
|
if (targetDataTracked) {
|
|
37
49
|
if (oldTrack.id === targetDataTracked.id) {
|
|
50
|
+
if (trackedAttrs.status === change_1.CHANGE_STATUS.accepted ||
|
|
51
|
+
trackedAttrs.status === change_1.CHANGE_STATUS.rejected) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
38
54
|
return Object.assign(Object.assign({}, oldTrack), trackedAttrs);
|
|
39
55
|
}
|
|
40
56
|
return oldTrack;
|
|
41
57
|
}
|
|
42
58
|
if (oldTrack.operation === operation) {
|
|
59
|
+
if (trackedAttrs.status === change_1.CHANGE_STATUS.accepted ||
|
|
60
|
+
trackedAttrs.status === change_1.CHANGE_STATUS.rejected) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
43
63
|
return Object.assign(Object.assign({}, oldTrack), trackedAttrs);
|
|
44
64
|
}
|
|
45
65
|
return oldTrack;
|
|
46
|
-
})
|
|
47
|
-
|
|
66
|
+
})
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
tr.setNodeMarkup(change.from, undefined, Object.assign(Object.assign({}, (restoredAttrs || node.attrs)), { dataTracked: newDataTracked.length === 0 ? null : newDataTracked }), node.marks);
|
|
48
69
|
}
|
|
49
70
|
return tr;
|
|
50
71
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2023 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.updateChangesStatus = void 0;
|
|
19
|
+
const prosemirror_history_1 = require("prosemirror-history");
|
|
20
|
+
const ChangeSet_1 = require("../ChangeSet");
|
|
21
|
+
const change_1 = require("../types/change");
|
|
22
|
+
const applyChanges_1 = require("./applyChanges");
|
|
23
|
+
const updateChangeAttrs_1 = require("./updateChangeAttrs");
|
|
24
|
+
function updateChangesStatus(createdTr, changeSet, ids, status, userID, oldState) {
|
|
25
|
+
const change = changeSet.get(ids[0]);
|
|
26
|
+
if (change && status !== change_1.CHANGE_STATUS.pending) {
|
|
27
|
+
const textChanges = [];
|
|
28
|
+
const nonTextChanges = [];
|
|
29
|
+
changeSet.changes.forEach((c) => {
|
|
30
|
+
if (ids.includes(c.id)) {
|
|
31
|
+
c.dataTracked.status = status;
|
|
32
|
+
if (ChangeSet_1.ChangeSet.isTextChange(c)) {
|
|
33
|
+
textChanges.push(c);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
nonTextChanges.push(c);
|
|
37
|
+
if (c.dataTracked.operation === change_1.CHANGE_OPERATION.node_split) {
|
|
38
|
+
const relatedRefChange = changeSet.changes.find((c) => c.dataTracked.operation === 'reference' && c.dataTracked.referenceId === change.id);
|
|
39
|
+
if (relatedRefChange) {
|
|
40
|
+
nonTextChanges.push(relatedRefChange);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const mapping = (0, applyChanges_1.applyAcceptedRejectedChanges)(createdTr, oldState.schema, nonTextChanges, changeSet);
|
|
47
|
+
(0, applyChanges_1.applyAcceptedRejectedChanges)(createdTr, oldState.schema, textChanges, changeSet, mapping);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const changeTime = new Date().getTime();
|
|
51
|
+
ids.forEach((changeId) => {
|
|
52
|
+
const change = changeSet === null || changeSet === void 0 ? void 0 : changeSet.get(changeId);
|
|
53
|
+
if (change) {
|
|
54
|
+
createdTr = (0, updateChangeAttrs_1.updateChangeAttrs)(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
(0, prosemirror_history_1.closeHistory)(createdTr);
|
|
59
|
+
}
|
|
60
|
+
exports.updateChangesStatus = updateChangesStatus;
|
package/dist/cjs/commands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.refreshChanges = exports.
|
|
3
|
+
exports.refreshChanges = exports.setUserID = exports.setChangeStatuses = exports.setTrackingStatus = void 0;
|
|
4
4
|
const actions_1 = require("./actions");
|
|
5
5
|
const plugin_1 = require("./plugin");
|
|
6
6
|
const track_1 = require("./types/track");
|
|
@@ -35,11 +35,6 @@ const setUserID = (userID) => (state, dispatch) => {
|
|
|
35
35
|
return true;
|
|
36
36
|
};
|
|
37
37
|
exports.setUserID = setUserID;
|
|
38
|
-
const applyAndRemoveChanges = () => (state, dispatch) => {
|
|
39
|
-
dispatch && dispatch((0, actions_1.setAction)(state.tr, actions_1.TrackChangesAction.applyAndRemoveChanges, true));
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
exports.applyAndRemoveChanges = applyAndRemoveChanges;
|
|
43
38
|
const refreshChanges = () => (state, dispatch) => {
|
|
44
39
|
dispatch && dispatch((0, actions_1.setAction)(state.tr, actions_1.TrackChangesAction.refreshChanges, true));
|
|
45
40
|
return true;
|
|
@@ -33,7 +33,7 @@ function getBlockInlineTrackedData(node) {
|
|
|
33
33
|
if (dataTracked && !Array.isArray(dataTracked)) {
|
|
34
34
|
return [dataTracked];
|
|
35
35
|
}
|
|
36
|
-
return dataTracked;
|
|
36
|
+
return dataTracked || [];
|
|
37
37
|
}
|
|
38
38
|
exports.getBlockInlineTrackedData = getBlockInlineTrackedData;
|
|
39
39
|
function getNodeTrackedData(node, schema) {
|
|
@@ -92,7 +92,7 @@ function setFragmentAsNodeSplit($pos, newTr, inserted, attrs) {
|
|
|
92
92
|
const oldDataTracked = (0, nodeHelpers_1.getBlockInlineTrackedData)(parent) || [];
|
|
93
93
|
newTr.setNodeMarkup(parentPos, undefined, Object.assign(Object.assign({}, parent.attrs), { dataTracked: [
|
|
94
94
|
...oldDataTracked.filter((c) => c.operation !== 'reference'),
|
|
95
|
-
Object.assign({}, (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: change_1.CHANGE_STATUS.
|
|
95
|
+
Object.assign({}, (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: change_1.CHANGE_STATUS.pending }), referenceId))),
|
|
96
96
|
] }));
|
|
97
97
|
const splitSource = oldDataTracked.find((c) => c.operation === 'reference');
|
|
98
98
|
const dataTracked = Object.assign(Object.assign({}, trackUtils.createNewSplitAttrs(Object.assign({}, attrs))), { id: referenceId });
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -14,11 +14,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.trackChangesPlugin = exports.trackChangesPluginKey = void 0;
|
|
15
15
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
16
16
|
const actions_1 = require("./actions");
|
|
17
|
-
const applyChanges_1 = require("./changes/applyChanges");
|
|
18
17
|
const findChanges_1 = require("./changes/findChanges");
|
|
19
18
|
const fixInconsistentChanges_1 = require("./changes/fixInconsistentChanges");
|
|
20
|
-
const
|
|
21
|
-
const updateChangeAttrs_1 = require("./changes/updateChangeAttrs");
|
|
19
|
+
const updateChangesStatus_1 = require("./changes/updateChangesStatus");
|
|
22
20
|
const ChangeSet_1 = require("./ChangeSet");
|
|
23
21
|
const trackTransaction_1 = require("./steps/trackTransaction");
|
|
24
22
|
const track_1 = require("./types/track");
|
|
@@ -62,7 +60,9 @@ const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initialStatu
|
|
|
62
60
|
return Object.assign(Object.assign({}, pluginState), { changeSet: new ChangeSet_1.ChangeSet() });
|
|
63
61
|
}
|
|
64
62
|
let { changeSet } = pluginState, rest = __rest(pluginState, ["changeSet"]);
|
|
65
|
-
if ((0, actions_1.getAction)(tr, actions_1.TrackChangesAction.refreshChanges)
|
|
63
|
+
if ((0, actions_1.getAction)(tr, actions_1.TrackChangesAction.refreshChanges) ||
|
|
64
|
+
tr.getMeta('history$') ||
|
|
65
|
+
tr.getMeta('history$1')) {
|
|
66
66
|
changeSet = (0, findChanges_1.findChanges)(newState);
|
|
67
67
|
}
|
|
68
68
|
return Object.assign({ changeSet }, rest);
|
|
@@ -92,31 +92,21 @@ const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initialStatu
|
|
|
92
92
|
docChanged = true;
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
+
const setChangeStatuses = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.setChangeStatuses);
|
|
95
96
|
const skipTrackUsed = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.skipTrack) ||
|
|
96
97
|
(wasAppended && (0, actions_1.getAction)(wasAppended, actions_1.TrackChangesAction.skipTrack));
|
|
97
|
-
if (
|
|
98
|
+
if (!setChangeStatuses &&
|
|
99
|
+
tr.docChanged &&
|
|
98
100
|
!skipMetaUsed &&
|
|
99
101
|
!skipTrackUsed &&
|
|
100
|
-
!tr.getMeta('history$') &&
|
|
102
|
+
!(tr.getMeta('history$') || tr.getMeta('history$1')) &&
|
|
101
103
|
!(wasAppended && tr.getMeta('origin') === 'paragraphs')) {
|
|
102
104
|
createdTr = (0, trackTransaction_1.trackTransaction)(tr, oldState, createdTr, userID);
|
|
103
105
|
}
|
|
104
106
|
docChanged = docChanged || tr.docChanged;
|
|
105
|
-
const setChangeStatuses = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.setChangeStatuses);
|
|
106
107
|
if (setChangeStatuses) {
|
|
107
108
|
const { status, ids } = setChangeStatuses;
|
|
108
|
-
|
|
109
|
-
ids.forEach((changeId) => {
|
|
110
|
-
const change = changeSet === null || changeSet === void 0 ? void 0 : changeSet.get(changeId);
|
|
111
|
-
if (change) {
|
|
112
|
-
createdTr = (0, updateChangeAttrs_1.updateChangeAttrs)(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
(0, revertChange_1.revertRejectedChanges)(createdTr, oldState.schema, ids, changeSet, status);
|
|
116
|
-
}
|
|
117
|
-
else if ((0, actions_1.getAction)(tr, actions_1.TrackChangesAction.applyAndRemoveChanges)) {
|
|
118
|
-
const mapping = (0, applyChanges_1.applyAcceptedRejectedChanges)(createdTr, oldState.schema, changeSet.bothNodeChanges);
|
|
119
|
-
(0, applyChanges_1.applyAcceptedRejectedChanges)(createdTr, oldState.schema, changeSet.textChanges, mapping);
|
|
109
|
+
(0, updateChangesStatus_1.updateChangesStatus)(createdTr, changeSet, ids, status, userID, oldState);
|
|
120
110
|
(0, actions_1.setAction)(createdTr, actions_1.TrackChangesAction.refreshChanges, true);
|
|
121
111
|
}
|
|
122
112
|
});
|
package/dist/es/ChangeSet.js
CHANGED
|
@@ -76,12 +76,6 @@ export class ChangeSet {
|
|
|
76
76
|
get pending() {
|
|
77
77
|
return this.changeTree.filter((c) => c.dataTracked.status === CHANGE_STATUS.pending);
|
|
78
78
|
}
|
|
79
|
-
get accepted() {
|
|
80
|
-
return this.changeTree.filter((c) => c.dataTracked.status === CHANGE_STATUS.accepted);
|
|
81
|
-
}
|
|
82
|
-
get rejected() {
|
|
83
|
-
return this.changeTree.filter((c) => c.dataTracked.status === CHANGE_STATUS.rejected);
|
|
84
|
-
}
|
|
85
79
|
get textChanges() {
|
|
86
80
|
return this.changes.filter((c) => c.type === 'text-change');
|
|
87
81
|
}
|
package/dist/es/actions.js
CHANGED
|
@@ -5,7 +5,6 @@ export var TrackChangesAction;
|
|
|
5
5
|
TrackChangesAction["setPluginStatus"] = "track-changes-set-track-status";
|
|
6
6
|
TrackChangesAction["setChangeStatuses"] = "track-changes-set-change-statuses";
|
|
7
7
|
TrackChangesAction["refreshChanges"] = "track-changes-refresh-changes";
|
|
8
|
-
TrackChangesAction["applyAndRemoveChanges"] = "track-changes-apply-remove-changes";
|
|
9
8
|
TrackChangesAction["updateMetaNode"] = "track-changes-update-meta-node";
|
|
10
9
|
})(TrackChangesAction || (TrackChangesAction = {}));
|
|
11
10
|
export function hasAction(tr) {
|
|
@@ -85,21 +85,16 @@ export function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema)
|
|
|
85
85
|
case 'update-node-attrs':
|
|
86
86
|
const oldDataTracked = getBlockInlineTrackedData(c.node) || [];
|
|
87
87
|
const oldUpdate = oldDataTracked.reverse().find((d) => {
|
|
88
|
-
if (d.operation === CHANGE_OPERATION.set_node_attributes &&
|
|
89
|
-
(d.status === CHANGE_STATUS.pending || d.status === CHANGE_STATUS.rejected)) {
|
|
88
|
+
if (d.operation === CHANGE_OPERATION.set_node_attributes && d.status === CHANGE_STATUS.pending) {
|
|
90
89
|
return true;
|
|
91
90
|
}
|
|
92
91
|
return false;
|
|
93
92
|
});
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const oldAttrs = lastChangeRejected ? oldUpdate.oldAttrs : restAttrs;
|
|
98
|
-
const newDataTracked = [
|
|
99
|
-
...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id || lastChangeRejected),
|
|
100
|
-
];
|
|
93
|
+
const _a = c.node.attrs, { dataTracked } = _a, restAttrs = __rest(_a, ["dataTracked"]);
|
|
94
|
+
const oldAttrs = restAttrs;
|
|
95
|
+
const newDataTracked = [...oldDataTracked.filter((d) => !oldUpdate || d.id !== oldUpdate.id)];
|
|
101
96
|
const newUpdate = oldUpdate && oldUpdate.status !== CHANGE_STATUS.rejected
|
|
102
|
-
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : addTrackIdIfDoesntExist(trackUtils.createNewUpdateAttrs(emptyAttrs,
|
|
97
|
+
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : addTrackIdIfDoesntExist(trackUtils.createNewUpdateAttrs(emptyAttrs, c.node.attrs));
|
|
103
98
|
if ((JSON.stringify(oldAttrs) !== JSON.stringify(c.newAttrs) ||
|
|
104
99
|
c.node.type === c.node.type.schema.nodes.citation) &&
|
|
105
100
|
!oldDataTracked.find((d) => (d.operation === CHANGE_OPERATION.insert || d.operation === CHANGE_OPERATION.wrap_with_node) &&
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import { Mapping } from 'prosemirror-transform';
|
|
13
2
|
import { ChangeSet } from '../ChangeSet';
|
|
14
3
|
import { deleteNode } from '../mutate/deleteNode';
|
|
15
4
|
import { mergeNode } from '../mutate/mergeNode';
|
|
16
|
-
import { CHANGE_STATUS } from '../types/change';
|
|
5
|
+
import { CHANGE_OPERATION, CHANGE_STATUS } from '../types/change';
|
|
17
6
|
import { log } from '../utils/logger';
|
|
7
|
+
import { revertSplitNodeChange, revertWrapNodeChange } from './revertChange';
|
|
18
8
|
import { updateChangeChildrenAttributes } from './updateChangeAttrs';
|
|
19
9
|
export function getUpdatedDataTracked(dataTracked, changeId) {
|
|
20
10
|
if (!dataTracked) {
|
|
@@ -23,30 +13,24 @@ export function getUpdatedDataTracked(dataTracked, changeId) {
|
|
|
23
13
|
const newDataTracked = dataTracked.filter((c) => c.id !== changeId);
|
|
24
14
|
return newDataTracked.length ? newDataTracked : null;
|
|
25
15
|
}
|
|
26
|
-
export function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new Mapping()) {
|
|
27
|
-
const attrsChangesLog = new Map();
|
|
28
|
-
function addAttrLog(nodeId, changeId) {
|
|
29
|
-
const arr = attrsChangesLog.get(nodeId) || attrsChangesLog.set(nodeId, []).get(nodeId);
|
|
30
|
-
arr.push(changeId);
|
|
31
|
-
}
|
|
16
|
+
export function applyAcceptedRejectedChanges(tr, schema, changes, changeSet, deleteMap = new Mapping()) {
|
|
32
17
|
changes.sort((c1, c2) => c1.dataTracked.updatedAt - c2.dataTracked.updatedAt);
|
|
33
18
|
changes.forEach((change) => {
|
|
34
|
-
|
|
19
|
+
if (change.dataTracked.status == CHANGE_STATUS.rejected) {
|
|
20
|
+
if (change.dataTracked.operation === CHANGE_OPERATION.node_split) {
|
|
21
|
+
return revertSplitNodeChange(tr, change, changeSet);
|
|
22
|
+
}
|
|
23
|
+
if (change.dataTracked.operation === CHANGE_OPERATION.wrap_with_node) {
|
|
24
|
+
return revertWrapNodeChange(tr, change);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const { pos: from, deleted } = deleteMap.mapResult(change.from);
|
|
28
|
+
const node = tr.doc.nodeAt(from);
|
|
29
|
+
const noChangeNeeded = deleted || !ChangeSet.shouldDeleteChange(change);
|
|
35
30
|
if (!node) {
|
|
36
31
|
!deleted && log.warn('no node found to update for change', change);
|
|
37
32
|
return;
|
|
38
33
|
}
|
|
39
|
-
if (change.dataTracked.status === CHANGE_STATUS.pending) {
|
|
40
|
-
if (ChangeSet.isNodeAttrChange(change)) {
|
|
41
|
-
const _a = change.newAttrs, { dataTracked } = _a, attrs = __rest(_a, ["dataTracked"]);
|
|
42
|
-
const changeLog = attrsChangesLog.get(node.attrs.id);
|
|
43
|
-
const newDataTracked = changeLog && changeLog.length
|
|
44
|
-
? dataTracked.filter((c) => !changeLog.includes(c.id))
|
|
45
|
-
: dataTracked;
|
|
46
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: newDataTracked.length ? newDataTracked : null }), node.marks);
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
34
|
if (ChangeSet.isTextChange(change) && noChangeNeeded) {
|
|
51
35
|
tr.removeMark(from, deleteMap.map(change.to), schema.marks.tracked_insert);
|
|
52
36
|
tr.removeMark(from, deleteMap.map(change.to), schema.marks.tracked_delete);
|
|
@@ -69,16 +53,12 @@ export function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = ne
|
|
|
69
53
|
}
|
|
70
54
|
else if (ChangeSet.isNodeAttrChange(change) && change.dataTracked.status === CHANGE_STATUS.accepted) {
|
|
71
55
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.newAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
72
|
-
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
73
56
|
}
|
|
74
57
|
else if (ChangeSet.isNodeAttrChange(change) && change.dataTracked.status === CHANGE_STATUS.rejected) {
|
|
75
|
-
console.log('GETTING IN ---- CHANGE_STATUS.rejected');
|
|
76
58
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.oldAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
77
|
-
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
78
59
|
}
|
|
79
60
|
else if (ChangeSet.isReferenceChange(change)) {
|
|
80
|
-
|
|
81
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
61
|
+
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: null }), node.marks);
|
|
82
62
|
}
|
|
83
63
|
});
|
|
84
64
|
return deleteMap;
|
|
@@ -26,7 +26,7 @@ export function findChanges(state) {
|
|
|
26
26
|
type: 'text-change',
|
|
27
27
|
from: pos,
|
|
28
28
|
to: pos + node.nodeSize,
|
|
29
|
-
dataTracked,
|
|
29
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
30
30
|
text: node.text,
|
|
31
31
|
nodeType: node.type,
|
|
32
32
|
};
|
|
@@ -37,10 +37,10 @@ export function findChanges(state) {
|
|
|
37
37
|
type: 'node-attr-change',
|
|
38
38
|
from: pos,
|
|
39
39
|
to: pos + node.nodeSize,
|
|
40
|
-
dataTracked,
|
|
40
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
41
41
|
node: node,
|
|
42
|
-
newAttrs: node.attrs,
|
|
43
|
-
oldAttrs: dataTracked.oldAttrs,
|
|
42
|
+
newAttrs: Object.assign({}, node.attrs),
|
|
43
|
+
oldAttrs: Object.assign({}, dataTracked.oldAttrs),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
else if (dataTracked.operation === CHANGE_OPERATION.reference) {
|
|
@@ -58,10 +58,10 @@ export function findChanges(state) {
|
|
|
58
58
|
type: 'node-change',
|
|
59
59
|
from: pos,
|
|
60
60
|
to: pos + node.nodeSize,
|
|
61
|
-
dataTracked,
|
|
61
|
+
dataTracked: Object.assign({}, dataTracked),
|
|
62
62
|
node: node,
|
|
63
63
|
children: [],
|
|
64
|
-
attrs: node.attrs,
|
|
64
|
+
attrs: Object.assign({}, node.attrs),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
current = {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { liftTarget } from 'prosemirror-transform';
|
|
2
2
|
import { getBlockInlineTrackedData } from '../compute/nodeHelpers';
|
|
3
|
-
import { CHANGE_OPERATION, CHANGE_STATUS } from '../types/change';
|
|
4
3
|
import { getUpdatedDataTracked } from './applyChanges';
|
|
5
|
-
function revertSplitNodeChange(tr, change, changeSet) {
|
|
6
|
-
|
|
4
|
+
export function revertSplitNodeChange(tr, change, changeSet) {
|
|
5
|
+
const sourceChange = changeSet.changes.find((c) => c.dataTracked.operation === 'reference' && c.dataTracked.referenceId === change.id);
|
|
7
6
|
const node = tr.doc.nodeAt(tr.mapping.map(change.from));
|
|
8
7
|
tr.delete(tr.mapping.map(change.from), tr.mapping.map(change.to));
|
|
9
8
|
tr.replaceWith(tr.mapping.map(sourceChange.to - 1), tr.mapping.map(sourceChange.to), node.content);
|
|
@@ -13,7 +12,8 @@ function revertSplitNodeChange(tr, change, changeSet) {
|
|
|
13
12
|
const childSource = changeSet.changes.find((c) => c.from === change.from && c.dataTracked.operation === 'reference');
|
|
14
13
|
if (childSource) {
|
|
15
14
|
const node = tr.doc.nodeAt(tr.mapping.map(sourceChange.from));
|
|
16
|
-
const
|
|
15
|
+
const data = getBlockInlineTrackedData(node) || [];
|
|
16
|
+
const dataTracked = data.map((c) => (c.operation === 'reference' ? childSource.dataTracked : c));
|
|
17
17
|
tr.setNodeMarkup(tr.mapping.map(sourceChange.from), undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked }), node.marks);
|
|
18
18
|
}
|
|
19
19
|
const deleteChange = changeSet.changes.find((c) => c.dataTracked.operation == 'delete' && c.from === sourceChange.from);
|
|
@@ -22,10 +22,12 @@ function revertSplitNodeChange(tr, change, changeSet) {
|
|
|
22
22
|
tr.setNodeMarkup(tr.mapping.map(deleteChange.from), undefined, getUpdatedDataTracked(node.attrs.dataTracked, deleteChange.id));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function revertWrapNodeChange(tr, change) {
|
|
26
|
-
tr.
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
export function revertWrapNodeChange(tr, change) {
|
|
26
|
+
const from = tr.mapping.map(change.from);
|
|
27
|
+
const to = tr.mapping.map(change.to);
|
|
28
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
29
|
+
const $fromPos = tr.doc.resolve(pos);
|
|
30
|
+
const $toPos = tr.doc.resolve(pos + node.nodeSize - 1);
|
|
29
31
|
const nodeRange = $fromPos.blockRange($toPos);
|
|
30
32
|
if (!nodeRange) {
|
|
31
33
|
return;
|
|
@@ -36,17 +38,3 @@ function revertWrapNodeChange(tr, change) {
|
|
|
36
38
|
}
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
|
-
export function revertRejectedChanges(tr, schema, ids, changeSet, status) {
|
|
40
|
-
if (status !== CHANGE_STATUS.rejected) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
ids.forEach((id) => {
|
|
44
|
-
const change = changeSet.get(id);
|
|
45
|
-
if (change.dataTracked.operation === CHANGE_OPERATION.node_split) {
|
|
46
|
-
revertSplitNodeChange(tr, change, changeSet);
|
|
47
|
-
}
|
|
48
|
-
if (change.dataTracked.operation === CHANGE_OPERATION.wrap_with_node) {
|
|
49
|
-
revertWrapNodeChange(tr, change);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChangeSet } from '../ChangeSet';
|
|
2
|
-
import { getBlockInlineTrackedData, getTextNodeTrackedMarkData
|
|
2
|
+
import { getBlockInlineTrackedData, getTextNodeTrackedMarkData } from '../compute/nodeHelpers';
|
|
3
|
+
import { CHANGE_OPERATION, CHANGE_STATUS, } from '../types/change';
|
|
3
4
|
import { log } from '../utils/logger';
|
|
4
5
|
export function updateChangeAttrs(tr, change, trackedAttrs, schema) {
|
|
5
6
|
const node = tr.doc.nodeAt(change.from);
|
|
@@ -21,27 +22,47 @@ export function updateChangeAttrs(tr, change, trackedAttrs, schema) {
|
|
|
21
22
|
log.warn('updateChangeAttrs: no track marks for a text-change ', change);
|
|
22
23
|
return tr;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
if (trackedAttrs.status === CHANGE_STATUS.accepted || trackedAttrs.status === CHANGE_STATUS.rejected) {
|
|
26
|
+
tr.removeMark(change.from, change.to, oldMark);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
tr.addMark(change.from, change.to, oldMark.type.create(Object.assign(Object.assign({}, oldMark.attrs), { dataTracked: Object.assign(Object.assign({}, oldTrackData), trackedAttrs) })));
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
else if ((change.type === 'node-change' || change.type === 'node-attr-change') && !operation) {
|
|
27
33
|
tr.setNodeMarkup(change.from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked: null }), node.marks);
|
|
28
34
|
}
|
|
29
35
|
else if (change.type === 'node-change' || change.type === 'node-attr-change') {
|
|
36
|
+
let restoredAttrs = undefined;
|
|
37
|
+
if (trackedAttrs.operation === CHANGE_OPERATION.set_node_attributes &&
|
|
38
|
+
trackedAttrs.status === CHANGE_STATUS.rejected) {
|
|
39
|
+
restoredAttrs = trackedAttrs.oldAttrs;
|
|
40
|
+
}
|
|
30
41
|
const trackedDataSource = getBlockInlineTrackedData(node) || [];
|
|
31
42
|
const targetDataTracked = trackedDataSource.find((t) => change.id === t.id);
|
|
32
|
-
const newDataTracked = trackedDataSource
|
|
43
|
+
const newDataTracked = trackedDataSource
|
|
44
|
+
.map((oldTrack) => {
|
|
33
45
|
if (targetDataTracked) {
|
|
34
46
|
if (oldTrack.id === targetDataTracked.id) {
|
|
47
|
+
if (trackedAttrs.status === CHANGE_STATUS.accepted ||
|
|
48
|
+
trackedAttrs.status === CHANGE_STATUS.rejected) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
35
51
|
return Object.assign(Object.assign({}, oldTrack), trackedAttrs);
|
|
36
52
|
}
|
|
37
53
|
return oldTrack;
|
|
38
54
|
}
|
|
39
55
|
if (oldTrack.operation === operation) {
|
|
56
|
+
if (trackedAttrs.status === CHANGE_STATUS.accepted ||
|
|
57
|
+
trackedAttrs.status === CHANGE_STATUS.rejected) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
40
60
|
return Object.assign(Object.assign({}, oldTrack), trackedAttrs);
|
|
41
61
|
}
|
|
42
62
|
return oldTrack;
|
|
43
|
-
})
|
|
44
|
-
|
|
63
|
+
})
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
tr.setNodeMarkup(change.from, undefined, Object.assign(Object.assign({}, (restoredAttrs || node.attrs)), { dataTracked: newDataTracked.length === 0 ? null : newDataTracked }), node.marks);
|
|
45
66
|
}
|
|
46
67
|
return tr;
|
|
47
68
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { closeHistory } from 'prosemirror-history';
|
|
17
|
+
import { ChangeSet } from '../ChangeSet';
|
|
18
|
+
import { CHANGE_OPERATION, CHANGE_STATUS } from '../types/change';
|
|
19
|
+
import { applyAcceptedRejectedChanges } from './applyChanges';
|
|
20
|
+
import { updateChangeAttrs } from './updateChangeAttrs';
|
|
21
|
+
export function updateChangesStatus(createdTr, changeSet, ids, status, userID, oldState) {
|
|
22
|
+
const change = changeSet.get(ids[0]);
|
|
23
|
+
if (change && status !== CHANGE_STATUS.pending) {
|
|
24
|
+
const textChanges = [];
|
|
25
|
+
const nonTextChanges = [];
|
|
26
|
+
changeSet.changes.forEach((c) => {
|
|
27
|
+
if (ids.includes(c.id)) {
|
|
28
|
+
c.dataTracked.status = status;
|
|
29
|
+
if (ChangeSet.isTextChange(c)) {
|
|
30
|
+
textChanges.push(c);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
nonTextChanges.push(c);
|
|
34
|
+
if (c.dataTracked.operation === CHANGE_OPERATION.node_split) {
|
|
35
|
+
const relatedRefChange = changeSet.changes.find((c) => c.dataTracked.operation === 'reference' && c.dataTracked.referenceId === change.id);
|
|
36
|
+
if (relatedRefChange) {
|
|
37
|
+
nonTextChanges.push(relatedRefChange);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const mapping = applyAcceptedRejectedChanges(createdTr, oldState.schema, nonTextChanges, changeSet);
|
|
44
|
+
applyAcceptedRejectedChanges(createdTr, oldState.schema, textChanges, changeSet, mapping);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const changeTime = new Date().getTime();
|
|
48
|
+
ids.forEach((changeId) => {
|
|
49
|
+
const change = changeSet === null || changeSet === void 0 ? void 0 : changeSet.get(changeId);
|
|
50
|
+
if (change) {
|
|
51
|
+
createdTr = updateChangeAttrs(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
closeHistory(createdTr);
|
|
56
|
+
}
|
package/dist/es/commands.js
CHANGED
|
@@ -29,10 +29,6 @@ export const setUserID = (userID) => (state, dispatch) => {
|
|
|
29
29
|
dispatch && dispatch(setAction(state.tr, TrackChangesAction.setUserID, userID));
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
|
-
export const applyAndRemoveChanges = () => (state, dispatch) => {
|
|
33
|
-
dispatch && dispatch(setAction(state.tr, TrackChangesAction.applyAndRemoveChanges, true));
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
32
|
export const refreshChanges = () => (state, dispatch) => {
|
|
37
33
|
dispatch && dispatch(setAction(state.tr, TrackChangesAction.refreshChanges, true));
|
|
38
34
|
return true;
|
|
@@ -64,7 +64,7 @@ export function setFragmentAsNodeSplit($pos, newTr, inserted, attrs) {
|
|
|
64
64
|
const oldDataTracked = getBlockInlineTrackedData(parent) || [];
|
|
65
65
|
newTr.setNodeMarkup(parentPos, undefined, Object.assign(Object.assign({}, parent.attrs), { dataTracked: [
|
|
66
66
|
...oldDataTracked.filter((c) => c.operation !== 'reference'),
|
|
67
|
-
Object.assign({}, addTrackIdIfDoesntExist(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: CHANGE_STATUS.
|
|
67
|
+
Object.assign({}, addTrackIdIfDoesntExist(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: CHANGE_STATUS.pending }), referenceId))),
|
|
68
68
|
] }));
|
|
69
69
|
const splitSource = oldDataTracked.find((c) => c.operation === 'reference');
|
|
70
70
|
const dataTracked = Object.assign(Object.assign({}, trackUtils.createNewSplitAttrs(Object.assign({}, attrs))), { id: referenceId });
|
package/dist/es/plugin.js
CHANGED
|
@@ -11,11 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
13
13
|
import { getAction, hasAction, setAction, TrackChangesAction } from './actions';
|
|
14
|
-
import { applyAcceptedRejectedChanges } from './changes/applyChanges';
|
|
15
14
|
import { findChanges } from './changes/findChanges';
|
|
16
15
|
import { fixInconsistentChanges } from './changes/fixInconsistentChanges';
|
|
17
|
-
import {
|
|
18
|
-
import { updateChangeAttrs } from './changes/updateChangeAttrs';
|
|
16
|
+
import { updateChangesStatus } from './changes/updateChangesStatus';
|
|
19
17
|
import { ChangeSet } from './ChangeSet';
|
|
20
18
|
import { trackTransaction } from './steps/trackTransaction';
|
|
21
19
|
import { TrackChangesStatus } from './types/track';
|
|
@@ -59,7 +57,9 @@ export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initi
|
|
|
59
57
|
return Object.assign(Object.assign({}, pluginState), { changeSet: new ChangeSet() });
|
|
60
58
|
}
|
|
61
59
|
let { changeSet } = pluginState, rest = __rest(pluginState, ["changeSet"]);
|
|
62
|
-
if (getAction(tr, TrackChangesAction.refreshChanges)
|
|
60
|
+
if (getAction(tr, TrackChangesAction.refreshChanges) ||
|
|
61
|
+
tr.getMeta('history$') ||
|
|
62
|
+
tr.getMeta('history$1')) {
|
|
63
63
|
changeSet = findChanges(newState);
|
|
64
64
|
}
|
|
65
65
|
return Object.assign({ changeSet }, rest);
|
|
@@ -89,31 +89,21 @@ export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initi
|
|
|
89
89
|
docChanged = true;
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
+
const setChangeStatuses = getAction(tr, TrackChangesAction.setChangeStatuses);
|
|
92
93
|
const skipTrackUsed = getAction(tr, TrackChangesAction.skipTrack) ||
|
|
93
94
|
(wasAppended && getAction(wasAppended, TrackChangesAction.skipTrack));
|
|
94
|
-
if (
|
|
95
|
+
if (!setChangeStatuses &&
|
|
96
|
+
tr.docChanged &&
|
|
95
97
|
!skipMetaUsed &&
|
|
96
98
|
!skipTrackUsed &&
|
|
97
|
-
!tr.getMeta('history$') &&
|
|
99
|
+
!(tr.getMeta('history$') || tr.getMeta('history$1')) &&
|
|
98
100
|
!(wasAppended && tr.getMeta('origin') === 'paragraphs')) {
|
|
99
101
|
createdTr = trackTransaction(tr, oldState, createdTr, userID);
|
|
100
102
|
}
|
|
101
103
|
docChanged = docChanged || tr.docChanged;
|
|
102
|
-
const setChangeStatuses = getAction(tr, TrackChangesAction.setChangeStatuses);
|
|
103
104
|
if (setChangeStatuses) {
|
|
104
105
|
const { status, ids } = setChangeStatuses;
|
|
105
|
-
|
|
106
|
-
ids.forEach((changeId) => {
|
|
107
|
-
const change = changeSet === null || changeSet === void 0 ? void 0 : changeSet.get(changeId);
|
|
108
|
-
if (change) {
|
|
109
|
-
createdTr = updateChangeAttrs(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
revertRejectedChanges(createdTr, oldState.schema, ids, changeSet, status);
|
|
113
|
-
}
|
|
114
|
-
else if (getAction(tr, TrackChangesAction.applyAndRemoveChanges)) {
|
|
115
|
-
const mapping = applyAcceptedRejectedChanges(createdTr, oldState.schema, changeSet.bothNodeChanges);
|
|
116
|
-
applyAcceptedRejectedChanges(createdTr, oldState.schema, changeSet.textChanges, mapping);
|
|
106
|
+
updateChangesStatus(createdTr, changeSet, ids, status, userID, oldState);
|
|
117
107
|
setAction(createdTr, TrackChangesAction.refreshChanges, true);
|
|
118
108
|
}
|
|
119
109
|
});
|
|
@@ -6,8 +6,6 @@ export declare class ChangeSet {
|
|
|
6
6
|
get invalidChanges(): (TrackedChange | IncompleteChange)[];
|
|
7
7
|
get changeTree(): TrackedChange[];
|
|
8
8
|
get pending(): TrackedChange[];
|
|
9
|
-
get accepted(): TrackedChange[];
|
|
10
|
-
get rejected(): TrackedChange[];
|
|
11
9
|
get textChanges(): TrackedChange[];
|
|
12
10
|
get nodeChanges(): TrackedChange[];
|
|
13
11
|
get nodeAttrChanges(): TrackedChange[];
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ 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
|
-
applyAndRemoveChanges = "track-changes-apply-remove-changes",
|
|
11
10
|
updateMetaNode = "track-changes-update-meta-node"
|
|
12
11
|
}
|
|
13
12
|
export type TrackChangesActionParams = {
|
|
@@ -19,7 +18,6 @@ export type TrackChangesActionParams = {
|
|
|
19
18
|
ids: string[];
|
|
20
19
|
};
|
|
21
20
|
[TrackChangesAction.refreshChanges]: boolean;
|
|
22
|
-
[TrackChangesAction.applyAndRemoveChanges]: boolean;
|
|
23
21
|
[TrackChangesAction.updateMetaNode]: boolean;
|
|
24
22
|
};
|
|
25
23
|
export declare function hasAction(tr: Transaction): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
|
2
2
|
import { Transaction } from 'prosemirror-state';
|
|
3
3
|
import { Mapping } from 'prosemirror-transform';
|
|
4
|
+
import { ChangeSet } from '../ChangeSet';
|
|
4
5
|
import { TrackedAttrs, TrackedChange } from '../types/change';
|
|
5
6
|
export declare function getUpdatedDataTracked(dataTracked: TrackedAttrs[] | null, changeId: string): TrackedAttrs[] | null;
|
|
6
|
-
export declare function applyAcceptedRejectedChanges(tr: Transaction, schema: Schema, changes: TrackedChange[], deleteMap?: Mapping): Mapping;
|
|
7
|
+
export declare function applyAcceptedRejectedChanges(tr: Transaction, schema: Schema, changes: TrackedChange[], changeSet: ChangeSet, deleteMap?: Mapping): Mapping;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
1
|
import { Transaction } from 'prosemirror-state';
|
|
3
2
|
import { ChangeSet } from '../ChangeSet';
|
|
4
|
-
import {
|
|
5
|
-
export declare function
|
|
3
|
+
import { IncompleteChange } from '../types/change';
|
|
4
|
+
export declare function revertSplitNodeChange(tr: Transaction, change: IncompleteChange, changeSet: ChangeSet): void;
|
|
5
|
+
export declare function revertWrapNodeChange(tr: Transaction, change: IncompleteChange): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
17
|
+
import { ChangeSet } from '../ChangeSet';
|
|
18
|
+
import { CHANGE_STATUS } from '../types/change';
|
|
19
|
+
export declare function updateChangesStatus(createdTr: Transaction, changeSet: ChangeSet, ids: string[], status: CHANGE_STATUS, userID: string, oldState: EditorState): void;
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ import { TrackChangesStatus } from './types/track';
|
|
|
4
4
|
export declare const setTrackingStatus: (status?: TrackChangesStatus) => Command;
|
|
5
5
|
export declare const setChangeStatuses: (status: CHANGE_STATUS, ids: string[]) => Command;
|
|
6
6
|
export declare const setUserID: (userID: string) => Command;
|
|
7
|
-
export declare const applyAndRemoveChanges: () => Command;
|
|
8
7
|
export declare const refreshChanges: () => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/track-changes-plugin",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.24-LEAN-3967.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",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"debug": "^4.3.4",
|
|
59
59
|
"prosemirror-commands": "^1.5.0",
|
|
60
60
|
"prosemirror-example-setup": "^1.2.1",
|
|
61
|
-
"prosemirror-history": "^1.
|
|
61
|
+
"prosemirror-history": "^1.4.1",
|
|
62
62
|
"prosemirror-keymap": "^1.2.0",
|
|
63
63
|
"prosemirror-model": "^1.18.3",
|
|
64
64
|
"prosemirror-schema-list": "^1.2.2",
|
package/src/styles.css
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
.ProseMirror .inserted.pending {
|
|
2
2
|
background: greenyellow;
|
|
3
3
|
}
|
|
4
|
-
.ProseMirror .inserted.accepted {
|
|
5
|
-
background: #92c7ff;
|
|
6
|
-
}
|
|
7
|
-
.ProseMirror .inserted.rejected {
|
|
8
|
-
background: #cac5c7;
|
|
9
|
-
}
|
|
10
4
|
.ProseMirror .deleted.pending {
|
|
11
5
|
background: #ffa4a4;
|
|
12
6
|
}
|
|
13
|
-
.ProseMirror .deleted.accepted {
|
|
14
|
-
background: #ffb747;
|
|
15
|
-
}
|
|
16
|
-
.ProseMirror .deleted.rejected {
|
|
17
|
-
text-decoration: none;
|
|
18
|
-
}
|