@atlaskit/editor-plugin-track-changes 2.6.1 → 2.6.3

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,21 @@
1
1
  # @atlaskit/editor-plugin-track-changes
2
2
 
3
+ ## 2.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8700ce859da07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8700ce859da07) -
8
+ [EDITOR-1249] Added inline node support for show diff
9
+ - Updated dependencies
10
+
11
+ ## 2.6.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [`22f298149afc8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/22f298149afc8) -
16
+ EDITOR-1342: Fix missing mapping causing some steps to break the typeahead.
17
+ - Updated dependencies
18
+
3
19
  ## 2.6.1
4
20
 
5
21
  ### 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 || tr.getMeta('isRemote')) {
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 || tr.getMeta('isRemote')) {
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 || tr.getMeta('isRemote')) {
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.1",
3
+ "version": "2.6.3",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,17 +31,17 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/button": "^23.3.0",
34
+ "@atlaskit/button": "^23.4.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.1",
37
+ "@atlaskit/editor-plugin-show-diff": "0.1.3",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/icon-lab": "^5.5.0",
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
  },
43
43
  "peerDependencies": {
44
- "@atlaskit/editor-common": "^107.23.0",
44
+ "@atlaskit/editor-common": "^107.25.0",
45
45
  "react": "^18.2.0"
46
46
  },
47
47
  "techstack": {