@atlaskit/editor-plugin-track-changes 2.4.2 → 2.5.0

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,26 @@
1
1
  # @atlaskit/editor-plugin-track-changes
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`81ec1e909620a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81ec1e909620a) -
8
+ [EDITOR-1206] Have `editor-plugin-show-diff` expose if the plugin is displaying the diff.
9
+ Deprecate the state in `editor-plugin-track-changes` as it depends on `editor-plugin-show-diff`
10
+ and it's better to have the state in the plugin that actually shows the diff
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 2.4.3
17
+
18
+ ### Patch Changes
19
+
20
+ - [`3c2fe6ae106d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3c2fe6ae106d8) -
21
+ Focus the editor after track changes is turned off.
22
+ - Updated dependencies
23
+
3
24
  ## 2.4.2
4
25
 
5
26
  ### Patch Changes
@@ -12,7 +12,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _history = _interopRequireDefault(require("@atlaskit/icon-lab/core/history"));
14
14
  var TrackChangesToolbarButton = exports.TrackChangesToolbarButton = function TrackChangesToolbarButton(_ref) {
15
- var _api$trackChanges;
16
15
  var api = _ref.api;
17
16
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['trackChanges'], function (states) {
18
17
  var _states$trackChangesS, _states$trackChangesS2;
@@ -26,8 +25,14 @@ var TrackChangesToolbarButton = exports.TrackChangesToolbarButton = function Tra
26
25
  var _useIntl = (0, _reactIntlNext.useIntl)(),
27
26
  formatMessage = _useIntl.formatMessage;
28
27
  var handleClick = _react.default.useCallback(function () {
29
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.trackChanges.commands.toggleChanges);
30
- }, [api === null || api === void 0 || (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands, api === null || api === void 0 ? void 0 : api.core.actions]);
28
+ var _api$trackChanges;
29
+ var wasShowingDiffSelected = isDisplayingChanges;
30
+ var result = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands.toggleChanges);
31
+ // On de-selection - focus back on the editor
32
+ if (result && wasShowingDiffSelected) {
33
+ api === null || api === void 0 || api.core.actions.focus();
34
+ }
35
+ }, [api, isDisplayingChanges]);
31
36
  return /*#__PURE__*/_react.default.createElement(_new.IconButton, {
32
37
  icon: _history.default,
33
38
  label: formatMessage(_messages.trackChangesMessages.toolbarIconLabel),
@@ -7,7 +7,6 @@ import HistoryIcon from '@atlaskit/icon-lab/core/history';
7
7
  export const TrackChangesToolbarButton = ({
8
8
  api
9
9
  }) => {
10
- var _api$trackChanges;
11
10
  const {
12
11
  isDisplayingChanges,
13
12
  isShowDiffAvailable
@@ -22,8 +21,14 @@ export const TrackChangesToolbarButton = ({
22
21
  formatMessage
23
22
  } = useIntl();
24
23
  const handleClick = React.useCallback(() => {
25
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.trackChanges.commands.toggleChanges);
26
- }, [api === null || api === void 0 ? void 0 : (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands, api === null || api === void 0 ? void 0 : api.core.actions]);
24
+ var _api$trackChanges;
25
+ const wasShowingDiffSelected = isDisplayingChanges;
26
+ const result = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands.toggleChanges);
27
+ // On de-selection - focus back on the editor
28
+ if (result && wasShowingDiffSelected) {
29
+ api === null || api === void 0 ? void 0 : api.core.actions.focus();
30
+ }
31
+ }, [api, isDisplayingChanges]);
27
32
  return /*#__PURE__*/React.createElement(IconButton, {
28
33
  icon: HistoryIcon,
29
34
  label: formatMessage(trackChangesMessages.toolbarIconLabel),
@@ -5,7 +5,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
5
5
  import { trackChangesMessages } from '@atlaskit/editor-common/messages';
6
6
  import HistoryIcon from '@atlaskit/icon-lab/core/history';
7
7
  export var TrackChangesToolbarButton = function TrackChangesToolbarButton(_ref) {
8
- var _api$trackChanges;
9
8
  var api = _ref.api;
10
9
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['trackChanges'], function (states) {
11
10
  var _states$trackChangesS, _states$trackChangesS2;
@@ -19,8 +18,14 @@ export var TrackChangesToolbarButton = function TrackChangesToolbarButton(_ref)
19
18
  var _useIntl = useIntl(),
20
19
  formatMessage = _useIntl.formatMessage;
21
20
  var handleClick = React.useCallback(function () {
22
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.trackChanges.commands.toggleChanges);
23
- }, [api === null || api === void 0 || (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands, api === null || api === void 0 ? void 0 : api.core.actions]);
21
+ var _api$trackChanges;
22
+ var wasShowingDiffSelected = isDisplayingChanges;
23
+ var result = api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 || (_api$trackChanges = api.trackChanges) === null || _api$trackChanges === void 0 ? void 0 : _api$trackChanges.commands.toggleChanges);
24
+ // On de-selection - focus back on the editor
25
+ if (result && wasShowingDiffSelected) {
26
+ api === null || api === void 0 || api.core.actions.focus();
27
+ }
28
+ }, [api, isDisplayingChanges]);
24
29
  return /*#__PURE__*/React.createElement(IconButton, {
25
30
  icon: HistoryIcon,
26
31
  label: formatMessage(trackChangesMessages.toolbarIconLabel),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-track-changes",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
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.0.2",
37
+ "@atlaskit/editor-plugin-show-diff": "0.1.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/icon-lab": "^5.3.0",
39
+ "@atlaskit/icon-lab": "^5.4.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.18.0",
44
+ "@atlaskit/editor-common": "^107.20.0",
45
45
  "react": "^18.2.0"
46
46
  },
47
47
  "techstack": {