@atlaskit/editor-plugin-track-changes 2.6.0 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
11
+ ## 2.6.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`941fdc429d140`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/941fdc429d140) -
16
+ Show formatting changes in the diff
17
+ - Updated dependencies
18
+
3
19
  ## 2.6.0
4
20
 
5
21
  ### Minor Changes
@@ -0,0 +1,44 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.volt.json",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-track-changes/app",
6
+ "rootDir": "../",
7
+ "composite": true
8
+ },
9
+ "include": [
10
+ "../src/**/*.ts",
11
+ "../src/**/*.tsx"
12
+ ],
13
+ "exclude": [
14
+ "../src/**/__tests__/*",
15
+ "../src/**/*.test.*",
16
+ "../src/**/test.*",
17
+ "../src/**/examples.*",
18
+ "../src/**/examples/*",
19
+ "../src/**/examples/**/*",
20
+ "../src/**/*.stories.*",
21
+ "../src/**/stories/*",
22
+ "../src/**/stories/**/*"
23
+ ],
24
+ "references": [
25
+ {
26
+ "path": "../../../design-system/button/afm-volt/tsconfig.json"
27
+ },
28
+ {
29
+ "path": "../../editor-plugin-history/afm-volt/tsconfig.json"
30
+ },
31
+ {
32
+ "path": "../../editor-plugin-primary-toolbar/afm-volt/tsconfig.json"
33
+ },
34
+ {
35
+ "path": "../../editor-plugin-show-diff/afm-volt/tsconfig.json"
36
+ },
37
+ {
38
+ "path": "../../../design-system/icon-lab/afm-volt/tsconfig.json"
39
+ },
40
+ {
41
+ "path": "../../editor-common/afm-volt/tsconfig.json"
42
+ }
43
+ ]
44
+ }
@@ -68,12 +68,27 @@ var createTrackChangesPlugin = exports.createTrackChangesPlugin = function creat
68
68
  });
69
69
  }
70
70
  var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
71
- return step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep;
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) {
@@ -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 } from '@atlaskit/editor-prosemirror/transform';
3
+ import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep } 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';
@@ -46,11 +46,25 @@ export const createTrackChangesPlugin = api => {
46
46
  shouldChangesBeDisplayed: !state.shouldChangesBeDisplayed
47
47
  };
48
48
  }
49
- const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep);
50
- if (!isDocChanged || tr.getMeta('isRemote')) {
49
+ const isDocChanged = tr.docChanged && tr.steps.some(step => step instanceof ReplaceStep || step instanceof ReplaceAroundStep || step instanceof AddMarkStep || step instanceof RemoveMarkStep);
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) {
@@ -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 } from '@atlaskit/editor-prosemirror/transform';
10
+ import { ReplaceAroundStep, ReplaceStep, AddMarkStep, RemoveMarkStep } 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';
@@ -61,12 +61,27 @@ export var createTrackChangesPlugin = function createTrackChangesPlugin(api) {
61
61
  });
62
62
  }
63
63
  var isDocChanged = tr.docChanged && tr.steps.some(function (step) {
64
- return step instanceof ReplaceStep || step instanceof ReplaceAroundStep;
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.0",
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,14 +34,14 @@
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.0",
37
+ "@atlaskit/editor-plugin-show-diff": "0.1.2",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/icon-lab": "^5.4.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.21.0",
44
+ "@atlaskit/editor-common": "^107.23.0",
45
45
  "react": "^18.2.0"
46
46
  },
47
47
  "techstack": {