@atlaskit/editor-plugin-type-ahead 3.1.12 → 3.1.14

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,20 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 3.1.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f204d18f922f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f204d18f922f0) -
8
+ ED-29116: clean up sharedPluginStateHookMigratorFactory in type-ahead
9
+
10
+ ## 3.1.13
11
+
12
+ ### Patch Changes
13
+
14
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
15
+ EDITOR-1442 Bump adf-schema
16
+ - Updated dependencies
17
+
3
18
  ## 3.1.12
4
19
 
5
20
  ### Patch Changes
@@ -11,7 +11,10 @@ var _typeAhead = require("@atlaskit/editor-common/type-ahead");
11
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
12
  var _TypeAheadMenu = require("./modern/TypeAheadMenu");
13
13
  var _TypeAheadMenu2 = require("./TypeAheadMenu");
14
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
14
+ function ContentComponent(_ref) {
15
+ var api = _ref.api,
16
+ editorView = _ref.editorView,
17
+ popupMountRef = _ref.popupMountRef;
15
18
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['typeAhead'], function (states) {
16
19
  var _states$typeAheadStat, _states$typeAheadStat2, _states$typeAheadStat3, _states$typeAheadStat4, _states$typeAheadStat5, _states$typeAheadStat6, _states$typeAheadStat7;
17
20
  return {
@@ -31,40 +34,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
31
34
  decorationSet = _useSharedPluginState.decorationSet,
32
35
  query = _useSharedPluginState.query,
33
36
  selectedIndex = _useSharedPluginState.selectedIndex;
34
- return {
35
- triggerHandler: triggerHandler,
36
- items: items,
37
- errorInfo: errorInfo,
38
- decorationElement: decorationElement,
39
- decorationSet: decorationSet,
40
- query: query,
41
- selectedIndex: selectedIndex
42
- };
43
- }, function (api) {
44
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['typeAhead']),
45
- typeAheadState = _useSharedPluginState2.typeAheadState;
46
- return {
47
- triggerHandler: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.triggerHandler,
48
- items: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.items,
49
- errorInfo: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.errorInfo,
50
- decorationElement: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationElement,
51
- decorationSet: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationSet,
52
- query: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.query,
53
- selectedIndex: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.selectedIndex
54
- };
55
- });
56
- function ContentComponent(_ref) {
57
- var api = _ref.api,
58
- editorView = _ref.editorView,
59
- popupMountRef = _ref.popupMountRef;
60
- var _useSharedState = useSharedState(api),
61
- triggerHandler = _useSharedState.triggerHandler,
62
- items = _useSharedState.items,
63
- errorInfo = _useSharedState.errorInfo,
64
- decorationElement = _useSharedState.decorationElement,
65
- decorationSet = _useSharedState.decorationSet,
66
- query = _useSharedState.query,
67
- selectedIndex = _useSharedState.selectedIndex;
68
37
  if (items === undefined || decorationSet === undefined || errorInfo === undefined || decorationElement === undefined || query === undefined || selectedIndex === undefined) {
69
38
  return null;
70
39
  }
@@ -158,24 +158,6 @@ var CustomItemComponentWrapper = /*#__PURE__*/_react.default.memo(function (prop
158
158
  onHover: noop
159
159
  })));
160
160
  });
161
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
162
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], function (states) {
163
- var _states$connectivityS;
164
- return {
165
- mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
166
- };
167
- }),
168
- mode = _useSharedPluginState.mode;
169
- return {
170
- connectivityMode: mode
171
- };
172
- }, function (api) {
173
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['connectivity']),
174
- connectivityState = _useSharedPluginState2.connectivityState;
175
- return {
176
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
177
- };
178
- });
179
161
  var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.memo(function (_ref2) {
180
162
  var item = _ref2.item,
181
163
  itemsLength = _ref2.itemsLength,
@@ -186,8 +168,13 @@ var TypeAheadListItem = exports.TypeAheadListItem = /*#__PURE__*/_react.default.
186
168
  moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled,
187
169
  api = _ref2.api,
188
170
  firstOnlineSupportedIndex = _ref2.firstOnlineSupportedIndex;
189
- var _useSharedState = useSharedState(api),
190
- connectivityMode = _useSharedState.connectivityMode;
171
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], function (states) {
172
+ var _states$connectivityS;
173
+ return {
174
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
175
+ };
176
+ }),
177
+ connectivityMode = _useSharedPluginState.connectivityMode;
191
178
  var isItemDisabled = function isItemDisabled(item) {
192
179
  var _item$isDisabledOffli;
193
180
  return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
@@ -62,24 +62,6 @@ var Highlight = function Highlight(_ref) {
62
62
  return triggerHandler.getHighlight(state);
63
63
  };
64
64
  var OFFSET = [0, 8];
65
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
66
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['featureFlags'], function (states) {
67
- var _states$featureFlagsS;
68
- return {
69
- moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
70
- };
71
- }),
72
- moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
73
- return {
74
- moreElementsInQuickInsertView: moreElementsInQuickInsertView
75
- };
76
- }, function (api) {
77
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
78
- featureFlagsState = _useSharedPluginState2.featureFlagsState;
79
- return {
80
- moreElementsInQuickInsertView: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView
81
- };
82
- });
83
65
  var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
84
66
  var _getPluginState;
85
67
  var editorView = props.editorView,
@@ -97,8 +79,13 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
97
79
  api = props.api,
98
80
  showMoreOptionsButton = props.showMoreOptionsButton;
99
81
  var ref = (0, _react.useRef)(null);
100
- var _useSharedState = useSharedState(api),
101
- moreElementsInQuickInsertView = _useSharedState.moreElementsInQuickInsertView;
82
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['featureFlags'], function (states) {
83
+ var _states$featureFlagsS;
84
+ return {
85
+ moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
86
+ };
87
+ }),
88
+ moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
102
89
  var moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT;
103
90
  var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
104
91
  var defaultMenuHeight = (0, _react.useMemo)(function () {
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
5
  import { TypeAheadMenu as TypeAheadMenuModern } from './modern/TypeAheadMenu';
6
6
  import { TypeAheadMenu } from './TypeAheadMenu';
7
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
7
+ export function ContentComponent({
8
+ api,
9
+ editorView,
10
+ popupMountRef
11
+ }) {
8
12
  const {
9
13
  triggerHandler,
10
14
  items,
@@ -25,43 +29,6 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
25
29
  selectedIndex: (_states$typeAheadStat7 = states.typeAheadState) === null || _states$typeAheadStat7 === void 0 ? void 0 : _states$typeAheadStat7.selectedIndex
26
30
  };
27
31
  });
28
- return {
29
- triggerHandler,
30
- items,
31
- errorInfo,
32
- decorationElement,
33
- decorationSet,
34
- query,
35
- selectedIndex
36
- };
37
- }, api => {
38
- const {
39
- typeAheadState
40
- } = useSharedPluginState(api, ['typeAhead']);
41
- return {
42
- triggerHandler: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.triggerHandler,
43
- items: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.items,
44
- errorInfo: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.errorInfo,
45
- decorationElement: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationElement,
46
- decorationSet: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationSet,
47
- query: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.query,
48
- selectedIndex: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.selectedIndex
49
- };
50
- });
51
- export function ContentComponent({
52
- api,
53
- editorView,
54
- popupMountRef
55
- }) {
56
- const {
57
- triggerHandler,
58
- items,
59
- errorInfo,
60
- decorationElement,
61
- decorationSet,
62
- query,
63
- selectedIndex
64
- } = useSharedState(api);
65
32
  if (items === undefined || decorationSet === undefined || errorInfo === undefined || decorationElement === undefined || query === undefined || selectedIndex === undefined) {
66
33
  return null;
67
34
  }
@@ -7,7 +7,7 @@ import React, { useCallback, useLayoutEffect, useMemo } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { useIntl } from 'react-intl-next';
10
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { IconFallback } from '@atlaskit/editor-common/quick-insert';
12
12
  import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
13
13
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
@@ -168,26 +168,6 @@ const CustomItemComponentWrapper = /*#__PURE__*/React.memo(props => {
168
168
  onHover: noop
169
169
  })));
170
170
  });
171
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
172
- const {
173
- mode
174
- } = useSharedPluginStateWithSelector(api, ['connectivity'], states => {
175
- var _states$connectivityS;
176
- return {
177
- mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
178
- };
179
- });
180
- return {
181
- connectivityMode: mode
182
- };
183
- }, api => {
184
- const {
185
- connectivityState
186
- } = useSharedPluginState(api, ['connectivity']);
187
- return {
188
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
189
- };
190
- });
191
171
  export const TypeAheadListItem = /*#__PURE__*/React.memo(({
192
172
  item,
193
173
  itemsLength,
@@ -201,7 +181,12 @@ export const TypeAheadListItem = /*#__PURE__*/React.memo(({
201
181
  }) => {
202
182
  const {
203
183
  connectivityMode
204
- } = useSharedState(api);
184
+ } = useSharedPluginStateWithSelector(api, ['connectivity'], states => {
185
+ var _states$connectivityS;
186
+ return {
187
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
188
+ };
189
+ });
205
190
  const isItemDisabled = item => {
206
191
  var _item$isDisabledOffli;
207
192
  return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
@@ -8,7 +8,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import rafSchedule from 'raf-schd';
10
10
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
12
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
13
13
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
14
14
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
@@ -52,26 +52,6 @@ const Highlight = ({
52
52
  return triggerHandler.getHighlight(state);
53
53
  };
54
54
  const OFFSET = [0, 8];
55
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
56
- const {
57
- moreElementsInQuickInsertView
58
- } = useSharedPluginStateWithSelector(api, ['featureFlags'], states => {
59
- var _states$featureFlagsS;
60
- return {
61
- moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
62
- };
63
- });
64
- return {
65
- moreElementsInQuickInsertView
66
- };
67
- }, api => {
68
- const {
69
- featureFlagsState
70
- } = useSharedPluginState(api, ['featureFlags']);
71
- return {
72
- moreElementsInQuickInsertView: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView
73
- };
74
- });
75
55
  export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
76
56
  var _getPluginState;
77
57
  const {
@@ -93,7 +73,12 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
93
73
  const ref = useRef(null);
94
74
  const {
95
75
  moreElementsInQuickInsertView
96
- } = useSharedState(api);
76
+ } = useSharedPluginStateWithSelector(api, ['featureFlags'], states => {
77
+ var _states$featureFlagsS;
78
+ return {
79
+ moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
80
+ };
81
+ });
97
82
  const moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT;
98
83
  const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
99
84
  const defaultMenuHeight = useMemo(() => moreElementsInQuickInsertViewEnabled ? DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW : DEFAULT_TYPEAHEAD_MENU_HEIGHT, [moreElementsInQuickInsertViewEnabled]);
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
5
  import { TypeAheadMenu as TypeAheadMenuModern } from './modern/TypeAheadMenu';
6
6
  import { TypeAheadMenu } from './TypeAheadMenu';
7
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
7
+ export function ContentComponent(_ref) {
8
+ var api = _ref.api,
9
+ editorView = _ref.editorView,
10
+ popupMountRef = _ref.popupMountRef;
8
11
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['typeAhead'], function (states) {
9
12
  var _states$typeAheadStat, _states$typeAheadStat2, _states$typeAheadStat3, _states$typeAheadStat4, _states$typeAheadStat5, _states$typeAheadStat6, _states$typeAheadStat7;
10
13
  return {
@@ -24,40 +27,6 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
24
27
  decorationSet = _useSharedPluginState.decorationSet,
25
28
  query = _useSharedPluginState.query,
26
29
  selectedIndex = _useSharedPluginState.selectedIndex;
27
- return {
28
- triggerHandler: triggerHandler,
29
- items: items,
30
- errorInfo: errorInfo,
31
- decorationElement: decorationElement,
32
- decorationSet: decorationSet,
33
- query: query,
34
- selectedIndex: selectedIndex
35
- };
36
- }, function (api) {
37
- var _useSharedPluginState2 = useSharedPluginState(api, ['typeAhead']),
38
- typeAheadState = _useSharedPluginState2.typeAheadState;
39
- return {
40
- triggerHandler: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.triggerHandler,
41
- items: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.items,
42
- errorInfo: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.errorInfo,
43
- decorationElement: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationElement,
44
- decorationSet: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.decorationSet,
45
- query: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.query,
46
- selectedIndex: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.selectedIndex
47
- };
48
- });
49
- export function ContentComponent(_ref) {
50
- var api = _ref.api,
51
- editorView = _ref.editorView,
52
- popupMountRef = _ref.popupMountRef;
53
- var _useSharedState = useSharedState(api),
54
- triggerHandler = _useSharedState.triggerHandler,
55
- items = _useSharedState.items,
56
- errorInfo = _useSharedState.errorInfo,
57
- decorationElement = _useSharedState.decorationElement,
58
- decorationSet = _useSharedState.decorationSet,
59
- query = _useSharedState.query,
60
- selectedIndex = _useSharedState.selectedIndex;
61
30
  if (items === undefined || decorationSet === undefined || errorInfo === undefined || decorationElement === undefined || query === undefined || selectedIndex === undefined) {
62
31
  return null;
63
32
  }
@@ -9,7 +9,7 @@ import React, { useCallback, useLayoutEffect, useMemo } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { useIntl } from 'react-intl-next';
12
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
13
  import { IconFallback } from '@atlaskit/editor-common/quick-insert';
14
14
  import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
15
15
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
@@ -150,24 +150,6 @@ var CustomItemComponentWrapper = /*#__PURE__*/React.memo(function (props) {
150
150
  onHover: noop
151
151
  })));
152
152
  });
153
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
154
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (states) {
155
- var _states$connectivityS;
156
- return {
157
- mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
158
- };
159
- }),
160
- mode = _useSharedPluginState.mode;
161
- return {
162
- connectivityMode: mode
163
- };
164
- }, function (api) {
165
- var _useSharedPluginState2 = useSharedPluginState(api, ['connectivity']),
166
- connectivityState = _useSharedPluginState2.connectivityState;
167
- return {
168
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
169
- };
170
- });
171
153
  export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
172
154
  var item = _ref2.item,
173
155
  itemsLength = _ref2.itemsLength,
@@ -178,8 +160,13 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
178
160
  moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled,
179
161
  api = _ref2.api,
180
162
  firstOnlineSupportedIndex = _ref2.firstOnlineSupportedIndex;
181
- var _useSharedState = useSharedState(api),
182
- connectivityMode = _useSharedState.connectivityMode;
163
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (states) {
164
+ var _states$connectivityS;
165
+ return {
166
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
167
+ };
168
+ }),
169
+ connectivityMode = _useSharedPluginState.connectivityMode;
183
170
  var isItemDisabled = function isItemDisabled(item) {
184
171
  var _item$isDisabledOffli;
185
172
  return connectivityMode === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
@@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import rafSchedule from 'raf-schd';
11
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
12
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
13
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
14
14
  import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
15
15
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
@@ -52,24 +52,6 @@ var Highlight = function Highlight(_ref) {
52
52
  return triggerHandler.getHighlight(state);
53
53
  };
54
54
  var OFFSET = [0, 8];
55
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
56
- var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
57
- var _states$featureFlagsS;
58
- return {
59
- moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
60
- };
61
- }),
62
- moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
63
- return {
64
- moreElementsInQuickInsertView: moreElementsInQuickInsertView
65
- };
66
- }, function (api) {
67
- var _useSharedPluginState2 = useSharedPluginState(api, ['featureFlags']),
68
- featureFlagsState = _useSharedPluginState2.featureFlagsState;
69
- return {
70
- moreElementsInQuickInsertView: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.moreElementsInQuickInsertView
71
- };
72
- });
73
55
  export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
74
56
  var _getPluginState;
75
57
  var editorView = props.editorView,
@@ -87,8 +69,13 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
87
69
  api = props.api,
88
70
  showMoreOptionsButton = props.showMoreOptionsButton;
89
71
  var ref = useRef(null);
90
- var _useSharedState = useSharedState(api),
91
- moreElementsInQuickInsertView = _useSharedState.moreElementsInQuickInsertView;
72
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
73
+ var _states$featureFlagsS;
74
+ return {
75
+ moreElementsInQuickInsertView: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.moreElementsInQuickInsertView
76
+ };
77
+ }),
78
+ moreElementsInQuickInsertView = _useSharedPluginState.moreElementsInQuickInsertView;
92
79
  var moreElementsInQuickInsertViewEnabled = moreElementsInQuickInsertView && triggerHandler.id === TypeAheadAvailableNodes.QUICK_INSERT;
93
80
  var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
94
81
  var defaultMenuHeight = useMemo(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "3.1.12",
3
+ "version": "3.1.14",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,11 +28,8 @@
28
28
  "*.compiled.css"
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
- "af:exports": {
32
- ".": "./src/index.ts"
33
- },
34
31
  "dependencies": {
35
- "@atlaskit/adf-schema": "^50.2.2",
32
+ "@atlaskit/adf-schema": "^50.2.3",
36
33
  "@atlaskit/editor-element-browser": "^1.0.0",
37
34
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
38
35
  "@atlaskit/editor-plugin-connectivity": "^3.1.0",
@@ -47,7 +44,7 @@
47
44
  "@atlaskit/primitives": "^14.12.0",
48
45
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
49
46
  "@atlaskit/theme": "^20.0.0",
50
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
47
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
51
48
  "@atlaskit/tokens": "^6.1.0",
52
49
  "@babel/runtime": "^7.0.0",
53
50
  "@emotion/react": "^11.7.1",
@@ -58,7 +55,7 @@
58
55
  "w3c-keyname": "^2.1.8"
59
56
  },
60
57
  "peerDependencies": {
61
- "@atlaskit/editor-common": "^107.31.0",
58
+ "@atlaskit/editor-common": "^107.33.0",
62
59
  "react": "^18.2.0",
63
60
  "react-dom": "^18.2.0",
64
61
  "react-intl-next": "npm:react-intl@^5.18.1"