@atlaskit/editor-plugin-track-changes 2.7.14 → 3.0.1
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
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-track-changes
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2d7e230a59028`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d7e230a59028) -
|
|
8
|
+
[NO-ISSUE] Hot fix for when attributes gets updated, it is recognised as a docchange and hence
|
|
9
|
+
decorations should be applied
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.0.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.7.14
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -22,7 +22,11 @@ var trackChangesPluginKey = exports.trackChangesPluginKey = new _state.PluginKey
|
|
|
22
22
|
// Exported for test purposes
|
|
23
23
|
var getBaselineFromSteps = exports.getBaselineFromSteps = function getBaselineFromSteps(doc, steps) {
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
// Filter out AttrStep's since attribute changes shouldn't affect baseline content comparison
|
|
26
|
+
var contentSteps = steps.filter(function (step) {
|
|
27
|
+
return !(step.step instanceof _transform.AttrStep);
|
|
28
|
+
});
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(contentSteps.slice().reverse()),
|
|
26
30
|
_step;
|
|
27
31
|
try {
|
|
28
32
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -73,7 +77,7 @@ var createTrackChangesPlugin = exports.createTrackChangesPlugin = function creat
|
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
79
|
var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
|
|
76
|
-
return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep || step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep;
|
|
80
|
+
return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep || step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep || step instanceof _transform.AttrStep;
|
|
77
81
|
});
|
|
78
82
|
if (!isDocChanged || tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
|
|
79
83
|
// If the transaction is remote, we need to map the steps to the current document
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
+
import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep, AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { filterSteps } from './filterSteps';
|
|
5
5
|
import { InvertableStep } from './invertableStep';
|
|
6
6
|
import { TOGGLE_TRACK_CHANGES_ACTION as ACTION } from './types';
|
|
@@ -8,7 +8,9 @@ export const trackChangesPluginKey = new PluginKey('trackChangesPlugin');
|
|
|
8
8
|
// Exported for test purposes
|
|
9
9
|
export const getBaselineFromSteps = (doc, steps) => {
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
// Filter out AttrStep's since attribute changes shouldn't affect baseline content comparison
|
|
12
|
+
const contentSteps = steps.filter(step => !(step.step instanceof AttrStep));
|
|
13
|
+
for (const step of contentSteps.slice().reverse()) {
|
|
12
14
|
const result = step.inverted.apply(doc);
|
|
13
15
|
if (result.failed === null && result.doc) {
|
|
14
16
|
doc = result.doc;
|
|
@@ -51,7 +53,7 @@ export const createTrackChangesPlugin = api => {
|
|
|
51
53
|
shouldChangesBeDisplayed: !state.shouldChangesBeDisplayed
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep);
|
|
56
|
+
const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof AttrStep);
|
|
55
57
|
if (!isDocChanged || tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
|
|
56
58
|
// If the transaction is remote, we need to map the steps to the current document
|
|
57
59
|
return {
|
|
@@ -7,7 +7,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
7
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
10
|
+
import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep, AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
11
11
|
import { filterSteps } from './filterSteps';
|
|
12
12
|
import { InvertableStep } from './invertableStep';
|
|
13
13
|
import { TOGGLE_TRACK_CHANGES_ACTION as ACTION } from './types';
|
|
@@ -15,7 +15,11 @@ export var trackChangesPluginKey = new PluginKey('trackChangesPlugin');
|
|
|
15
15
|
// Exported for test purposes
|
|
16
16
|
export var getBaselineFromSteps = function getBaselineFromSteps(doc, steps) {
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
// Filter out AttrStep's since attribute changes shouldn't affect baseline content comparison
|
|
19
|
+
var contentSteps = steps.filter(function (step) {
|
|
20
|
+
return !(step.step instanceof AttrStep);
|
|
21
|
+
});
|
|
22
|
+
var _iterator = _createForOfIteratorHelper(contentSteps.slice().reverse()),
|
|
19
23
|
_step;
|
|
20
24
|
try {
|
|
21
25
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -66,7 +70,7 @@ export var createTrackChangesPlugin = function createTrackChangesPlugin(api) {
|
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
|
|
69
|
-
return step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep;
|
|
73
|
+
return step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof AttrStep;
|
|
70
74
|
});
|
|
71
75
|
if (!isDocChanged || tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
|
|
72
76
|
// If the transaction is remote, we need to map the steps to the current document
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-track-changes",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/button": "^23.4.0",
|
|
32
|
-
"@atlaskit/editor-plugin-history": "
|
|
33
|
-
"@atlaskit/editor-plugin-primary-toolbar": "^
|
|
34
|
-
"@atlaskit/editor-plugin-show-diff": "0.
|
|
35
|
-
"@atlaskit/editor-plugin-toolbar": "^0.
|
|
32
|
+
"@atlaskit/editor-plugin-history": "4.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-show-diff": "1.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-toolbar": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
37
37
|
"@atlaskit/editor-toolbar": "^0.6.0",
|
|
38
38
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
39
39
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^12.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/editor-common": "^
|
|
45
|
+
"@atlaskit/editor-common": "^108.0.0",
|
|
46
46
|
"react": "^18.2.0"
|
|
47
47
|
},
|
|
48
48
|
"techstack": {
|