@atlaskit/editor-plugin-undo-redo 3.0.1 → 3.0.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,14 @@
1
1
  # @atlaskit/editor-plugin-undo-redo
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#183158](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183158)
8
+ [`d6096ec5c8ad9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d6096ec5c8ad9) -
9
+ Migrate to useSharedPluginStateWithSelector
10
+ - Updated dependencies
11
+
3
12
  ## 3.0.1
4
13
 
5
14
  ### Patch Changes
@@ -12,7 +12,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _styles = require("@atlaskit/editor-common/styles");
14
14
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
15
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
16
15
  var _redo = _interopRequireDefault(require("@atlaskit/icon/core/migration/redo"));
17
16
  var _undo = _interopRequireDefault(require("@atlaskit/icon/core/migration/undo"));
18
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -25,15 +24,22 @@ var _utils = require("../../pm-plugins/utils");
25
24
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
25
 
27
26
  var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
28
- var canUndo = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'history.canUndo');
29
- var canRedo = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'history.canRedo');
27
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['history'], function (states) {
28
+ var _states$historyState, _states$historyState2;
29
+ return {
30
+ canUndo: (_states$historyState = states.historyState) === null || _states$historyState === void 0 ? void 0 : _states$historyState.canUndo,
31
+ canRedo: (_states$historyState2 = states.historyState) === null || _states$historyState2 === void 0 ? void 0 : _states$historyState2.canRedo
32
+ };
33
+ }),
34
+ canRedo = _useSharedPluginState.canRedo,
35
+ canUndo = _useSharedPluginState.canUndo;
30
36
  return {
31
37
  canUndo: canUndo,
32
38
  canRedo: canRedo
33
39
  };
34
40
  }, function (api) {
35
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['history']),
36
- historyState = _useSharedPluginState.historyState;
41
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['history']),
42
+ historyState = _useSharedPluginState2.historyState;
37
43
  return {
38
44
  canUndo: historyState === null || historyState === void 0 ? void 0 : historyState.canUndo,
39
45
  canRedo: historyState === null || historyState === void 0 ? void 0 : historyState.canRedo
@@ -5,20 +5,27 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { jsx } from '@emotion/react';
7
7
  import { injectIntl } from 'react-intl-next';
8
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import { getAriaKeyshortcuts, redo, redoAlt, tooltip, ToolTipContent, undo as undoKeymap } from '@atlaskit/editor-common/keymaps';
10
10
  import { undoRedoMessages } from '@atlaskit/editor-common/messages';
11
11
  import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh, separatorStyles } from '@atlaskit/editor-common/styles';
12
12
  import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
13
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
13
  import RedoIcon from '@atlaskit/icon/core/migration/redo';
15
14
  import UndoIcon from '@atlaskit/icon/core/migration/undo';
16
15
  import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { redoFromToolbarWithAnalytics, undoFromToolbarWithAnalytics } from '../../pm-plugins/commands';
18
17
  import { forceFocus } from '../../pm-plugins/utils';
19
18
  const useSharedState = sharedPluginStateHookMigratorFactory(api => {
20
- const canUndo = useSharedPluginStateSelector(api, 'history.canUndo');
21
- const canRedo = useSharedPluginStateSelector(api, 'history.canRedo');
19
+ const {
20
+ canRedo,
21
+ canUndo
22
+ } = useSharedPluginStateWithSelector(api, ['history'], states => {
23
+ var _states$historyState, _states$historyState2;
24
+ return {
25
+ canUndo: (_states$historyState = states.historyState) === null || _states$historyState === void 0 ? void 0 : _states$historyState.canUndo,
26
+ canRedo: (_states$historyState2 = states.historyState) === null || _states$historyState2 === void 0 ? void 0 : _states$historyState2.canRedo
27
+ };
28
+ });
22
29
  return {
23
30
  canUndo,
24
31
  canRedo
@@ -5,27 +5,33 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { jsx } from '@emotion/react';
7
7
  import { injectIntl } from 'react-intl-next';
8
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import { getAriaKeyshortcuts, redo, redoAlt, tooltip, ToolTipContent, undo as undoKeymap } from '@atlaskit/editor-common/keymaps';
10
10
  import { undoRedoMessages } from '@atlaskit/editor-common/messages';
11
11
  import { buttonGroupStyle, buttonGroupStyleBeforeVisualRefresh, separatorStyles } from '@atlaskit/editor-common/styles';
12
12
  import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
13
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
13
  import RedoIcon from '@atlaskit/icon/core/migration/redo';
15
14
  import UndoIcon from '@atlaskit/icon/core/migration/undo';
16
15
  import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { redoFromToolbarWithAnalytics, undoFromToolbarWithAnalytics } from '../../pm-plugins/commands';
18
17
  import { forceFocus } from '../../pm-plugins/utils';
19
18
  var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
20
- var canUndo = useSharedPluginStateSelector(api, 'history.canUndo');
21
- var canRedo = useSharedPluginStateSelector(api, 'history.canRedo');
19
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['history'], function (states) {
20
+ var _states$historyState, _states$historyState2;
21
+ return {
22
+ canUndo: (_states$historyState = states.historyState) === null || _states$historyState === void 0 ? void 0 : _states$historyState.canUndo,
23
+ canRedo: (_states$historyState2 = states.historyState) === null || _states$historyState2 === void 0 ? void 0 : _states$historyState2.canRedo
24
+ };
25
+ }),
26
+ canRedo = _useSharedPluginState.canRedo,
27
+ canUndo = _useSharedPluginState.canUndo;
22
28
  return {
23
29
  canUndo: canUndo,
24
30
  canRedo: canRedo
25
31
  };
26
32
  }, function (api) {
27
- var _useSharedPluginState = useSharedPluginState(api, ['history']),
28
- historyState = _useSharedPluginState.historyState;
33
+ var _useSharedPluginState2 = useSharedPluginState(api, ['history']),
34
+ historyState = _useSharedPluginState2.historyState;
29
35
  return {
30
36
  canUndo: historyState === null || historyState === void 0 ? void 0 : historyState.canUndo,
31
37
  canRedo: historyState === null || historyState === void 0 ? void 0 : historyState.canRedo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-undo-redo",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Undo redo plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
39
  "@atlaskit/icon": "^27.3.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
- "@atlaskit/tmp-editor-statsig": "^9.0.0",
41
+ "@atlaskit/tmp-editor-statsig": "^9.1.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/react": "^11.7.1"
44
44
  },