@manuscripts/track-changes-plugin 1.7.19-LEAN-3893.0 → 1.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ChangeSet.js +2 -8
- package/dist/cjs/change-steps/processChangeSteps.js +1 -5
- package/dist/cjs/changes/applyChanges.js +1 -6
- package/dist/cjs/changes/findChanges.js +0 -9
- package/dist/cjs/compute/setFragmentAsInserted.js +1 -50
- package/dist/cjs/mutate/deleteNode.js +2 -2
- package/dist/cjs/plugin.js +0 -2
- package/dist/cjs/steps/trackReplaceAroundStep.js +1 -9
- package/dist/cjs/steps/trackReplaceStep.js +2 -7
- package/dist/cjs/steps/trackTransaction.js +7 -4
- package/dist/cjs/types/change.js +0 -3
- package/dist/cjs/utils/track-utils.js +1 -39
- package/dist/es/ChangeSet.js +2 -8
- package/dist/es/change-steps/processChangeSteps.js +1 -5
- package/dist/es/changes/applyChanges.js +1 -5
- package/dist/es/changes/findChanges.js +0 -9
- package/dist/es/compute/setFragmentAsInserted.js +2 -26
- package/dist/es/mutate/deleteNode.js +2 -2
- package/dist/es/plugin.js +0 -2
- package/dist/es/steps/trackReplaceAroundStep.js +2 -10
- package/dist/es/steps/trackReplaceStep.js +3 -8
- package/dist/es/steps/trackTransaction.js +7 -4
- package/dist/es/types/change.js +0 -3
- package/dist/es/utils/track-utils.js +0 -33
- package/dist/types/ChangeSet.d.ts +1 -2
- package/dist/types/changes/applyChanges.d.ts +1 -2
- package/dist/types/compute/setFragmentAsInserted.d.ts +2 -5
- package/dist/types/steps/trackReplaceStep.d.ts +1 -1
- package/dist/types/types/change.d.ts +3 -19
- package/dist/types/types/track.d.ts +1 -8
- package/dist/types/utils/track-utils.d.ts +1 -8
- package/package.json +1 -1
- package/dist/cjs/changes/revertChange.js +0 -48
- package/dist/es/changes/revertChange.js +0 -44
- package/dist/types/changes/revertChange.d.ts +0 -5
package/dist/cjs/ChangeSet.js
CHANGED
|
@@ -95,7 +95,7 @@ class ChangeSet {
|
|
|
95
95
|
return this.changes.filter((c) => c.type === 'node-attr-change');
|
|
96
96
|
}
|
|
97
97
|
get bothNodeChanges() {
|
|
98
|
-
return this.changes.filter((c) => c.type === 'node-change' || c.type === '
|
|
98
|
+
return this.changes.filter((c) => c.type === 'node-change' || c.type === 'node-attr-change');
|
|
99
99
|
}
|
|
100
100
|
get isEmpty() {
|
|
101
101
|
return __classPrivateFieldGet(this, _ChangeSet_changes, "f").length === 0;
|
|
@@ -140,10 +140,7 @@ class ChangeSet {
|
|
|
140
140
|
}
|
|
141
141
|
static shouldDeleteChange(change) {
|
|
142
142
|
const { status, operation } = change.dataTracked;
|
|
143
|
-
return ((
|
|
144
|
-
operation === change_1.CHANGE_OPERATION.node_split ||
|
|
145
|
-
operation === change_1.CHANGE_OPERATION.wrap_with_node) &&
|
|
146
|
-
status === change_1.CHANGE_STATUS.rejected) ||
|
|
143
|
+
return ((operation === change_1.CHANGE_OPERATION.insert && status === change_1.CHANGE_STATUS.rejected) ||
|
|
147
144
|
(operation === change_1.CHANGE_OPERATION.delete && status === change_1.CHANGE_STATUS.accepted));
|
|
148
145
|
}
|
|
149
146
|
static isValidDataTracked(dataTracked = {}) {
|
|
@@ -175,9 +172,6 @@ class ChangeSet {
|
|
|
175
172
|
static isNodeAttrChange(change) {
|
|
176
173
|
return change.type === 'node-attr-change';
|
|
177
174
|
}
|
|
178
|
-
static isSplitSourceChange(change) {
|
|
179
|
-
return change.type === 'split-source';
|
|
180
|
-
}
|
|
181
175
|
}
|
|
182
176
|
exports.ChangeSet = ChangeSet;
|
|
183
177
|
_ChangeSet_changes = new WeakMap(), _ChangeSet_instances = new WeakSet(), _ChangeSet_isSameNodeChange = function _ChangeSet_isSameNodeChange(currentChange, nextChange) {
|
|
@@ -74,9 +74,6 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema) {
|
|
|
74
74
|
logger_1.log.error(`processChangeSteps: no text node found for text-change`, c);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
if (node.marks.find((m) => m.attrs.dataTracked && m.attrs.dataTracked.operation === change_1.CHANGE_OPERATION.node_split)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
77
|
const where = (0, deleteText_1.deleteTextIfInserted)(node, mapping.map(c.pos), newTr, schema, deleteAttrs, mapping.map(c.from), mapping.map(c.to));
|
|
81
78
|
const textNewestStep = newTr.steps[newTr.steps.length - 1];
|
|
82
79
|
if (step !== textNewestStep) {
|
|
@@ -131,8 +128,7 @@ function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema) {
|
|
|
131
128
|
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewUpdateAttrs(emptyAttrs, lastChangeRejected ? oldAttrs : c.node.attrs));
|
|
132
129
|
if ((JSON.stringify(oldAttrs) !== JSON.stringify(c.newAttrs) ||
|
|
133
130
|
c.node.type === c.node.type.schema.nodes.citation) &&
|
|
134
|
-
!oldDataTracked.find((d) =>
|
|
135
|
-
d.status === change_1.CHANGE_STATUS.pending)) {
|
|
131
|
+
!oldDataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.insert && d.status === change_1.CHANGE_STATUS.pending)) {
|
|
136
132
|
newDataTracked.push(newUpdate);
|
|
137
133
|
}
|
|
138
134
|
newTr.setNodeMarkup(mapping.map(c.pos), undefined, Object.assign(Object.assign({}, c.newAttrs), { dataTracked: newDataTracked.length > 0 ? newDataTracked : null }), c.node.marks);
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.applyAcceptedRejectedChanges =
|
|
14
|
+
exports.applyAcceptedRejectedChanges = void 0;
|
|
15
15
|
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
16
16
|
const ChangeSet_1 = require("../ChangeSet");
|
|
17
17
|
const deleteNode_1 = require("../mutate/deleteNode");
|
|
@@ -26,7 +26,6 @@ function getUpdatedDataTracked(dataTracked, changeId) {
|
|
|
26
26
|
const newDataTracked = dataTracked.filter((c) => c.id !== changeId);
|
|
27
27
|
return newDataTracked.length ? newDataTracked : null;
|
|
28
28
|
}
|
|
29
|
-
exports.getUpdatedDataTracked = getUpdatedDataTracked;
|
|
30
29
|
function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new prosemirror_transform_1.Mapping()) {
|
|
31
30
|
const attrsChangesLog = new Map();
|
|
32
31
|
function addAttrLog(nodeId, changeId) {
|
|
@@ -80,10 +79,6 @@ function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new prose
|
|
|
80
79
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.oldAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
81
80
|
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
82
81
|
}
|
|
83
|
-
else if (ChangeSet_1.ChangeSet.isSplitSourceChange(change)) {
|
|
84
|
-
const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: null });
|
|
85
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
86
|
-
}
|
|
87
82
|
});
|
|
88
83
|
return deleteMap;
|
|
89
84
|
}
|
|
@@ -45,15 +45,6 @@ function findChanges(state) {
|
|
|
45
45
|
oldAttrs: dataTracked.oldAttrs,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
else if (dataTracked.operation === change_1.CHANGE_OPERATION.split_source) {
|
|
49
|
-
change = {
|
|
50
|
-
id,
|
|
51
|
-
type: 'split-source',
|
|
52
|
-
from: pos,
|
|
53
|
-
to: pos + node.nodeSize,
|
|
54
|
-
dataTracked,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
48
|
else {
|
|
58
49
|
change = {
|
|
59
50
|
id,
|
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
3
|
+
exports.setFragmentAsInserted = void 0;
|
|
27
4
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
28
5
|
const change_1 = require("../types/change");
|
|
29
6
|
const logger_1 = require("../utils/logger");
|
|
30
|
-
const trackUtils = __importStar(require("../utils/track-utils"));
|
|
31
|
-
const uuidv4_1 = require("../utils/uuidv4");
|
|
32
7
|
const nodeHelpers_1 = require("./nodeHelpers");
|
|
33
8
|
function markInlineNodeChange(node, newTrackAttrs, schema) {
|
|
34
9
|
const filtered = node.marks.filter((m) => m.type !== schema.marks.tracked_insert && m.type !== schema.marks.tracked_delete);
|
|
@@ -76,27 +51,3 @@ function setFragmentAsInserted(inserted, insertAttrs, schema) {
|
|
|
76
51
|
return updatedInserted.length === 0 ? prosemirror_model_1.Fragment.empty : prosemirror_model_1.Fragment.fromArray(updatedInserted);
|
|
77
52
|
}
|
|
78
53
|
exports.setFragmentAsInserted = setFragmentAsInserted;
|
|
79
|
-
function setFragmentAsWrapChange(inserted, attrs, schema) {
|
|
80
|
-
const content = [];
|
|
81
|
-
inserted.forEach((node) => {
|
|
82
|
-
content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [(0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewWrapAttrs(attrs))] }), setFragmentAsInserted(node.content, trackUtils.createNewInsertAttrs(attrs), schema), node.marks));
|
|
83
|
-
});
|
|
84
|
-
return prosemirror_model_1.Fragment.from(content);
|
|
85
|
-
}
|
|
86
|
-
exports.setFragmentAsWrapChange = setFragmentAsWrapChange;
|
|
87
|
-
function setFragmentAsNodeSplit($pos, newTr, inserted, attrs) {
|
|
88
|
-
const lastChild = inserted.lastChild;
|
|
89
|
-
const referenceId = (0, uuidv4_1.uuidv4)();
|
|
90
|
-
const parentPos = $pos.before($pos.depth);
|
|
91
|
-
const parent = $pos.node($pos.depth);
|
|
92
|
-
const oldDataTracked = (0, nodeHelpers_1.getBlockInlineTrackedData)(parent) || [];
|
|
93
|
-
newTr.setNodeMarkup(parentPos, undefined, Object.assign(Object.assign({}, parent.attrs), { dataTracked: [
|
|
94
|
-
...oldDataTracked.filter((c) => c.operation !== 'split_source'),
|
|
95
|
-
Object.assign({}, (0, nodeHelpers_1.addTrackIdIfDoesntExist)(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: change_1.CHANGE_STATUS.rejected }), referenceId))),
|
|
96
|
-
] }));
|
|
97
|
-
const splitSource = oldDataTracked.find((c) => c.operation === 'split_source');
|
|
98
|
-
const dataTracked = Object.assign(Object.assign({}, trackUtils.createNewSplitAttrs(Object.assign({}, attrs))), { id: referenceId });
|
|
99
|
-
inserted = inserted.replaceChild(inserted.childCount - 1, lastChild.type.create(Object.assign(Object.assign({}, lastChild.attrs), { dataTracked: splitSource ? [dataTracked, splitSource] : [dataTracked] }), lastChild.content));
|
|
100
|
-
return inserted;
|
|
101
|
-
}
|
|
102
|
-
exports.setFragmentAsNodeSplit = setFragmentAsNodeSplit;
|
|
@@ -20,9 +20,9 @@ function deleteNode(node, pos, tr) {
|
|
|
20
20
|
exports.deleteNode = deleteNode;
|
|
21
21
|
function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
|
|
22
22
|
const dataTracked = (0, nodeHelpers_1.getBlockInlineTrackedData)(node);
|
|
23
|
-
const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) =>
|
|
23
|
+
const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.insert &&
|
|
24
24
|
(d.status === change_1.CHANGE_STATUS.pending || d.status === change_1.CHANGE_STATUS.accepted));
|
|
25
|
-
const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.set_node_attributes
|
|
25
|
+
const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === change_1.CHANGE_OPERATION.set_node_attributes);
|
|
26
26
|
if (inserted) {
|
|
27
27
|
return deleteNode(node, pos, newTr);
|
|
28
28
|
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -17,7 +17,6 @@ const actions_1 = require("./actions");
|
|
|
17
17
|
const applyChanges_1 = require("./changes/applyChanges");
|
|
18
18
|
const findChanges_1 = require("./changes/findChanges");
|
|
19
19
|
const fixInconsistentChanges_1 = require("./changes/fixInconsistentChanges");
|
|
20
|
-
const revertChange_1 = require("./changes/revertChange");
|
|
21
20
|
const updateChangeAttrs_1 = require("./changes/updateChangeAttrs");
|
|
22
21
|
const ChangeSet_1 = require("./ChangeSet");
|
|
23
22
|
const trackTransaction_1 = require("./steps/trackTransaction");
|
|
@@ -112,7 +111,6 @@ const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initialStatu
|
|
|
112
111
|
createdTr = (0, updateChangeAttrs_1.updateChangeAttrs)(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
|
-
(0, revertChange_1.revertRejectedChanges)(createdTr, oldState.schema, ids, changeSet, status);
|
|
116
114
|
}
|
|
117
115
|
else if ((0, actions_1.getAction)(tr, actions_1.TrackChangesAction.applyAndRemoveChanges)) {
|
|
118
116
|
const mapping = (0, applyChanges_1.applyAcceptedRejectedChanges)(createdTr, oldState.schema, changeSet.bothNodeChanges);
|
|
@@ -30,7 +30,6 @@ const setFragmentAsInserted_1 = require("../compute/setFragmentAsInserted");
|
|
|
30
30
|
const deleteAndMergeSplitNodes_1 = require("../mutate/deleteAndMergeSplitNodes");
|
|
31
31
|
const logger_1 = require("../utils/logger");
|
|
32
32
|
const trackUtils = __importStar(require("../utils/track-utils"));
|
|
33
|
-
const track_utils_1 = require("../utils/track-utils");
|
|
34
33
|
function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, currentStepDoc) {
|
|
35
34
|
logger_1.log.info('###### ReplaceAroundStep ######');
|
|
36
35
|
const { from, to, gapFrom, gapTo, insert, slice, structure, } = step;
|
|
@@ -43,13 +42,6 @@ function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, currentStepDoc
|
|
|
43
42
|
const gap = currentStepDoc.slice(gapFrom, gapTo);
|
|
44
43
|
logger_1.log.info('RETAINED GAP CONTENT', gap);
|
|
45
44
|
const { sliceWasSplit, newSliceContent, steps: deleteSteps, } = (0, deleteAndMergeSplitNodes_1.deleteAndMergeSplitNodes)(from, to, { start: gapFrom, end: gapTo }, newTr.doc, newTr, oldState.schema, attrs, slice);
|
|
46
|
-
let fragment;
|
|
47
|
-
if ((0, track_utils_1.isWrapStep)(step)) {
|
|
48
|
-
fragment = (0, setFragmentAsInserted_1.setFragmentAsWrapChange)(newSliceContent, attrs, oldState.schema);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
fragment = (0, setFragmentAsInserted_1.setFragmentAsInserted)(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema);
|
|
52
|
-
}
|
|
53
45
|
const steps = deleteSteps;
|
|
54
46
|
logger_1.log.info('TR: new steps after applying delete', [...newTr.steps]);
|
|
55
47
|
logger_1.log.info('DELETE STEPS: ', deleteSteps);
|
|
@@ -59,7 +51,7 @@ function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, currentStepDoc
|
|
|
59
51
|
logger_1.log.info('newSliceContent', newSliceContent);
|
|
60
52
|
const openStart = slice.openStart !== slice.openEnd || newSliceContent.size === 0 ? 0 : slice.openStart;
|
|
61
53
|
const openEnd = slice.openStart !== slice.openEnd || newSliceContent.size === 0 ? 0 : slice.openEnd;
|
|
62
|
-
let insertedSlice = new prosemirror_model_1.Slice(
|
|
54
|
+
let insertedSlice = new prosemirror_model_1.Slice((0, setFragmentAsInserted_1.setFragmentAsInserted)(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema), openStart, openEnd);
|
|
63
55
|
if (gap.size > 0 || tr.getMeta(actions_1.TrackChangesAction.updateMetaNode)) {
|
|
64
56
|
logger_1.log.info('insertedSlice before inserted gap', insertedSlice);
|
|
65
57
|
insertedSlice = insertedSlice.insertAt(insertedSlice.size === 0 ? 0 : insert, gap.content);
|
|
@@ -29,8 +29,7 @@ const setFragmentAsInserted_1 = require("../compute/setFragmentAsInserted");
|
|
|
29
29
|
const deleteAndMergeSplitNodes_1 = require("../mutate/deleteAndMergeSplitNodes");
|
|
30
30
|
const logger_1 = require("../utils/logger");
|
|
31
31
|
const trackUtils = __importStar(require("../utils/track-utils"));
|
|
32
|
-
|
|
33
|
-
function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepDoc, tr) {
|
|
32
|
+
function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepDoc) {
|
|
34
33
|
logger_1.log.info('###### ReplaceStep ######');
|
|
35
34
|
let selectionPos = 0;
|
|
36
35
|
const changeSteps = [];
|
|
@@ -61,10 +60,6 @@ function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepD
|
|
|
61
60
|
const textWasDeleted = !!changeSteps.length;
|
|
62
61
|
if (!backSpacedText && newSliceContent.size > 0) {
|
|
63
62
|
logger_1.log.info('newSliceContent', newSliceContent);
|
|
64
|
-
let fragment = (0, setFragmentAsInserted_1.setFragmentAsInserted)(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema);
|
|
65
|
-
if ((0, track_utils_1.isSplitStep)(step, oldState.selection, tr.getMeta('uiEvent'))) {
|
|
66
|
-
fragment = (0, setFragmentAsInserted_1.setFragmentAsNodeSplit)(newTr.doc.resolve(step.from), newTr, fragment, attrs);
|
|
67
|
-
}
|
|
68
63
|
const openStart = slice.openStart !== slice.openEnd ? 0 : slice.openStart;
|
|
69
64
|
const openEnd = slice.openStart !== slice.openEnd ? 0 : slice.openEnd;
|
|
70
65
|
changeSteps.push({
|
|
@@ -72,7 +67,7 @@ function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepD
|
|
|
72
67
|
from: textWasDeleted ? fromB : toA,
|
|
73
68
|
to: textWasDeleted ? toB - 1 : toA,
|
|
74
69
|
sliceWasSplit,
|
|
75
|
-
slice: new prosemirror_model_1.Slice(
|
|
70
|
+
slice: new prosemirror_model_1.Slice((0, setFragmentAsInserted_1.setFragmentAsInserted)(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema), openStart, openEnd),
|
|
76
71
|
});
|
|
77
72
|
}
|
|
78
73
|
else {
|
|
@@ -50,18 +50,21 @@ function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
52
|
const invertedStep = step.invert(tr.docs[i]);
|
|
53
|
+
const isDelete = step.from !== step.to && step.slice.content.size < invertedStep.slice.content.size;
|
|
53
54
|
const thisStepMapping = tr.mapping.slice(i + 1);
|
|
54
55
|
const newStep = new prosemirror_transform_1.ReplaceStep(thisStepMapping.map(invertedStep.from), thisStepMapping.map(invertedStep.to), invertedStep.slice);
|
|
55
|
-
const stepResult = newTr.maybeStep(newStep);
|
|
56
|
-
let [steps, startPos] = (0, trackReplaceStep_1.trackReplaceStep)(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i]
|
|
56
|
+
const stepResult = newTr.maybeStep(isDelete ? invertedStep : newStep);
|
|
57
|
+
let [steps, startPos] = (0, trackReplaceStep_1.trackReplaceStep)(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i]);
|
|
57
58
|
if (steps.length === 1) {
|
|
58
59
|
const step = steps[0];
|
|
59
60
|
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]))) {
|
|
60
61
|
continue;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
if (!isDelete) {
|
|
65
|
+
startPos = thisStepMapping.map(startPos);
|
|
66
|
+
steps = (0, mapChangeStep_1.mapChangeSteps)(steps, thisStepMapping);
|
|
67
|
+
}
|
|
65
68
|
logger_1.log.info('CHANGES: ', steps);
|
|
66
69
|
const deleted = steps.filter((s) => s.type !== 'insert-slice');
|
|
67
70
|
const inserted = steps.filter((s) => s.type === 'insert-slice');
|
package/dist/cjs/types/change.js
CHANGED
|
@@ -6,9 +6,6 @@ var CHANGE_OPERATION;
|
|
|
6
6
|
CHANGE_OPERATION["insert"] = "insert";
|
|
7
7
|
CHANGE_OPERATION["delete"] = "delete";
|
|
8
8
|
CHANGE_OPERATION["set_node_attributes"] = "set_attrs";
|
|
9
|
-
CHANGE_OPERATION["node_split"] = "node_split";
|
|
10
|
-
CHANGE_OPERATION["split_source"] = "split_source";
|
|
11
|
-
CHANGE_OPERATION["wrap_with_node"] = "wrap_with_node";
|
|
12
9
|
})(CHANGE_OPERATION = exports.CHANGE_OPERATION || (exports.CHANGE_OPERATION = {}));
|
|
13
10
|
var CHANGE_STATUS;
|
|
14
11
|
(function (CHANGE_STATUS) {
|
|
@@ -11,24 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.createNewUpdateAttrs = exports.createNewDeleteAttrs = exports.createNewInsertAttrs = void 0;
|
|
15
15
|
const change_1 = require("../types/change");
|
|
16
16
|
function createNewInsertAttrs(attrs) {
|
|
17
17
|
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.insert });
|
|
18
18
|
}
|
|
19
19
|
exports.createNewInsertAttrs = createNewInsertAttrs;
|
|
20
|
-
function createNewWrapAttrs(attrs) {
|
|
21
|
-
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.wrap_with_node });
|
|
22
|
-
}
|
|
23
|
-
exports.createNewWrapAttrs = createNewWrapAttrs;
|
|
24
|
-
function createNewSplitAttrs(attrs) {
|
|
25
|
-
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.node_split });
|
|
26
|
-
}
|
|
27
|
-
exports.createNewSplitAttrs = createNewSplitAttrs;
|
|
28
|
-
function createNewSplitSourceAttrs(attrs, id) {
|
|
29
|
-
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.split_source, referenceId: id });
|
|
30
|
-
}
|
|
31
|
-
exports.createNewSplitSourceAttrs = createNewSplitSourceAttrs;
|
|
32
20
|
function createNewDeleteAttrs(attrs) {
|
|
33
21
|
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.delete });
|
|
34
22
|
}
|
|
@@ -38,29 +26,3 @@ function createNewUpdateAttrs(attrs, oldAttrs) {
|
|
|
38
26
|
return Object.assign(Object.assign({}, attrs), { operation: change_1.CHANGE_OPERATION.set_node_attributes, oldAttrs: JSON.parse(JSON.stringify(restAttrs)) });
|
|
39
27
|
}
|
|
40
28
|
exports.createNewUpdateAttrs = createNewUpdateAttrs;
|
|
41
|
-
const isSplitStep = (step, selection, uiEvent) => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const { from, to, slice } = step;
|
|
44
|
-
if (from !== to ||
|
|
45
|
-
slice.content.childCount < 2 ||
|
|
46
|
-
(((_a = slice.content.firstChild) === null || _a === void 0 ? void 0 : _a.isInline) && ((_b = slice.content.lastChild) === null || _b === void 0 ? void 0 : _b.isInline))) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
if (uiEvent === 'paste') {
|
|
50
|
-
const { $anchor: { parentOffset: startOffset }, $head: { parentOffset: endOffset }, $from, } = selection;
|
|
51
|
-
const parentSize = $from.node().content.size;
|
|
52
|
-
return !((startOffset === 0 && endOffset === 0) ||
|
|
53
|
-
(startOffset === parentSize && endOffset === parentSize));
|
|
54
|
-
}
|
|
55
|
-
const { content: { firstChild, lastChild }, openStart, openEnd, } = slice;
|
|
56
|
-
return (openStart === openEnd &&
|
|
57
|
-
firstChild.type === lastChild.type &&
|
|
58
|
-
firstChild.inlineContent &&
|
|
59
|
-
lastChild.inlineContent);
|
|
60
|
-
};
|
|
61
|
-
exports.isSplitStep = isSplitStep;
|
|
62
|
-
const isWrapStep = (step) => step.from === step.gapFrom &&
|
|
63
|
-
step.to === step.gapTo &&
|
|
64
|
-
step.slice.openStart === 0 &&
|
|
65
|
-
step.slice.openEnd === 0;
|
|
66
|
-
exports.isWrapStep = isWrapStep;
|
package/dist/es/ChangeSet.js
CHANGED
|
@@ -92,7 +92,7 @@ export class ChangeSet {
|
|
|
92
92
|
return this.changes.filter((c) => c.type === 'node-attr-change');
|
|
93
93
|
}
|
|
94
94
|
get bothNodeChanges() {
|
|
95
|
-
return this.changes.filter((c) => c.type === 'node-change' || c.type === '
|
|
95
|
+
return this.changes.filter((c) => c.type === 'node-change' || c.type === 'node-attr-change');
|
|
96
96
|
}
|
|
97
97
|
get isEmpty() {
|
|
98
98
|
return __classPrivateFieldGet(this, _ChangeSet_changes, "f").length === 0;
|
|
@@ -137,10 +137,7 @@ export class ChangeSet {
|
|
|
137
137
|
}
|
|
138
138
|
static shouldDeleteChange(change) {
|
|
139
139
|
const { status, operation } = change.dataTracked;
|
|
140
|
-
return ((
|
|
141
|
-
operation === CHANGE_OPERATION.node_split ||
|
|
142
|
-
operation === CHANGE_OPERATION.wrap_with_node) &&
|
|
143
|
-
status === CHANGE_STATUS.rejected) ||
|
|
140
|
+
return ((operation === CHANGE_OPERATION.insert && status === CHANGE_STATUS.rejected) ||
|
|
144
141
|
(operation === CHANGE_OPERATION.delete && status === CHANGE_STATUS.accepted));
|
|
145
142
|
}
|
|
146
143
|
static isValidDataTracked(dataTracked = {}) {
|
|
@@ -172,9 +169,6 @@ export class ChangeSet {
|
|
|
172
169
|
static isNodeAttrChange(change) {
|
|
173
170
|
return change.type === 'node-attr-change';
|
|
174
171
|
}
|
|
175
|
-
static isSplitSourceChange(change) {
|
|
176
|
-
return change.type === 'split-source';
|
|
177
|
-
}
|
|
178
172
|
}
|
|
179
173
|
_ChangeSet_changes = new WeakMap(), _ChangeSet_instances = new WeakSet(), _ChangeSet_isSameNodeChange = function _ChangeSet_isSameNodeChange(currentChange, nextChange) {
|
|
180
174
|
return currentChange.from === nextChange.from && currentChange.to === nextChange.to;
|
|
@@ -48,9 +48,6 @@ export function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema)
|
|
|
48
48
|
log.error(`processChangeSteps: no text node found for text-change`, c);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
if (node.marks.find((m) => m.attrs.dataTracked && m.attrs.dataTracked.operation === CHANGE_OPERATION.node_split)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
51
|
const where = deleteTextIfInserted(node, mapping.map(c.pos), newTr, schema, deleteAttrs, mapping.map(c.from), mapping.map(c.to));
|
|
55
52
|
const textNewestStep = newTr.steps[newTr.steps.length - 1];
|
|
56
53
|
if (step !== textNewestStep) {
|
|
@@ -105,8 +102,7 @@ export function processChangeSteps(changes, startPos, newTr, emptyAttrs, schema)
|
|
|
105
102
|
? Object.assign(Object.assign({}, oldUpdate), { updatedAt: emptyAttrs.updatedAt }) : addTrackIdIfDoesntExist(trackUtils.createNewUpdateAttrs(emptyAttrs, lastChangeRejected ? oldAttrs : c.node.attrs));
|
|
106
103
|
if ((JSON.stringify(oldAttrs) !== JSON.stringify(c.newAttrs) ||
|
|
107
104
|
c.node.type === c.node.type.schema.nodes.citation) &&
|
|
108
|
-
!oldDataTracked.find((d) =>
|
|
109
|
-
d.status === CHANGE_STATUS.pending)) {
|
|
105
|
+
!oldDataTracked.find((d) => d.operation === CHANGE_OPERATION.insert && d.status === CHANGE_STATUS.pending)) {
|
|
110
106
|
newDataTracked.push(newUpdate);
|
|
111
107
|
}
|
|
112
108
|
newTr.setNodeMarkup(mapping.map(c.pos), undefined, Object.assign(Object.assign({}, c.newAttrs), { dataTracked: newDataTracked.length > 0 ? newDataTracked : null }), c.node.marks);
|
|
@@ -16,7 +16,7 @@ import { mergeNode } from '../mutate/mergeNode';
|
|
|
16
16
|
import { CHANGE_STATUS } from '../types/change';
|
|
17
17
|
import { log } from '../utils/logger';
|
|
18
18
|
import { updateChangeChildrenAttributes } from './updateChangeAttrs';
|
|
19
|
-
|
|
19
|
+
function getUpdatedDataTracked(dataTracked, changeId) {
|
|
20
20
|
if (!dataTracked) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -76,10 +76,6 @@ export function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = ne
|
|
|
76
76
|
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, change.oldAttrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
77
77
|
addAttrLog(node.attrs.id, change.dataTracked.id);
|
|
78
78
|
}
|
|
79
|
-
else if (ChangeSet.isSplitSourceChange(change)) {
|
|
80
|
-
const attrs = Object.assign(Object.assign({}, node.attrs), { dataTracked: null });
|
|
81
|
-
tr.setNodeMarkup(from, undefined, Object.assign(Object.assign({}, attrs), { dataTracked: getUpdatedDataTracked(node.attrs.dataTracked, change.id) }), node.marks);
|
|
82
|
-
}
|
|
83
79
|
});
|
|
84
80
|
return deleteMap;
|
|
85
81
|
}
|
|
@@ -42,15 +42,6 @@ export function findChanges(state) {
|
|
|
42
42
|
oldAttrs: dataTracked.oldAttrs,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
else if (dataTracked.operation === CHANGE_OPERATION.split_source) {
|
|
46
|
-
change = {
|
|
47
|
-
id,
|
|
48
|
-
type: 'split-source',
|
|
49
|
-
from: pos,
|
|
50
|
-
to: pos + node.nodeSize,
|
|
51
|
-
dataTracked,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
45
|
else {
|
|
55
46
|
change = {
|
|
56
47
|
id,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Fragment } from 'prosemirror-model';
|
|
2
|
-
import { CHANGE_OPERATION
|
|
2
|
+
import { CHANGE_OPERATION } from '../types/change';
|
|
3
3
|
import { log } from '../utils/logger';
|
|
4
|
-
import
|
|
5
|
-
import { uuidv4 } from '../utils/uuidv4';
|
|
6
|
-
import { addTrackIdIfDoesntExist, equalMarks, getBlockInlineTrackedData, getTextNodeTrackedMarkData, } from './nodeHelpers';
|
|
4
|
+
import { addTrackIdIfDoesntExist, equalMarks, getTextNodeTrackedMarkData } from './nodeHelpers';
|
|
7
5
|
function markInlineNodeChange(node, newTrackAttrs, schema) {
|
|
8
6
|
const filtered = node.marks.filter((m) => m.type !== schema.marks.tracked_insert && m.type !== schema.marks.tracked_delete);
|
|
9
7
|
const mark = newTrackAttrs.operation === CHANGE_OPERATION.insert
|
|
@@ -49,25 +47,3 @@ export function setFragmentAsInserted(inserted, insertAttrs, schema) {
|
|
|
49
47
|
const updatedInserted = loopContentAndMergeText(inserted, insertAttrs, schema);
|
|
50
48
|
return updatedInserted.length === 0 ? Fragment.empty : Fragment.fromArray(updatedInserted);
|
|
51
49
|
}
|
|
52
|
-
export function setFragmentAsWrapChange(inserted, attrs, schema) {
|
|
53
|
-
const content = [];
|
|
54
|
-
inserted.forEach((node) => {
|
|
55
|
-
content.push(node.type.create(Object.assign(Object.assign({}, node.attrs), { dataTracked: [addTrackIdIfDoesntExist(trackUtils.createNewWrapAttrs(attrs))] }), setFragmentAsInserted(node.content, trackUtils.createNewInsertAttrs(attrs), schema), node.marks));
|
|
56
|
-
});
|
|
57
|
-
return Fragment.from(content);
|
|
58
|
-
}
|
|
59
|
-
export function setFragmentAsNodeSplit($pos, newTr, inserted, attrs) {
|
|
60
|
-
const lastChild = inserted.lastChild;
|
|
61
|
-
const referenceId = uuidv4();
|
|
62
|
-
const parentPos = $pos.before($pos.depth);
|
|
63
|
-
const parent = $pos.node($pos.depth);
|
|
64
|
-
const oldDataTracked = getBlockInlineTrackedData(parent) || [];
|
|
65
|
-
newTr.setNodeMarkup(parentPos, undefined, Object.assign(Object.assign({}, parent.attrs), { dataTracked: [
|
|
66
|
-
...oldDataTracked.filter((c) => c.operation !== 'split_source'),
|
|
67
|
-
Object.assign({}, addTrackIdIfDoesntExist(trackUtils.createNewSplitSourceAttrs(Object.assign(Object.assign({}, attrs), { status: CHANGE_STATUS.rejected }), referenceId))),
|
|
68
|
-
] }));
|
|
69
|
-
const splitSource = oldDataTracked.find((c) => c.operation === 'split_source');
|
|
70
|
-
const dataTracked = Object.assign(Object.assign({}, trackUtils.createNewSplitAttrs(Object.assign({}, attrs))), { id: referenceId });
|
|
71
|
-
inserted = inserted.replaceChild(inserted.childCount - 1, lastChild.type.create(Object.assign(Object.assign({}, lastChild.attrs), { dataTracked: splitSource ? [dataTracked, splitSource] : [dataTracked] }), lastChild.content));
|
|
72
|
-
return inserted;
|
|
73
|
-
}
|
|
@@ -16,9 +16,9 @@ export function deleteNode(node, pos, tr) {
|
|
|
16
16
|
}
|
|
17
17
|
export function deleteOrSetNodeDeleted(node, pos, newTr, deleteAttrs) {
|
|
18
18
|
const dataTracked = getBlockInlineTrackedData(node);
|
|
19
|
-
const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) =>
|
|
19
|
+
const inserted = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === CHANGE_OPERATION.insert &&
|
|
20
20
|
(d.status === CHANGE_STATUS.pending || d.status === CHANGE_STATUS.accepted));
|
|
21
|
-
const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === CHANGE_OPERATION.set_node_attributes
|
|
21
|
+
const updated = dataTracked === null || dataTracked === void 0 ? void 0 : dataTracked.find((d) => d.operation === CHANGE_OPERATION.set_node_attributes);
|
|
22
22
|
if (inserted) {
|
|
23
23
|
return deleteNode(node, pos, newTr);
|
|
24
24
|
}
|
package/dist/es/plugin.js
CHANGED
|
@@ -14,7 +14,6 @@ import { getAction, hasAction, setAction, TrackChangesAction } from './actions';
|
|
|
14
14
|
import { applyAcceptedRejectedChanges } from './changes/applyChanges';
|
|
15
15
|
import { findChanges } from './changes/findChanges';
|
|
16
16
|
import { fixInconsistentChanges } from './changes/fixInconsistentChanges';
|
|
17
|
-
import { revertRejectedChanges } from './changes/revertChange';
|
|
18
17
|
import { updateChangeAttrs } from './changes/updateChangeAttrs';
|
|
19
18
|
import { ChangeSet } from './ChangeSet';
|
|
20
19
|
import { trackTransaction } from './steps/trackTransaction';
|
|
@@ -109,7 +108,6 @@ export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initi
|
|
|
109
108
|
createdTr = updateChangeAttrs(createdTr, change, Object.assign(Object.assign({}, change.dataTracked), { status, statusUpdateAt: changeTime, reviewedByID: userID }), oldState.schema);
|
|
110
109
|
}
|
|
111
110
|
});
|
|
112
|
-
revertRejectedChanges(createdTr, oldState.schema, ids, changeSet, status);
|
|
113
111
|
}
|
|
114
112
|
else if (getAction(tr, TrackChangesAction.applyAndRemoveChanges)) {
|
|
115
113
|
const mapping = applyAcceptedRejectedChanges(createdTr, oldState.schema, changeSet.bothNodeChanges);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Slice } from 'prosemirror-model';
|
|
2
2
|
import { TrackChangesAction } from '../actions';
|
|
3
|
-
import { setFragmentAsInserted
|
|
3
|
+
import { setFragmentAsInserted } from '../compute/setFragmentAsInserted';
|
|
4
4
|
import { deleteAndMergeSplitNodes } from '../mutate/deleteAndMergeSplitNodes';
|
|
5
5
|
import { log } from '../utils/logger';
|
|
6
6
|
import * as trackUtils from '../utils/track-utils';
|
|
7
|
-
import { isWrapStep } from '../utils/track-utils';
|
|
8
7
|
export function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, currentStepDoc) {
|
|
9
8
|
log.info('###### ReplaceAroundStep ######');
|
|
10
9
|
const { from, to, gapFrom, gapTo, insert, slice, structure, } = step;
|
|
@@ -17,13 +16,6 @@ export function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, current
|
|
|
17
16
|
const gap = currentStepDoc.slice(gapFrom, gapTo);
|
|
18
17
|
log.info('RETAINED GAP CONTENT', gap);
|
|
19
18
|
const { sliceWasSplit, newSliceContent, steps: deleteSteps, } = deleteAndMergeSplitNodes(from, to, { start: gapFrom, end: gapTo }, newTr.doc, newTr, oldState.schema, attrs, slice);
|
|
20
|
-
let fragment;
|
|
21
|
-
if (isWrapStep(step)) {
|
|
22
|
-
fragment = setFragmentAsWrapChange(newSliceContent, attrs, oldState.schema);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
fragment = setFragmentAsInserted(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema);
|
|
26
|
-
}
|
|
27
19
|
const steps = deleteSteps;
|
|
28
20
|
log.info('TR: new steps after applying delete', [...newTr.steps]);
|
|
29
21
|
log.info('DELETE STEPS: ', deleteSteps);
|
|
@@ -33,7 +25,7 @@ export function trackReplaceAroundStep(step, oldState, tr, newTr, attrs, current
|
|
|
33
25
|
log.info('newSliceContent', newSliceContent);
|
|
34
26
|
const openStart = slice.openStart !== slice.openEnd || newSliceContent.size === 0 ? 0 : slice.openStart;
|
|
35
27
|
const openEnd = slice.openStart !== slice.openEnd || newSliceContent.size === 0 ? 0 : slice.openEnd;
|
|
36
|
-
let insertedSlice = new Slice(
|
|
28
|
+
let insertedSlice = new Slice(setFragmentAsInserted(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema), openStart, openEnd);
|
|
37
29
|
if (gap.size > 0 || tr.getMeta(TrackChangesAction.updateMetaNode)) {
|
|
38
30
|
log.info('insertedSlice before inserted gap', insertedSlice);
|
|
39
31
|
insertedSlice = insertedSlice.insertAt(insertedSlice.size === 0 ? 0 : insert, gap.content);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Slice } from 'prosemirror-model';
|
|
2
|
-
import { setFragmentAsInserted
|
|
2
|
+
import { setFragmentAsInserted } from '../compute/setFragmentAsInserted';
|
|
3
3
|
import { deleteAndMergeSplitNodes } from '../mutate/deleteAndMergeSplitNodes';
|
|
4
4
|
import { log } from '../utils/logger';
|
|
5
5
|
import * as trackUtils from '../utils/track-utils';
|
|
6
|
-
|
|
7
|
-
export function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepDoc, tr) {
|
|
6
|
+
export function trackReplaceStep(step, oldState, newTr, attrs, stepResult, currentStepDoc) {
|
|
8
7
|
log.info('###### ReplaceStep ######');
|
|
9
8
|
let selectionPos = 0;
|
|
10
9
|
const changeSteps = [];
|
|
@@ -35,10 +34,6 @@ export function trackReplaceStep(step, oldState, newTr, attrs, stepResult, curre
|
|
|
35
34
|
const textWasDeleted = !!changeSteps.length;
|
|
36
35
|
if (!backSpacedText && newSliceContent.size > 0) {
|
|
37
36
|
log.info('newSliceContent', newSliceContent);
|
|
38
|
-
let fragment = setFragmentAsInserted(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema);
|
|
39
|
-
if (isSplitStep(step, oldState.selection, tr.getMeta('uiEvent'))) {
|
|
40
|
-
fragment = setFragmentAsNodeSplit(newTr.doc.resolve(step.from), newTr, fragment, attrs);
|
|
41
|
-
}
|
|
42
37
|
const openStart = slice.openStart !== slice.openEnd ? 0 : slice.openStart;
|
|
43
38
|
const openEnd = slice.openStart !== slice.openEnd ? 0 : slice.openEnd;
|
|
44
39
|
changeSteps.push({
|
|
@@ -46,7 +41,7 @@ export function trackReplaceStep(step, oldState, newTr, attrs, stepResult, curre
|
|
|
46
41
|
from: textWasDeleted ? fromB : toA,
|
|
47
42
|
to: textWasDeleted ? toB - 1 : toA,
|
|
48
43
|
sliceWasSplit,
|
|
49
|
-
slice: new Slice(
|
|
44
|
+
slice: new Slice(setFragmentAsInserted(newSliceContent, trackUtils.createNewInsertAttrs(attrs), oldState.schema), openStart, openEnd),
|
|
50
45
|
});
|
|
51
46
|
}
|
|
52
47
|
else {
|
|
@@ -44,18 +44,21 @@ export function trackTransaction(tr, oldState, newTr, authorID) {
|
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
const invertedStep = step.invert(tr.docs[i]);
|
|
47
|
+
const isDelete = step.from !== step.to && step.slice.content.size < invertedStep.slice.content.size;
|
|
47
48
|
const thisStepMapping = tr.mapping.slice(i + 1);
|
|
48
49
|
const newStep = new ReplaceStep(thisStepMapping.map(invertedStep.from), thisStepMapping.map(invertedStep.to), invertedStep.slice);
|
|
49
|
-
const stepResult = newTr.maybeStep(newStep);
|
|
50
|
-
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i]
|
|
50
|
+
const stepResult = newTr.maybeStep(isDelete ? invertedStep : newStep);
|
|
51
|
+
let [steps, startPos] = trackReplaceStep(step, oldState, newTr, emptyAttrs, stepResult, tr.docs[i]);
|
|
51
52
|
if (steps.length === 1) {
|
|
52
53
|
const step = steps[0];
|
|
53
54
|
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]))) {
|
|
54
55
|
continue;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
if (!isDelete) {
|
|
59
|
+
startPos = thisStepMapping.map(startPos);
|
|
60
|
+
steps = mapChangeSteps(steps, thisStepMapping);
|
|
61
|
+
}
|
|
59
62
|
log.info('CHANGES: ', steps);
|
|
60
63
|
const deleted = steps.filter((s) => s.type !== 'insert-slice');
|
|
61
64
|
const inserted = steps.filter((s) => s.type === 'insert-slice');
|
package/dist/es/types/change.js
CHANGED
|
@@ -3,9 +3,6 @@ export var CHANGE_OPERATION;
|
|
|
3
3
|
CHANGE_OPERATION["insert"] = "insert";
|
|
4
4
|
CHANGE_OPERATION["delete"] = "delete";
|
|
5
5
|
CHANGE_OPERATION["set_node_attributes"] = "set_attrs";
|
|
6
|
-
CHANGE_OPERATION["node_split"] = "node_split";
|
|
7
|
-
CHANGE_OPERATION["split_source"] = "split_source";
|
|
8
|
-
CHANGE_OPERATION["wrap_with_node"] = "wrap_with_node";
|
|
9
6
|
})(CHANGE_OPERATION || (CHANGE_OPERATION = {}));
|
|
10
7
|
export var CHANGE_STATUS;
|
|
11
8
|
(function (CHANGE_STATUS) {
|
|
@@ -13,15 +13,6 @@ import { CHANGE_OPERATION } from '../types/change';
|
|
|
13
13
|
export function createNewInsertAttrs(attrs) {
|
|
14
14
|
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.insert });
|
|
15
15
|
}
|
|
16
|
-
export function createNewWrapAttrs(attrs) {
|
|
17
|
-
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.wrap_with_node });
|
|
18
|
-
}
|
|
19
|
-
export function createNewSplitAttrs(attrs) {
|
|
20
|
-
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.node_split });
|
|
21
|
-
}
|
|
22
|
-
export function createNewSplitSourceAttrs(attrs, id) {
|
|
23
|
-
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.split_source, referenceId: id });
|
|
24
|
-
}
|
|
25
16
|
export function createNewDeleteAttrs(attrs) {
|
|
26
17
|
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.delete });
|
|
27
18
|
}
|
|
@@ -29,27 +20,3 @@ export function createNewUpdateAttrs(attrs, oldAttrs) {
|
|
|
29
20
|
const { dataTracked } = oldAttrs, restAttrs = __rest(oldAttrs, ["dataTracked"]);
|
|
30
21
|
return Object.assign(Object.assign({}, attrs), { operation: CHANGE_OPERATION.set_node_attributes, oldAttrs: JSON.parse(JSON.stringify(restAttrs)) });
|
|
31
22
|
}
|
|
32
|
-
export const isSplitStep = (step, selection, uiEvent) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const { from, to, slice } = step;
|
|
35
|
-
if (from !== to ||
|
|
36
|
-
slice.content.childCount < 2 ||
|
|
37
|
-
(((_a = slice.content.firstChild) === null || _a === void 0 ? void 0 : _a.isInline) && ((_b = slice.content.lastChild) === null || _b === void 0 ? void 0 : _b.isInline))) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
if (uiEvent === 'paste') {
|
|
41
|
-
const { $anchor: { parentOffset: startOffset }, $head: { parentOffset: endOffset }, $from, } = selection;
|
|
42
|
-
const parentSize = $from.node().content.size;
|
|
43
|
-
return !((startOffset === 0 && endOffset === 0) ||
|
|
44
|
-
(startOffset === parentSize && endOffset === parentSize));
|
|
45
|
-
}
|
|
46
|
-
const { content: { firstChild, lastChild }, openStart, openEnd, } = slice;
|
|
47
|
-
return (openStart === openEnd &&
|
|
48
|
-
firstChild.type === lastChild.type &&
|
|
49
|
-
firstChild.inlineContent &&
|
|
50
|
-
lastChild.inlineContent);
|
|
51
|
-
};
|
|
52
|
-
export const isWrapStep = (step) => step.from === step.gapFrom &&
|
|
53
|
-
step.to === step.gapTo &&
|
|
54
|
-
step.slice.openStart === 0 &&
|
|
55
|
-
step.slice.openEnd === 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IncompleteChange, NodeAttrChange, NodeChange,
|
|
1
|
+
import { IncompleteChange, NodeAttrChange, NodeChange, TextChange, TrackedAttrs, TrackedChange } from './types/change';
|
|
2
2
|
export declare class ChangeSet {
|
|
3
3
|
#private;
|
|
4
4
|
constructor(changes?: (TrackedChange | IncompleteChange)[]);
|
|
@@ -29,5 +29,4 @@ export declare class ChangeSet {
|
|
|
29
29
|
static isTextChange(change: TrackedChange): change is TextChange;
|
|
30
30
|
static isNodeChange(change: TrackedChange): change is NodeChange;
|
|
31
31
|
static isNodeAttrChange(change: TrackedChange): change is NodeAttrChange;
|
|
32
|
-
static isSplitSourceChange(change: TrackedChange): change is SplitSourceChange;
|
|
33
32
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
|
2
2
|
import { Transaction } from 'prosemirror-state';
|
|
3
3
|
import { Mapping } from 'prosemirror-transform';
|
|
4
|
-
import {
|
|
5
|
-
export declare function getUpdatedDataTracked(dataTracked: TrackedAttrs[] | null, changeId: string): TrackedAttrs[] | null;
|
|
4
|
+
import { TrackedChange } from '../types/change';
|
|
6
5
|
export declare function applyAcceptedRejectedChanges(tr: Transaction, schema: Schema, changes: TrackedChange[], deleteMap?: Mapping): Mapping;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { Fragment,
|
|
2
|
-
import {
|
|
3
|
-
import { NewEmptyAttrs, NewInsertAttrs } from '../types/track';
|
|
1
|
+
import { Fragment, Schema } from 'prosemirror-model';
|
|
2
|
+
import { NewInsertAttrs } from '../types/track';
|
|
4
3
|
export declare function setFragmentAsInserted(inserted: Fragment, insertAttrs: NewInsertAttrs, schema: Schema): Fragment;
|
|
5
|
-
export declare function setFragmentAsWrapChange(inserted: Fragment, attrs: NewEmptyAttrs, schema: Schema): Fragment;
|
|
6
|
-
export declare function setFragmentAsNodeSplit($pos: ResolvedPos, newTr: Transaction, inserted: Fragment, attrs: NewEmptyAttrs): Fragment;
|
|
@@ -3,4 +3,4 @@ import type { EditorState, Transaction } from 'prosemirror-state';
|
|
|
3
3
|
import { ReplaceStep, StepResult } from 'prosemirror-transform';
|
|
4
4
|
import { ChangeStep } from '../types/step';
|
|
5
5
|
import { NewEmptyAttrs } from '../types/track';
|
|
6
|
-
export declare function trackReplaceStep(step: ReplaceStep, oldState: EditorState, newTr: Transaction, attrs: NewEmptyAttrs, stepResult: StepResult, currentStepDoc: PMNode
|
|
6
|
+
export declare function trackReplaceStep(step: ReplaceStep, oldState: EditorState, newTr: Transaction, attrs: NewEmptyAttrs, stepResult: StepResult, currentStepDoc: PMNode): [ChangeStep[], number];
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export declare enum CHANGE_OPERATION {
|
|
2
2
|
insert = "insert",
|
|
3
3
|
delete = "delete",
|
|
4
|
-
set_node_attributes = "set_attrs"
|
|
5
|
-
node_split = "node_split",
|
|
6
|
-
split_source = "split_source",
|
|
7
|
-
wrap_with_node = "wrap_with_node"
|
|
4
|
+
set_node_attributes = "set_attrs"
|
|
8
5
|
}
|
|
9
6
|
export declare enum CHANGE_STATUS {
|
|
10
7
|
accepted = "accepted",
|
|
@@ -25,17 +22,7 @@ export type UpdateAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
|
|
|
25
22
|
operation: CHANGE_OPERATION.set_node_attributes;
|
|
26
23
|
oldAttrs: Record<string, any>;
|
|
27
24
|
};
|
|
28
|
-
export type
|
|
29
|
-
operation: CHANGE_OPERATION.wrap_with_node;
|
|
30
|
-
};
|
|
31
|
-
export type NodeSplitAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
|
|
32
|
-
operation: CHANGE_OPERATION.node_split;
|
|
33
|
-
};
|
|
34
|
-
export type SplitSourceAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
|
|
35
|
-
operation: CHANGE_OPERATION.split_source;
|
|
36
|
-
referenceId: string;
|
|
37
|
-
};
|
|
38
|
-
export type TrackedAttrs = InsertDeleteAttrs | UpdateAttrs | WrapAttrs | NodeSplitAttrs | SplitSourceAttrs;
|
|
25
|
+
export type TrackedAttrs = InsertDeleteAttrs | UpdateAttrs;
|
|
39
26
|
type Change = {
|
|
40
27
|
id: string;
|
|
41
28
|
from: number;
|
|
@@ -61,13 +48,10 @@ export type WrapChange = Change & {
|
|
|
61
48
|
type: 'wrap-change';
|
|
62
49
|
wrapperNode: string;
|
|
63
50
|
};
|
|
64
|
-
export type SplitSourceChange = Change & {
|
|
65
|
-
type: 'split-source';
|
|
66
|
-
};
|
|
67
51
|
export type MarkChange = Change & {
|
|
68
52
|
type: 'mark-change';
|
|
69
53
|
};
|
|
70
|
-
export type TrackedChange = TextChange | NodeChange | NodeAttrChange | WrapChange |
|
|
54
|
+
export type TrackedChange = TextChange | NodeChange | NodeAttrChange | WrapChange | MarkChange;
|
|
71
55
|
export type PartialChange<T extends TrackedChange> = Omit<T, 'dataTracked'> & {
|
|
72
56
|
dataTracked: Partial<TrackedAttrs>;
|
|
73
57
|
};
|
|
@@ -14,7 +14,7 @@ export interface TrackChangesState {
|
|
|
14
14
|
}
|
|
15
15
|
export type NewEmptyAttrs = Omit<TrackedAttrs, 'id' | 'operation'>;
|
|
16
16
|
export type NewInsertAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
|
|
17
|
-
operation: CHANGE_OPERATION.insert
|
|
17
|
+
operation: CHANGE_OPERATION.insert;
|
|
18
18
|
};
|
|
19
19
|
export type NewDeleteAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
|
|
20
20
|
operation: CHANGE_OPERATION.delete;
|
|
@@ -23,13 +23,6 @@ export type NewUpdateAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
|
|
|
23
23
|
operation: CHANGE_OPERATION.set_node_attributes;
|
|
24
24
|
oldAttrs: Record<string, any>;
|
|
25
25
|
};
|
|
26
|
-
export type NewSplitNodeAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
|
|
27
|
-
operation: CHANGE_OPERATION.node_split;
|
|
28
|
-
};
|
|
29
|
-
export type NewSplitSourceAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
|
|
30
|
-
operation: CHANGE_OPERATION.split_source;
|
|
31
|
-
referenceId: string;
|
|
32
|
-
};
|
|
33
26
|
export type NewTrackedAttrs = NewInsertAttrs | NewDeleteAttrs | NewUpdateAttrs;
|
|
34
27
|
export declare enum TrackChangesStatus {
|
|
35
28
|
enabled = "enabled",
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform';
|
|
3
|
-
import { NewDeleteAttrs, NewEmptyAttrs, NewInsertAttrs, NewSplitNodeAttrs, NewSplitSourceAttrs, NewUpdateAttrs } from '../types/track';
|
|
1
|
+
import { NewDeleteAttrs, NewEmptyAttrs, NewInsertAttrs, NewUpdateAttrs } from '../types/track';
|
|
4
2
|
export declare function createNewInsertAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
|
|
5
|
-
export declare function createNewWrapAttrs(attrs: NewEmptyAttrs): NewInsertAttrs;
|
|
6
|
-
export declare function createNewSplitAttrs(attrs: NewEmptyAttrs): NewSplitNodeAttrs;
|
|
7
|
-
export declare function createNewSplitSourceAttrs(attrs: NewEmptyAttrs, id: string): NewSplitSourceAttrs;
|
|
8
3
|
export declare function createNewDeleteAttrs(attrs: NewEmptyAttrs): NewDeleteAttrs;
|
|
9
4
|
export declare function createNewUpdateAttrs(attrs: NewEmptyAttrs, oldAttrs: Record<string, any>): NewUpdateAttrs;
|
|
10
|
-
export declare const isSplitStep: (step: ReplaceStep, selection: Selection, uiEvent: string) => boolean;
|
|
11
|
-
export declare const isWrapStep: (step: ReplaceAroundStep) => boolean;
|
package/package.json
CHANGED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.revertRejectedChanges = void 0;
|
|
4
|
-
const prosemirror_model_1 = require("prosemirror-model");
|
|
5
|
-
const nodeHelpers_1 = require("../compute/nodeHelpers");
|
|
6
|
-
const change_1 = require("../types/change");
|
|
7
|
-
const applyChanges_1 = require("./applyChanges");
|
|
8
|
-
function revertSplitNodeChange(tr, change, changeSet) {
|
|
9
|
-
let sourceChange = changeSet.changes.find((c) => c.dataTracked.operation === 'split_source' && c.dataTracked.referenceId === change.id);
|
|
10
|
-
const node = tr.doc.nodeAt(change.from);
|
|
11
|
-
tr.replaceWith(change.from, change.to, prosemirror_model_1.Fragment.empty);
|
|
12
|
-
tr.replaceWith(sourceChange.to - 1, sourceChange.to, node.content);
|
|
13
|
-
const childSource = changeSet.changes.find((c) => c.from === change.from && c.dataTracked.operation === 'split_source');
|
|
14
|
-
if (childSource) {
|
|
15
|
-
const node = tr.doc.nodeAt(sourceChange.from);
|
|
16
|
-
const dataTracked = (0, nodeHelpers_1.getBlockInlineTrackedData)(node).map((c) => c.operation === 'split_source' ? childSource.dataTracked : c);
|
|
17
|
-
tr.setNodeMarkup(sourceChange.from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked }), node.marks);
|
|
18
|
-
}
|
|
19
|
-
const deleteChange = changeSet.changes.find((c) => c.dataTracked.operation == 'delete' && c.from === sourceChange.from);
|
|
20
|
-
if (deleteChange) {
|
|
21
|
-
const node = tr.doc.nodeAt(deleteChange.from);
|
|
22
|
-
tr.setNodeMarkup(deleteChange.from, undefined, (0, applyChanges_1.getUpdatedDataTracked)(node.attrs.dataTracked, deleteChange.id));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function revertWrapNodeChange(tr, change) {
|
|
26
|
-
let content = prosemirror_model_1.Fragment.from();
|
|
27
|
-
const node = tr.doc.nodeAt(change.from);
|
|
28
|
-
node.content.forEach((node) => {
|
|
29
|
-
content = content.append(node.content);
|
|
30
|
-
});
|
|
31
|
-
tr.replaceWith(change.from, change.to, prosemirror_model_1.Fragment.empty);
|
|
32
|
-
tr.insert(tr.mapping.map(change.to), content);
|
|
33
|
-
}
|
|
34
|
-
function revertRejectedChanges(tr, schema, ids, changeSet, status) {
|
|
35
|
-
if (status !== change_1.CHANGE_STATUS.rejected) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
ids.forEach((id) => {
|
|
39
|
-
const change = changeSet.get(id);
|
|
40
|
-
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.node_split) {
|
|
41
|
-
revertSplitNodeChange(tr, change, changeSet);
|
|
42
|
-
}
|
|
43
|
-
if (change.dataTracked.operation === change_1.CHANGE_OPERATION.wrap_with_node) {
|
|
44
|
-
revertWrapNodeChange(tr, change);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
exports.revertRejectedChanges = revertRejectedChanges;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Fragment } from 'prosemirror-model';
|
|
2
|
-
import { getBlockInlineTrackedData } from '../compute/nodeHelpers';
|
|
3
|
-
import { CHANGE_OPERATION, CHANGE_STATUS } from '../types/change';
|
|
4
|
-
import { getUpdatedDataTracked } from './applyChanges';
|
|
5
|
-
function revertSplitNodeChange(tr, change, changeSet) {
|
|
6
|
-
let sourceChange = changeSet.changes.find((c) => c.dataTracked.operation === 'split_source' && c.dataTracked.referenceId === change.id);
|
|
7
|
-
const node = tr.doc.nodeAt(change.from);
|
|
8
|
-
tr.replaceWith(change.from, change.to, Fragment.empty);
|
|
9
|
-
tr.replaceWith(sourceChange.to - 1, sourceChange.to, node.content);
|
|
10
|
-
const childSource = changeSet.changes.find((c) => c.from === change.from && c.dataTracked.operation === 'split_source');
|
|
11
|
-
if (childSource) {
|
|
12
|
-
const node = tr.doc.nodeAt(sourceChange.from);
|
|
13
|
-
const dataTracked = getBlockInlineTrackedData(node).map((c) => c.operation === 'split_source' ? childSource.dataTracked : c);
|
|
14
|
-
tr.setNodeMarkup(sourceChange.from, undefined, Object.assign(Object.assign({}, node.attrs), { dataTracked }), node.marks);
|
|
15
|
-
}
|
|
16
|
-
const deleteChange = changeSet.changes.find((c) => c.dataTracked.operation == 'delete' && c.from === sourceChange.from);
|
|
17
|
-
if (deleteChange) {
|
|
18
|
-
const node = tr.doc.nodeAt(deleteChange.from);
|
|
19
|
-
tr.setNodeMarkup(deleteChange.from, undefined, getUpdatedDataTracked(node.attrs.dataTracked, deleteChange.id));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function revertWrapNodeChange(tr, change) {
|
|
23
|
-
let content = Fragment.from();
|
|
24
|
-
const node = tr.doc.nodeAt(change.from);
|
|
25
|
-
node.content.forEach((node) => {
|
|
26
|
-
content = content.append(node.content);
|
|
27
|
-
});
|
|
28
|
-
tr.replaceWith(change.from, change.to, Fragment.empty);
|
|
29
|
-
tr.insert(tr.mapping.map(change.to), content);
|
|
30
|
-
}
|
|
31
|
-
export function revertRejectedChanges(tr, schema, ids, changeSet, status) {
|
|
32
|
-
if (status !== CHANGE_STATUS.rejected) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
ids.forEach((id) => {
|
|
36
|
-
const change = changeSet.get(id);
|
|
37
|
-
if (change.dataTracked.operation === CHANGE_OPERATION.node_split) {
|
|
38
|
-
revertSplitNodeChange(tr, change, changeSet);
|
|
39
|
-
}
|
|
40
|
-
if (change.dataTracked.operation === CHANGE_OPERATION.wrap_with_node) {
|
|
41
|
-
revertWrapNodeChange(tr, change);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
|
-
import { Transaction } from 'prosemirror-state';
|
|
3
|
-
import { ChangeSet } from '../ChangeSet';
|
|
4
|
-
import { CHANGE_STATUS } from '../types/change';
|
|
5
|
-
export declare function revertRejectedChanges(tr: Transaction, schema: Schema, ids: string[], changeSet: ChangeSet, status: CHANGE_STATUS): void;
|