@atlaskit/editor-core 209.2.1 → 209.2.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-core
2
2
 
3
+ ## 209.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#189737](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/189737)
8
+ [`db61cedd893b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/db61cedd893b2) -
9
+ Fix migrator hook order in editor-core
10
+ - Updated dependencies
11
+
3
12
  ## 209.2.1
4
13
 
5
14
  ### Patch Changes
@@ -15,7 +15,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
17
  var _hooks = require("@atlaskit/editor-common/hooks");
18
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
19
18
  var _scrollbar = require("@atlaskit/editor-shared-styles/scrollbar");
20
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
20
  var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
@@ -113,11 +112,14 @@ var EditorContainer = (0, _platformFeatureFlagsReact.componentWithCondition)(fun
113
112
  });
114
113
  }, _EditorContentContainer.default, ContentArea);
115
114
  var useEditorViewModePluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
115
+ return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['editorViewMode'], function (states) {
116
+ var _states$editorViewMod;
117
+ return states === null || states === void 0 || (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
118
+ });
119
+ }, function (pluginInjectionApi) {
116
120
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
117
121
  editorViewModeState = _useSharedPluginState.editorViewModeState;
118
122
  return editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
119
- }, function (pluginInjectionApi) {
120
- return (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
121
123
  });
122
124
 
123
125
  /**
@@ -205,18 +207,21 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
205
207
  }(_react.default.Component);
206
208
  (0, _defineProperty2.default)(Editor, "displayName", 'ChromelessEditorAppearance');
207
209
  var useMaxContentSizePluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
208
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['maxContentSize']),
209
- maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
210
- return {
211
- maxContentSizeState: maxContentSizeState
212
- };
213
- }, function (pluginInjectionApi) {
214
- var maxContentSizeReached = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
210
+ var maxContentSizeReached = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['maxContentSize'], function (states) {
211
+ var _states$maxContentSiz;
212
+ return states === null || states === void 0 || (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached;
213
+ });
215
214
  return {
216
215
  maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
217
216
  maxContentSizeReached: maxContentSizeReached
218
217
  }
219
218
  };
219
+ }, function (pluginInjectionApi) {
220
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['maxContentSize']),
221
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
222
+ return {
223
+ maxContentSizeState: maxContentSizeState
224
+ };
220
225
  });
221
226
  function RenderWithPluginState(_ref2) {
222
227
  var renderChrome = _ref2.renderChrome,
@@ -20,7 +20,6 @@ var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages
20
20
  var _styles = require("@atlaskit/editor-common/styles");
21
21
  var _ui = require("@atlaskit/editor-common/ui");
22
22
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
23
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
24
23
  var _commonStyles = require("@atlaskit/editor-plugins/table/ui/common-styles");
25
24
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
26
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -120,11 +119,17 @@ var EditorContainer = (0, _platformFeatureFlagsReact.componentWithCondition)(fun
120
119
  });
121
120
  }, _EditorContentContainer.default, ContentArea);
122
121
  var useCommentEditorPluginsStates = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
123
- return (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
124
- }, function (pluginInjectionApi) {
125
- var maxContentSizeReached = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
126
- var primaryToolbarComponents = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'primaryToolbar.components');
127
- var editorViewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
122
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode'], function (states) {
123
+ var _states$maxContentSiz, _states$primaryToolba, _states$editorViewMod;
124
+ return {
125
+ maxContentSizeReached: (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached,
126
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
127
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
128
+ };
129
+ }),
130
+ maxContentSizeReached = _useSharedPluginState.maxContentSizeReached,
131
+ primaryToolbarComponents = _useSharedPluginState.primaryToolbarComponents,
132
+ editorViewMode = _useSharedPluginState.editorViewMode;
128
133
  return {
129
134
  maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
130
135
  maxContentSizeReached: maxContentSizeReached
@@ -136,6 +141,8 @@ var useCommentEditorPluginsStates = (0, _hooks.sharedPluginStateHookMigratorFact
136
141
  mode: editorViewMode
137
142
  }
138
143
  };
144
+ }, function (pluginInjectionApi) {
145
+ return (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
139
146
  });
140
147
  var CommentEditorWithIntl = exports.CommentEditorWithIntl = function CommentEditorWithIntl(props) {
141
148
  var editorAPI = props.editorAPI;
@@ -144,8 +151,8 @@ var CommentEditorWithIntl = exports.CommentEditorWithIntl = function CommentEdit
144
151
  primaryToolbarHookState = _useCommentEditorPlug.primaryToolbarState,
145
152
  editorViewModeState = _useCommentEditorPlug.editorViewModeState;
146
153
  var primaryToolbarState = (0, _getPrimaryToolbarComponents.getPrimaryToolbarComponents)(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
147
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['media']),
148
- mediaState = _useSharedPluginState.mediaState;
154
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(editorAPI, ['media']),
155
+ mediaState = _useSharedPluginState2.mediaState;
149
156
  var intl = (0, _reactIntlNext.useIntl)();
150
157
  var editorDOMElement = props.editorDOMElement,
151
158
  editorView = props.editorView,
@@ -68,17 +68,17 @@ var hasCustomComponents = function hasCustomComponents(components) {
68
68
  return true;
69
69
  };
70
70
  var useFullPageEditorPluginsStates = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
71
- var _sharedState$interact;
72
- var sharedState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
73
- return {
74
- primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
75
- editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
76
- interactionState: sharedState === null || sharedState === void 0 || (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
77
- };
78
- }, function (pluginInjectionApi) {
79
- var primaryToolbarComponents = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'primaryToolbar.components');
80
- var editorViewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
81
- var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.interactionState');
71
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['primaryToolbar', 'interaction', 'editorViewMode'], function (states) {
72
+ var _states$primaryToolba, _states$interactionSt, _states$editorViewMod;
73
+ return {
74
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
75
+ interactionState: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState,
76
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
77
+ };
78
+ }),
79
+ interactionState = _useSharedPluginState.interactionState,
80
+ primaryToolbarComponents = _useSharedPluginState.primaryToolbarComponents,
81
+ editorViewMode = _useSharedPluginState.editorViewMode;
82
82
  return {
83
83
  primaryToolbarState: !primaryToolbarComponents ? undefined : {
84
84
  components: primaryToolbarComponents
@@ -88,6 +88,14 @@ var useFullPageEditorPluginsStates = (0, _hooks.sharedPluginStateHookMigratorFac
88
88
  },
89
89
  interactionState: interactionState
90
90
  };
91
+ }, function (pluginInjectionApi) {
92
+ var _sharedState$interact;
93
+ var sharedState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
94
+ return {
95
+ primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
96
+ editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
97
+ interactionState: sharedState === null || sharedState === void 0 || (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
98
+ };
91
99
  });
92
100
  var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
93
101
  var _scrollContentContain, _scrollContentContain2, _scrollContentContain3, _wrapperElementRef$cu;
@@ -20,7 +20,6 @@ var _Transition = _interopRequireDefault(require("react-transition-group/Transit
20
20
  var _hooks = require("@atlaskit/editor-common/hooks");
21
21
  var _messages = require("@atlaskit/editor-common/messages");
22
22
  var _ui = require("@atlaskit/editor-common/ui");
23
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
24
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
25
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -180,11 +179,14 @@ var SwappableContentAreaInner = /*#__PURE__*/function (_React$PureComponent) {
180
179
  }]);
181
180
  }(_react.default.PureComponent);
182
181
  var useContextPanelSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
182
+ return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['contextPanel'], function (states) {
183
+ var _states$contextPanelS;
184
+ return states === null || states === void 0 || (_states$contextPanelS = states.contextPanelState) === null || _states$contextPanelS === void 0 ? void 0 : _states$contextPanelS.contents;
185
+ });
186
+ }, function (pluginInjectionApi) {
183
187
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['contextPanel']),
184
188
  contextPanelState = _useSharedPluginState.contextPanelState;
185
189
  return contextPanelState === null || contextPanelState === void 0 ? void 0 : contextPanelState.contents;
186
- }, function (pluginInjectionApi) {
187
- return (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'contextPanel.contents');
188
190
  });
189
191
  var SwappableContentArea = exports.SwappableContentArea = (0, _reactIntlNext.injectIntl)(SwappableContentAreaInner);
190
192
  function ContextPanel(props) {
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "209.2.0";
8
+ var version = exports.version = "209.2.1";
@@ -7,8 +7,7 @@ import React, { Fragment } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
10
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
11
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
13
12
  import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
@@ -98,12 +97,15 @@ const EditorContainer = componentWithCondition(() => editorExperiment('platform_
98
97
  exposure: true
99
98
  }), EditorContentContainer, ContentArea);
100
99
  const useEditorViewModePluginState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
100
+ return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], states => {
101
+ var _states$editorViewMod;
102
+ return states === null || states === void 0 ? void 0 : (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
103
+ });
104
+ }, pluginInjectionApi => {
101
105
  const {
102
106
  editorViewModeState
103
107
  } = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
104
108
  return editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
105
- }, pluginInjectionApi => {
106
- return useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
107
109
  });
108
110
 
109
111
  /**
@@ -180,19 +182,22 @@ export default class Editor extends React.Component {
180
182
  }
181
183
  _defineProperty(Editor, "displayName", 'ChromelessEditorAppearance');
182
184
  const useMaxContentSizePluginState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
185
+ const maxContentSizeReached = useSharedPluginStateWithSelector(pluginInjectionApi, ['maxContentSize'], states => {
186
+ var _states$maxContentSiz;
187
+ return states === null || states === void 0 ? void 0 : (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached;
188
+ });
189
+ return {
190
+ maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
191
+ maxContentSizeReached
192
+ }
193
+ };
194
+ }, pluginInjectionApi => {
183
195
  const {
184
196
  maxContentSizeState
185
197
  } = useSharedPluginState(pluginInjectionApi, ['maxContentSize']);
186
198
  return {
187
199
  maxContentSizeState
188
200
  };
189
- }, pluginInjectionApi => {
190
- const maxContentSizeReached = useSharedPluginStateSelector(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
191
- return {
192
- maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
193
- maxContentSizeReached
194
- }
195
- };
196
201
  });
197
202
  function RenderWithPluginState({
198
203
  renderChrome,
@@ -10,12 +10,11 @@ import classnames from 'classnames';
10
10
  import { useIntl } from 'react-intl-next';
11
11
  import ButtonGroup from '@atlaskit/button/button-group';
12
12
  import Button from '@atlaskit/button/new';
13
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
13
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
14
  import messages from '@atlaskit/editor-common/messages';
15
15
  import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
16
16
  import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
17
17
  import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
18
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
19
18
  import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
20
19
  import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
21
20
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -123,11 +122,18 @@ const EditorContainer = componentWithCondition(() => editorExperiment('platform_
123
122
  exposure: true
124
123
  }), EditorContentContainer, ContentArea);
125
124
  const useCommentEditorPluginsStates = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
126
- return useSharedPluginState(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
127
- }, pluginInjectionApi => {
128
- const maxContentSizeReached = useSharedPluginStateSelector(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
129
- const primaryToolbarComponents = useSharedPluginStateSelector(pluginInjectionApi, 'primaryToolbar.components');
130
- const editorViewMode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
125
+ const {
126
+ maxContentSizeReached,
127
+ primaryToolbarComponents,
128
+ editorViewMode
129
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode'], states => {
130
+ var _states$maxContentSiz, _states$primaryToolba, _states$editorViewMod;
131
+ return {
132
+ maxContentSizeReached: (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached,
133
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
134
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
135
+ };
136
+ });
131
137
  return {
132
138
  maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
133
139
  maxContentSizeReached
@@ -139,6 +145,8 @@ const useCommentEditorPluginsStates = sharedPluginStateHookMigratorFactory(plugi
139
145
  mode: editorViewMode
140
146
  }
141
147
  };
148
+ }, pluginInjectionApi => {
149
+ return useSharedPluginState(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
142
150
  });
143
151
  export const CommentEditorWithIntl = props => {
144
152
  const {
@@ -7,7 +7,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { jsx } from '@emotion/react';
9
9
  import { browser } from '@atlaskit/editor-common/browser';
10
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
12
12
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
13
13
  import { FULL_PAGE_EDITOR_TOOLBAR_HEIGHT } from '@atlaskit/editor-shared-styles';
@@ -52,17 +52,18 @@ const hasCustomComponents = components => {
52
52
  return true;
53
53
  };
54
54
  const useFullPageEditorPluginsStates = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
55
- var _sharedState$interact;
56
- const sharedState = useSharedPluginState(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
57
- return {
58
- primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
59
- editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
60
- interactionState: sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
61
- };
62
- }, pluginInjectionApi => {
63
- const primaryToolbarComponents = useSharedPluginStateSelector(pluginInjectionApi, 'primaryToolbar.components');
64
- const editorViewMode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
65
- const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
55
+ const {
56
+ interactionState,
57
+ primaryToolbarComponents,
58
+ editorViewMode
59
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['primaryToolbar', 'interaction', 'editorViewMode'], states => {
60
+ var _states$primaryToolba, _states$interactionSt, _states$editorViewMod;
61
+ return {
62
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
63
+ interactionState: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState,
64
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
65
+ };
66
+ });
66
67
  return {
67
68
  primaryToolbarState: !primaryToolbarComponents ? undefined : {
68
69
  components: primaryToolbarComponents
@@ -72,6 +73,14 @@ const useFullPageEditorPluginsStates = sharedPluginStateHookMigratorFactory(plug
72
73
  },
73
74
  interactionState
74
75
  };
76
+ }, pluginInjectionApi => {
77
+ var _sharedState$interact;
78
+ const sharedState = useSharedPluginState(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
79
+ return {
80
+ primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
81
+ editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
82
+ interactionState: sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
83
+ };
75
84
  });
76
85
  export const FullPageEditor = props => {
77
86
  var _scrollContentContain, _scrollContentContain2, _scrollContentContain3, _wrapperElementRef$cu;
@@ -10,10 +10,9 @@ import React from 'react';
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import Transition from 'react-transition-group/Transition';
13
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
13
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
14
  import { contextPanelMessages } from '@atlaskit/editor-common/messages';
15
15
  import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
16
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
17
16
  import { akEditorContextPanelWidth, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
18
17
  import { fg } from '@atlaskit/platform-feature-flags';
19
18
  const ANIM_SPEED_MS = 500;
@@ -157,12 +156,15 @@ class SwappableContentAreaInner extends React.PureComponent {
157
156
  }
158
157
  }
159
158
  const useContextPanelSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
159
+ return useSharedPluginStateWithSelector(pluginInjectionApi, ['contextPanel'], states => {
160
+ var _states$contextPanelS;
161
+ return states === null || states === void 0 ? void 0 : (_states$contextPanelS = states.contextPanelState) === null || _states$contextPanelS === void 0 ? void 0 : _states$contextPanelS.contents;
162
+ });
163
+ }, pluginInjectionApi => {
160
164
  const {
161
165
  contextPanelState
162
166
  } = useSharedPluginState(pluginInjectionApi, ['contextPanel']);
163
167
  return contextPanelState === null || contextPanelState === void 0 ? void 0 : contextPanelState.contents;
164
- }, pluginInjectionApi => {
165
- return useSharedPluginStateSelector(pluginInjectionApi, 'contextPanel.contents');
166
168
  });
167
169
  export const SwappableContentArea = injectIntl(SwappableContentAreaInner);
168
170
  export function ContextPanel(props) {
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "209.2.0";
2
+ export const version = "209.2.1";
@@ -14,8 +14,7 @@ import React, { Fragment } from 'react';
14
14
 
15
15
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
16
16
  import { css, jsx } from '@emotion/react';
17
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
18
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
17
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
19
18
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
20
19
  import { fg } from '@atlaskit/platform-feature-flags';
21
20
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
@@ -107,11 +106,14 @@ var EditorContainer = componentWithCondition(function () {
107
106
  });
108
107
  }, EditorContentContainer, ContentArea);
109
108
  var useEditorViewModePluginState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
109
+ return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], function (states) {
110
+ var _states$editorViewMod;
111
+ return states === null || states === void 0 || (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
112
+ });
113
+ }, function (pluginInjectionApi) {
110
114
  var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorViewMode']),
111
115
  editorViewModeState = _useSharedPluginState.editorViewModeState;
112
116
  return editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
113
- }, function (pluginInjectionApi) {
114
- return useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
115
117
  });
116
118
 
117
119
  /**
@@ -200,18 +202,21 @@ var Editor = /*#__PURE__*/function (_React$Component) {
200
202
  _defineProperty(Editor, "displayName", 'ChromelessEditorAppearance');
201
203
  export { Editor as default };
202
204
  var useMaxContentSizePluginState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
203
- var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['maxContentSize']),
204
- maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
205
- return {
206
- maxContentSizeState: maxContentSizeState
207
- };
208
- }, function (pluginInjectionApi) {
209
- var maxContentSizeReached = useSharedPluginStateSelector(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
205
+ var maxContentSizeReached = useSharedPluginStateWithSelector(pluginInjectionApi, ['maxContentSize'], function (states) {
206
+ var _states$maxContentSiz;
207
+ return states === null || states === void 0 || (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached;
208
+ });
210
209
  return {
211
210
  maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
212
211
  maxContentSizeReached: maxContentSizeReached
213
212
  }
214
213
  };
214
+ }, function (pluginInjectionApi) {
215
+ var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['maxContentSize']),
216
+ maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
217
+ return {
218
+ maxContentSizeState: maxContentSizeState
219
+ };
215
220
  });
216
221
  function RenderWithPluginState(_ref2) {
217
222
  var renderChrome = _ref2.renderChrome,
@@ -14,12 +14,11 @@ import classnames from 'classnames';
14
14
  import { useIntl } from 'react-intl-next';
15
15
  import ButtonGroup from '@atlaskit/button/button-group';
16
16
  import Button from '@atlaskit/button/new';
17
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
17
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
18
18
  import messages from '@atlaskit/editor-common/messages';
19
19
  import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
20
20
  import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
21
21
  import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
22
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
23
22
  import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
24
23
  import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
25
24
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -112,11 +111,17 @@ var EditorContainer = componentWithCondition(function () {
112
111
  });
113
112
  }, EditorContentContainer, ContentArea);
114
113
  var useCommentEditorPluginsStates = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
115
- return useSharedPluginState(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
116
- }, function (pluginInjectionApi) {
117
- var maxContentSizeReached = useSharedPluginStateSelector(pluginInjectionApi, 'maxContentSize.maxContentSizeReached');
118
- var primaryToolbarComponents = useSharedPluginStateSelector(pluginInjectionApi, 'primaryToolbar.components');
119
- var editorViewMode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
114
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode'], function (states) {
115
+ var _states$maxContentSiz, _states$primaryToolba, _states$editorViewMod;
116
+ return {
117
+ maxContentSizeReached: (_states$maxContentSiz = states.maxContentSizeState) === null || _states$maxContentSiz === void 0 ? void 0 : _states$maxContentSiz.maxContentSizeReached,
118
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
119
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
120
+ };
121
+ }),
122
+ maxContentSizeReached = _useSharedPluginState.maxContentSizeReached,
123
+ primaryToolbarComponents = _useSharedPluginState.primaryToolbarComponents,
124
+ editorViewMode = _useSharedPluginState.editorViewMode;
120
125
  return {
121
126
  maxContentSizeState: maxContentSizeReached === undefined ? undefined : {
122
127
  maxContentSizeReached: maxContentSizeReached
@@ -128,6 +133,8 @@ var useCommentEditorPluginsStates = sharedPluginStateHookMigratorFactory(functio
128
133
  mode: editorViewMode
129
134
  }
130
135
  };
136
+ }, function (pluginInjectionApi) {
137
+ return useSharedPluginState(pluginInjectionApi, ['maxContentSize', 'primaryToolbar', 'editorViewMode']);
131
138
  });
132
139
  export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
133
140
  var editorAPI = props.editorAPI;
@@ -136,8 +143,8 @@ export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
136
143
  primaryToolbarHookState = _useCommentEditorPlug.primaryToolbarState,
137
144
  editorViewModeState = _useCommentEditorPlug.editorViewModeState;
138
145
  var primaryToolbarState = getPrimaryToolbarComponents(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
139
- var _useSharedPluginState = useSharedPluginState(editorAPI, ['media']),
140
- mediaState = _useSharedPluginState.mediaState;
146
+ var _useSharedPluginState2 = useSharedPluginState(editorAPI, ['media']),
147
+ mediaState = _useSharedPluginState2.mediaState;
141
148
  var intl = useIntl();
142
149
  var editorDOMElement = props.editorDOMElement,
143
150
  editorView = props.editorView,
@@ -8,7 +8,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
10
  import { browser } from '@atlaskit/editor-common/browser';
11
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
12
  import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
13
13
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
14
  import { FULL_PAGE_EDITOR_TOOLBAR_HEIGHT } from '@atlaskit/editor-shared-styles';
@@ -58,17 +58,17 @@ var hasCustomComponents = function hasCustomComponents(components) {
58
58
  return true;
59
59
  };
60
60
  var useFullPageEditorPluginsStates = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
61
- var _sharedState$interact;
62
- var sharedState = useSharedPluginState(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
63
- return {
64
- primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
65
- editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
66
- interactionState: sharedState === null || sharedState === void 0 || (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
67
- };
68
- }, function (pluginInjectionApi) {
69
- var primaryToolbarComponents = useSharedPluginStateSelector(pluginInjectionApi, 'primaryToolbar.components');
70
- var editorViewMode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
71
- var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
61
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['primaryToolbar', 'interaction', 'editorViewMode'], function (states) {
62
+ var _states$primaryToolba, _states$interactionSt, _states$editorViewMod;
63
+ return {
64
+ primaryToolbarComponents: (_states$primaryToolba = states.primaryToolbarState) === null || _states$primaryToolba === void 0 ? void 0 : _states$primaryToolba.components,
65
+ interactionState: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState,
66
+ editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
67
+ };
68
+ }),
69
+ interactionState = _useSharedPluginState.interactionState,
70
+ primaryToolbarComponents = _useSharedPluginState.primaryToolbarComponents,
71
+ editorViewMode = _useSharedPluginState.editorViewMode;
72
72
  return {
73
73
  primaryToolbarState: !primaryToolbarComponents ? undefined : {
74
74
  components: primaryToolbarComponents
@@ -78,6 +78,14 @@ var useFullPageEditorPluginsStates = sharedPluginStateHookMigratorFactory(functi
78
78
  },
79
79
  interactionState: interactionState
80
80
  };
81
+ }, function (pluginInjectionApi) {
82
+ var _sharedState$interact;
83
+ var sharedState = useSharedPluginState(pluginInjectionApi, ['editorViewMode', 'primaryToolbar', 'interaction']);
84
+ return {
85
+ primaryToolbarState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.primaryToolbarState,
86
+ editorViewModeState: sharedState === null || sharedState === void 0 ? void 0 : sharedState.editorViewModeState,
87
+ interactionState: sharedState === null || sharedState === void 0 || (_sharedState$interact = sharedState.interactionState) === null || _sharedState$interact === void 0 ? void 0 : _sharedState$interact.interactionState
88
+ };
81
89
  });
82
90
  export var FullPageEditor = function FullPageEditor(props) {
83
91
  var _scrollContentContain, _scrollContentContain2, _scrollContentContain3, _wrapperElementRef$cu;
@@ -19,10 +19,9 @@ import React from 'react';
19
19
  import { css, jsx } from '@emotion/react';
20
20
  import { injectIntl } from 'react-intl-next';
21
21
  import Transition from 'react-transition-group/Transition';
22
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
22
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
23
23
  import { contextPanelMessages } from '@atlaskit/editor-common/messages';
24
24
  import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
25
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
26
25
  import { akEditorContextPanelWidth, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
27
26
  import { fg } from '@atlaskit/platform-feature-flags';
28
27
  var ANIM_SPEED_MS = 500;
@@ -175,11 +174,14 @@ var SwappableContentAreaInner = /*#__PURE__*/function (_React$PureComponent) {
175
174
  }]);
176
175
  }(React.PureComponent);
177
176
  var useContextPanelSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
177
+ return useSharedPluginStateWithSelector(pluginInjectionApi, ['contextPanel'], function (states) {
178
+ var _states$contextPanelS;
179
+ return states === null || states === void 0 || (_states$contextPanelS = states.contextPanelState) === null || _states$contextPanelS === void 0 ? void 0 : _states$contextPanelS.contents;
180
+ });
181
+ }, function (pluginInjectionApi) {
178
182
  var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['contextPanel']),
179
183
  contextPanelState = _useSharedPluginState.contextPanelState;
180
184
  return contextPanelState === null || contextPanelState === void 0 ? void 0 : contextPanelState.contents;
181
- }, function (pluginInjectionApi) {
182
- return useSharedPluginStateSelector(pluginInjectionApi, 'contextPanel.contents');
183
185
  });
184
186
  export var SwappableContentArea = injectIntl(SwappableContentAreaInner);
185
187
  export function ContextPanel(props) {
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "209.2.0";
2
+ export var version = "209.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "209.2.1",
3
+ "version": "209.2.2",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"