@manuscripts/track-changes-plugin 1.7.5-LEAN-3278 → 1.7.6
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.
|
@@ -23,7 +23,6 @@ function getUpdatedDataTracked(dataTracked, changeId) {
|
|
|
23
23
|
if (!dataTracked) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
|
-
console.log(dataTracked);
|
|
27
26
|
const newDataTracked = dataTracked.filter((c) => c.id !== changeId);
|
|
28
27
|
return newDataTracked.length ? newDataTracked : null;
|
|
29
28
|
}
|
|
@@ -33,6 +32,7 @@ function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = new prose
|
|
|
33
32
|
const arr = attrsChangesLog.get(nodeId) || attrsChangesLog.set(nodeId, []).get(nodeId);
|
|
34
33
|
arr.push(changeId);
|
|
35
34
|
}
|
|
35
|
+
changes.sort((c1, c2) => c1.dataTracked.updatedAt - c2.dataTracked.updatedAt);
|
|
36
36
|
changes.forEach((change) => {
|
|
37
37
|
const { pos: from, deleted } = deleteMap.mapResult(change.from), node = tr.doc.nodeAt(from), noChangeNeeded = deleted || !ChangeSet_1.ChangeSet.shouldDeleteChange(change);
|
|
38
38
|
if (!node) {
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -23,7 +23,7 @@ const trackTransaction_1 = require("./steps/trackTransaction");
|
|
|
23
23
|
const track_1 = require("./types/track");
|
|
24
24
|
const logger_1 = require("./utils/logger");
|
|
25
25
|
exports.trackChangesPluginKey = new prosemirror_state_1.PluginKey('track-changes');
|
|
26
|
-
const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous'
|
|
26
|
+
const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous' }) => {
|
|
27
27
|
const { userID, debug, skipTrsWithMetas = [] } = opts;
|
|
28
28
|
let editorView;
|
|
29
29
|
if (debug) {
|
|
@@ -40,7 +40,7 @@ const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initialStatu
|
|
|
40
40
|
state: {
|
|
41
41
|
init(_config, state) {
|
|
42
42
|
return {
|
|
43
|
-
status:
|
|
43
|
+
status: track_1.TrackChangesStatus.enabled,
|
|
44
44
|
userID,
|
|
45
45
|
changeSet: (0, findChanges_1.findChanges)(state),
|
|
46
46
|
};
|
|
@@ -82,12 +82,6 @@ const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initialStatu
|
|
|
82
82
|
trs.forEach((tr) => {
|
|
83
83
|
const wasAppended = tr.getMeta('appendedTransaction');
|
|
84
84
|
const skipMetaUsed = skipTrsWithMetas.some((m) => tr.getMeta(m) || (wasAppended === null || wasAppended === void 0 ? void 0 : wasAppended.getMeta(m)));
|
|
85
|
-
const collabRebased = tr.getMeta('rebased');
|
|
86
|
-
if (collabRebased !== undefined) {
|
|
87
|
-
(0, actions_1.setAction)(createdTr, actions_1.TrackChangesAction.refreshChanges, true);
|
|
88
|
-
docChanged = true;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
85
|
const skipTrackUsed = (0, actions_1.getAction)(tr, actions_1.TrackChangesAction.skipTrack) ||
|
|
92
86
|
(wasAppended && (0, actions_1.getAction)(wasAppended, actions_1.TrackChangesAction.skipTrack));
|
|
93
87
|
if (tr.docChanged &&
|
|
@@ -20,7 +20,6 @@ function getUpdatedDataTracked(dataTracked, changeId) {
|
|
|
20
20
|
if (!dataTracked) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
console.log(dataTracked);
|
|
24
23
|
const newDataTracked = dataTracked.filter((c) => c.id !== changeId);
|
|
25
24
|
return newDataTracked.length ? newDataTracked : null;
|
|
26
25
|
}
|
|
@@ -30,6 +29,7 @@ export function applyAcceptedRejectedChanges(tr, schema, changes, deleteMap = ne
|
|
|
30
29
|
const arr = attrsChangesLog.get(nodeId) || attrsChangesLog.set(nodeId, []).get(nodeId);
|
|
31
30
|
arr.push(changeId);
|
|
32
31
|
}
|
|
32
|
+
changes.sort((c1, c2) => c1.dataTracked.updatedAt - c2.dataTracked.updatedAt);
|
|
33
33
|
changes.forEach((change) => {
|
|
34
34
|
const { pos: from, deleted } = deleteMap.mapResult(change.from), node = tr.doc.nodeAt(from), noChangeNeeded = deleted || !ChangeSet.shouldDeleteChange(change);
|
|
35
35
|
if (!node) {
|
package/dist/es/plugin.js
CHANGED
|
@@ -20,7 +20,7 @@ import { trackTransaction } from './steps/trackTransaction';
|
|
|
20
20
|
import { TrackChangesStatus } from './types/track';
|
|
21
21
|
import { enableDebug, log } from './utils/logger';
|
|
22
22
|
export const trackChangesPluginKey = new PluginKey('track-changes');
|
|
23
|
-
export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous'
|
|
23
|
+
export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous' }) => {
|
|
24
24
|
const { userID, debug, skipTrsWithMetas = [] } = opts;
|
|
25
25
|
let editorView;
|
|
26
26
|
if (debug) {
|
|
@@ -37,7 +37,7 @@ export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initi
|
|
|
37
37
|
state: {
|
|
38
38
|
init(_config, state) {
|
|
39
39
|
return {
|
|
40
|
-
status:
|
|
40
|
+
status: TrackChangesStatus.enabled,
|
|
41
41
|
userID,
|
|
42
42
|
changeSet: findChanges(state),
|
|
43
43
|
};
|
|
@@ -79,12 +79,6 @@ export const trackChangesPlugin = (opts = { userID: 'anonymous:Anonymous', initi
|
|
|
79
79
|
trs.forEach((tr) => {
|
|
80
80
|
const wasAppended = tr.getMeta('appendedTransaction');
|
|
81
81
|
const skipMetaUsed = skipTrsWithMetas.some((m) => tr.getMeta(m) || (wasAppended === null || wasAppended === void 0 ? void 0 : wasAppended.getMeta(m)));
|
|
82
|
-
const collabRebased = tr.getMeta('rebased');
|
|
83
|
-
if (collabRebased !== undefined) {
|
|
84
|
-
setAction(createdTr, TrackChangesAction.refreshChanges, true);
|
|
85
|
-
docChanged = true;
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
82
|
const skipTrackUsed = getAction(tr, TrackChangesAction.skipTrack) ||
|
|
89
83
|
(wasAppended && getAction(wasAppended, TrackChangesAction.skipTrack));
|
|
90
84
|
if (tr.docChanged &&
|
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.6",
|
|
4
4
|
"author": "Atypon Systems LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/Atypon-OpenSource/manuscripts-track-changes-plugin",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@manuscripts/eslint-config": "^0.5.1",
|
|
29
|
-
"@manuscripts/transform": "
|
|
29
|
+
"@manuscripts/transform": "2.1.1",
|
|
30
30
|
"@types/debug": "^4.1.7",
|
|
31
31
|
"@types/jest": "27.5.1",
|
|
32
32
|
"@types/node": "^18.7.18",
|