@atlaskit/editor-plugin-track-changes 2.7.4 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-track-changes
2
2
 
3
+ ## 2.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.7.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b39429d6d1945`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b39429d6d1945) -
14
+ EDITOR-1365: Remove addToHistory false condition in the track changes plugin.
15
+ - [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
16
+ Sorted type and interface props to improve Atlaskit docs
17
+ - Updated dependencies
18
+
3
19
  ## 2.7.4
4
20
 
5
21
  ### Patch Changes
@@ -2,9 +2,9 @@
2
2
  "extends": "../../../../tsconfig.entry-points.confluence.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
- "composite": true,
6
5
  "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-track-changes",
7
- "rootDir": "../"
6
+ "rootDir": "../",
7
+ "composite": true
8
8
  },
9
9
  "include": [
10
10
  "../src/**/*.ts",
@@ -74,7 +74,7 @@ var createTrackChangesPlugin = exports.createTrackChangesPlugin = function creat
74
74
  // If no document changes, return the old changeSet
75
75
  return state;
76
76
  }
77
- if (tr.getMeta('isRemote')) {
77
+ if (tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
78
78
  // If the transaction is remote, we need to map the steps to the current document
79
79
  return _objectSpread(_objectSpread({}, state), {}, {
80
80
  steps: state.steps.map(function (s) {
@@ -90,16 +90,6 @@ var createTrackChangesPlugin = exports.createTrackChangesPlugin = function creat
90
90
  });
91
91
  }
92
92
 
93
- // For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
94
- if (tr.getMeta('addToHistory') === false) {
95
- // This is likely an undo/redo operation, check if current doc matches baseline
96
- var _baselineDoc = getBaselineFromSteps(tr.doc, state.steps);
97
- var _hasChangesFromBaseline = !tr.doc.eq(_baselineDoc);
98
- return _objectSpread(_objectSpread({}, state), {}, {
99
- isShowDiffAvailable: _hasChangesFromBaseline
100
- });
101
- }
102
-
103
93
  // If we don't have the history plugin don't limit the change tracking
104
94
  var historyState = api === null || api === void 0 || (_api$history = api.history) === null || _api$history === void 0 ? void 0 : _api$history.sharedState.currentState();
105
95
  var currentAllocation = historyState ?
@@ -51,7 +51,7 @@ export const createTrackChangesPlugin = api => {
51
51
  // If no document changes, return the old changeSet
52
52
  return state;
53
53
  }
54
- if (tr.getMeta('isRemote')) {
54
+ if (tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
55
55
  // If the transaction is remote, we need to map the steps to the current document
56
56
  return {
57
57
  ...state,
@@ -66,17 +66,6 @@ export const createTrackChangesPlugin = api => {
66
66
  };
67
67
  }
68
68
 
69
- // For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
70
- if (tr.getMeta('addToHistory') === false) {
71
- // This is likely an undo/redo operation, check if current doc matches baseline
72
- const baselineDoc = getBaselineFromSteps(tr.doc, state.steps);
73
- const hasChangesFromBaseline = !tr.doc.eq(baselineDoc);
74
- return {
75
- ...state,
76
- isShowDiffAvailable: hasChangesFromBaseline
77
- };
78
- }
79
-
80
69
  // If we don't have the history plugin don't limit the change tracking
81
70
  const historyState = api === null || api === void 0 ? void 0 : (_api$history = api.history) === null || _api$history === void 0 ? void 0 : _api$history.sharedState.currentState();
82
71
  const currentAllocation = historyState ?
@@ -67,7 +67,7 @@ export var createTrackChangesPlugin = function createTrackChangesPlugin(api) {
67
67
  // If no document changes, return the old changeSet
68
68
  return state;
69
69
  }
70
- if (tr.getMeta('isRemote')) {
70
+ if (tr.getMeta('isRemote') || tr.getMeta('replaceDocument')) {
71
71
  // If the transaction is remote, we need to map the steps to the current document
72
72
  return _objectSpread(_objectSpread({}, state), {}, {
73
73
  steps: state.steps.map(function (s) {
@@ -83,16 +83,6 @@ export var createTrackChangesPlugin = function createTrackChangesPlugin(api) {
83
83
  });
84
84
  }
85
85
 
86
- // For undo/redo operations (addToHistory === false), we still need to check if we're back at baseline
87
- if (tr.getMeta('addToHistory') === false) {
88
- // This is likely an undo/redo operation, check if current doc matches baseline
89
- var _baselineDoc = getBaselineFromSteps(tr.doc, state.steps);
90
- var _hasChangesFromBaseline = !tr.doc.eq(_baselineDoc);
91
- return _objectSpread(_objectSpread({}, state), {}, {
92
- isShowDiffAvailable: _hasChangesFromBaseline
93
- });
94
- }
95
-
96
86
  // If we don't have the history plugin don't limit the change tracking
97
87
  var historyState = api === null || api === void 0 || (_api$history = api.history) === null || _api$history === void 0 ? void 0 : _api$history.sharedState.currentState();
98
88
  var currentAllocation = historyState ?
@@ -3,6 +3,6 @@ import type { InvertableStep } from './invertableStep';
3
3
  * Returns the filtered steps to ensure we don't track an entire document worth of changes
4
4
  */
5
5
  export declare function filterSteps(steps: InvertableStep[], allocations: Set<number>): {
6
- steps: InvertableStep[];
7
6
  allocations: Set<number>;
7
+ steps: InvertableStep[];
8
8
  };
@@ -6,10 +6,10 @@ import type { TrackChangesPlugin } from '../trackChangesPluginType';
6
6
  import { InvertableStep } from './invertableStep';
7
7
  export declare const trackChangesPluginKey: PluginKey<TrackChangesPluginState>;
8
8
  type TrackChangesPluginState = {
9
- shouldChangesBeDisplayed: boolean;
9
+ allocations: Set<number>;
10
10
  isShowDiffAvailable: boolean;
11
+ shouldChangesBeDisplayed: boolean;
11
12
  steps: InvertableStep[];
12
- allocations: Set<number>;
13
13
  };
14
14
  export declare const getBaselineFromSteps: (doc: PMNode, steps: InvertableStep[]) => PMNode;
15
15
  export declare const createTrackChangesPlugin: (api: ExtractInjectionAPI<TrackChangesPlugin> | undefined) => SafePlugin<TrackChangesPluginState>;
@@ -5,14 +5,14 @@ import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff';
5
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
6
6
  export type TrackChangesPlugin = NextEditorPlugin<'trackChanges', {
7
7
  commands: {
8
- /**
9
- * Toggles the displaying of changes in the editor.
10
- */
11
- toggleChanges: EditorCommand;
12
8
  /**
13
9
  * Resets the baseline used for tracking changes in the editor.
14
10
  */
15
11
  resetBaseline: EditorCommand;
12
+ /**
13
+ * Toggles the displaying of changes in the editor.
14
+ */
15
+ toggleChanges: EditorCommand;
16
16
  };
17
17
  dependencies: [
18
18
  /**
@@ -3,6 +3,6 @@ import type { InvertableStep } from './invertableStep';
3
3
  * Returns the filtered steps to ensure we don't track an entire document worth of changes
4
4
  */
5
5
  export declare function filterSteps(steps: InvertableStep[], allocations: Set<number>): {
6
- steps: InvertableStep[];
7
6
  allocations: Set<number>;
7
+ steps: InvertableStep[];
8
8
  };
@@ -6,10 +6,10 @@ import type { TrackChangesPlugin } from '../trackChangesPluginType';
6
6
  import { InvertableStep } from './invertableStep';
7
7
  export declare const trackChangesPluginKey: PluginKey<TrackChangesPluginState>;
8
8
  type TrackChangesPluginState = {
9
- shouldChangesBeDisplayed: boolean;
9
+ allocations: Set<number>;
10
10
  isShowDiffAvailable: boolean;
11
+ shouldChangesBeDisplayed: boolean;
11
12
  steps: InvertableStep[];
12
- allocations: Set<number>;
13
13
  };
14
14
  export declare const getBaselineFromSteps: (doc: PMNode, steps: InvertableStep[]) => PMNode;
15
15
  export declare const createTrackChangesPlugin: (api: ExtractInjectionAPI<TrackChangesPlugin> | undefined) => SafePlugin<TrackChangesPluginState>;
@@ -5,14 +5,14 @@ import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff';
5
5
  import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
6
6
  export type TrackChangesPlugin = NextEditorPlugin<'trackChanges', {
7
7
  commands: {
8
- /**
9
- * Toggles the displaying of changes in the editor.
10
- */
11
- toggleChanges: EditorCommand;
12
8
  /**
13
9
  * Resets the baseline used for tracking changes in the editor.
14
10
  */
15
11
  resetBaseline: EditorCommand;
12
+ /**
13
+ * Toggles the displaying of changes in the editor.
14
+ */
15
+ toggleChanges: EditorCommand;
16
16
  };
17
17
  dependencies: [
18
18
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-track-changes",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,20 +32,20 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/button": "^23.4.0",
35
- "@atlaskit/editor-plugin-history": "3.1.0",
35
+ "@atlaskit/editor-plugin-history": "3.1.1",
36
36
  "@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
37
- "@atlaskit/editor-plugin-show-diff": "0.1.4",
37
+ "@atlaskit/editor-plugin-show-diff": "0.1.6",
38
38
  "@atlaskit/editor-plugin-toolbar": "^0.4.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
40
40
  "@atlaskit/editor-toolbar": "^0.3.0",
41
41
  "@atlaskit/editor-toolbar-model": "^0.1.0",
42
42
  "@atlaskit/icon-lab": "^5.6.0",
43
- "@atlaskit/tmp-editor-statsig": "^11.5.0",
43
+ "@atlaskit/tmp-editor-statsig": "^11.6.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "react-intl-next": "npm:react-intl@^5.18.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^107.28.0",
48
+ "@atlaskit/editor-common": "^107.29.0",
49
49
  "react": "^18.2.0"
50
50
  },
51
51
  "techstack": {