@atlaskit/editor-plugin-track-changes 2.6.1 → 2.6.2
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/CHANGELOG.md +8 -0
- package/dist/cjs/pm-plugins/main.js +16 -1
- package/dist/es2019/pm-plugins/main.js +15 -1
- package/dist/esm/pm-plugins/main.js +16 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-track-changes
|
|
2
2
|
|
|
3
|
+
## 2.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`22f298149afc8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22f298149afc8) -
|
|
8
|
+
EDITOR-1342: Fix missing mapping causing some steps to break the typeahead.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 2.6.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -70,10 +70,25 @@ var createTrackChangesPlugin = exports.createTrackChangesPlugin = function creat
|
|
|
70
70
|
var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
|
|
71
71
|
return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep || step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep;
|
|
72
72
|
});
|
|
73
|
-
if (!isDocChanged
|
|
73
|
+
if (!isDocChanged) {
|
|
74
74
|
// If no document changes, return the old changeSet
|
|
75
75
|
return state;
|
|
76
76
|
}
|
|
77
|
+
if (tr.getMeta('isRemote')) {
|
|
78
|
+
// If the transaction is remote, we need to map the steps to the current document
|
|
79
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
80
|
+
steps: state.steps.map(function (s) {
|
|
81
|
+
var newStep = s.step.map(tr.mapping);
|
|
82
|
+
var newInvertedStep = s.inverted.map(tr.mapping);
|
|
83
|
+
if (newStep && newInvertedStep) {
|
|
84
|
+
return new _invertableStep.InvertableStep(newStep, newInvertedStep, s.allocation);
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}).filter(function (s) {
|
|
88
|
+
return !!s;
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
}
|
|
77
92
|
|
|
78
93
|
// For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
|
|
79
94
|
if (tr.getMeta('addToHistory') === false) {
|
|
@@ -47,10 +47,24 @@ export const createTrackChangesPlugin = api => {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep);
|
|
50
|
-
if (!isDocChanged
|
|
50
|
+
if (!isDocChanged) {
|
|
51
51
|
// If no document changes, return the old changeSet
|
|
52
52
|
return state;
|
|
53
53
|
}
|
|
54
|
+
if (tr.getMeta('isRemote')) {
|
|
55
|
+
// If the transaction is remote, we need to map the steps to the current document
|
|
56
|
+
return {
|
|
57
|
+
...state,
|
|
58
|
+
steps: state.steps.map(s => {
|
|
59
|
+
const newStep = s.step.map(tr.mapping);
|
|
60
|
+
const newInvertedStep = s.inverted.map(tr.mapping);
|
|
61
|
+
if (newStep && newInvertedStep) {
|
|
62
|
+
return new InvertableStep(newStep, newInvertedStep, s.allocation);
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}).filter(s => !!s)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
54
68
|
|
|
55
69
|
// For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
|
|
56
70
|
if (tr.getMeta('addToHistory') === false) {
|
|
@@ -63,10 +63,25 @@ export var createTrackChangesPlugin = function createTrackChangesPlugin(api) {
|
|
|
63
63
|
var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
|
|
64
64
|
return step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep;
|
|
65
65
|
});
|
|
66
|
-
if (!isDocChanged
|
|
66
|
+
if (!isDocChanged) {
|
|
67
67
|
// If no document changes, return the old changeSet
|
|
68
68
|
return state;
|
|
69
69
|
}
|
|
70
|
+
if (tr.getMeta('isRemote')) {
|
|
71
|
+
// If the transaction is remote, we need to map the steps to the current document
|
|
72
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
73
|
+
steps: state.steps.map(function (s) {
|
|
74
|
+
var newStep = s.step.map(tr.mapping);
|
|
75
|
+
var newInvertedStep = s.inverted.map(tr.mapping);
|
|
76
|
+
if (newStep && newInvertedStep) {
|
|
77
|
+
return new InvertableStep(newStep, newInvertedStep, s.allocation);
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}).filter(function (s) {
|
|
81
|
+
return !!s;
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
70
85
|
|
|
71
86
|
// For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
|
|
72
87
|
if (tr.getMeta('addToHistory') === false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-track-changes",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@atlaskit/button": "^23.3.0",
|
|
35
35
|
"@atlaskit/editor-plugin-history": "3.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
37
|
-
"@atlaskit/editor-plugin-show-diff": "0.1.
|
|
37
|
+
"@atlaskit/editor-plugin-show-diff": "0.1.2",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
-
"@atlaskit/icon-lab": "^5.
|
|
39
|
+
"@atlaskit/icon-lab": "^5.6.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
42
42
|
},
|