@atlaskit/editor-plugin-insert-block 4.3.6 → 4.3.8

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,19 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 4.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d8f08e44cd911`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d8f08e44cd911) -
8
+ ED-29108: tidy up sharedPluginStateHookMigratorFactory in insert-block
9
+ - Updated dependencies
10
+
11
+ ## 4.3.7
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 4.3.6
4
18
 
5
19
  ### Patch Changes
@@ -251,38 +251,6 @@ var selector = function selector(states) {
251
251
  activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark
252
252
  };
253
253
  };
254
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
255
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector);
256
- }, function (api) {
257
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']),
258
- dateState = _useSharedPluginState.dateState,
259
- hyperlinkState = _useSharedPluginState.hyperlinkState,
260
- imageUploadState = _useSharedPluginState.imageUploadState,
261
- mentionState = _useSharedPluginState.mentionState,
262
- emojiState = _useSharedPluginState.emojiState,
263
- blockTypeState = _useSharedPluginState.blockTypeState,
264
- mediaState = _useSharedPluginState.mediaState,
265
- typeAheadState = _useSharedPluginState.typeAheadState,
266
- placeholderTextState = _useSharedPluginState.placeholderTextState,
267
- insertBlockState = _useSharedPluginState.insertBlockState,
268
- connectivityState = _useSharedPluginState.connectivityState;
269
- return {
270
- emojiProviderSelector: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
271
- showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker,
272
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
273
- showElementBrowser: insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.showElementBrowser,
274
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
275
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
276
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
277
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
278
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
279
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
280
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
281
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
282
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
283
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark
284
- };
285
- });
286
254
  function ToolbarInsertBlockWithInjectionApi(_ref4) {
287
255
  var _pluginInjectionApi$i, _pluginInjectionApi$c2, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
288
256
  var editorView = _ref4.editorView,
@@ -300,21 +268,21 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
300
268
  options = _ref4.options,
301
269
  appearance = _ref4.appearance;
302
270
  var buttons = toolbarSizeToButtons(toolbarSize, appearance);
303
- var _useSharedState = useSharedState(pluginInjectionApi),
304
- emojiProviderSelector = _useSharedState.emojiProviderSelector,
305
- showMediaPicker = _useSharedState.showMediaPicker,
306
- mediaAllowsUploads = _useSharedState.mediaAllowsUploads,
307
- showElementBrowser = _useSharedState.showElementBrowser,
308
- isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
309
- mentionProvider = _useSharedState.mentionProvider,
310
- canInsertMention = _useSharedState.canInsertMention,
311
- dateEnabled = _useSharedState.dateEnabled,
312
- placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
313
- connectivityMode = _useSharedState.connectivityMode,
314
- imageUploadEnabled = _useSharedState.imageUploadEnabled,
315
- availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
316
- canInsertLink = _useSharedState.canInsertLink,
317
- activeLinkMark = _useSharedState.activeLinkMark;
271
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector),
272
+ emojiProviderSelector = _useSharedPluginState.emojiProviderSelector,
273
+ showMediaPicker = _useSharedPluginState.showMediaPicker,
274
+ mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads,
275
+ showElementBrowser = _useSharedPluginState.showElementBrowser,
276
+ isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
277
+ mentionProvider = _useSharedPluginState.mentionProvider,
278
+ canInsertMention = _useSharedPluginState.canInsertMention,
279
+ dateEnabled = _useSharedPluginState.dateEnabled,
280
+ placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
281
+ connectivityMode = _useSharedPluginState.connectivityMode,
282
+ imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
283
+ availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
284
+ canInsertLink = _useSharedPluginState.canInsertLink,
285
+ activeLinkMark = _useSharedPluginState.activeLinkMark;
318
286
  var emojiProviderPromise = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'emoji.emojiProviderPromise', {
319
287
  disabled: !(0, _experiments.editorExperiment)('platform_editor_prevent_toolbar_layout_shifts', true)
320
288
  });
@@ -35,15 +35,6 @@ var selector = function selector(states) {
35
35
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
36
36
  };
37
37
  };
38
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
39
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], selector);
40
- }, function (api) {
41
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['connectivity']),
42
- connectivityState = _useSharedPluginState.connectivityState;
43
- return {
44
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
45
- };
46
- });
47
38
  var InsertMenu = function InsertMenu(_ref) {
48
39
  var _pluginInjectionApi$q6, _pluginInjectionApi$q7;
49
40
  var editorView = _ref.editorView,
@@ -120,8 +111,8 @@ var InsertMenu = function InsertMenu(_ref) {
120
111
  }
121
112
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item, _analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
122
113
  }, [editorView, toggleVisiblity, pluginInjectionApi]);
123
- var _useSharedState = useSharedState(pluginInjectionApi),
124
- connectivityMode = _useSharedState.connectivityMode;
114
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['connectivity'], selector),
115
+ connectivityMode = _useSharedPluginState.connectivityMode;
125
116
  var getItems = (0, _react.useCallback)(function (query, category) {
126
117
  var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
127
118
  // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
@@ -26,48 +26,21 @@ var selector = function selector(states) {
26
26
  mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
27
27
  };
28
28
  };
29
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
30
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector);
31
- }, function (api) {
32
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
33
- dateState = _useSharedPluginState.dateState,
34
- hyperlinkState = _useSharedPluginState.hyperlinkState,
35
- imageUploadState = _useSharedPluginState.imageUploadState,
36
- mentionState = _useSharedPluginState.mentionState,
37
- emojiState = _useSharedPluginState.emojiState,
38
- blockTypeState = _useSharedPluginState.blockTypeState,
39
- mediaState = _useSharedPluginState.mediaState,
40
- typeAheadState = _useSharedPluginState.typeAheadState,
41
- placeholderTextState = _useSharedPluginState.placeholderTextState;
42
- return {
43
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
44
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
45
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark,
46
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
47
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
48
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
49
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
50
- emojiProvider: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
51
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
52
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
53
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads
54
- };
55
- });
56
29
  var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsertMenuRailItems(editorView, options, api) {
57
30
  var _useIntl = (0, _reactIntlNext.useIntl)(),
58
31
  formatMessage = _useIntl.formatMessage;
59
- var _useSharedState = useSharedState(api),
60
- dateEnabled = _useSharedState.dateEnabled,
61
- canInsertLink = _useSharedState.canInsertLink,
62
- activeLinkMark = _useSharedState.activeLinkMark,
63
- isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
64
- availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
65
- imageUploadEnabled = _useSharedState.imageUploadEnabled,
66
- placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
67
- emojiProvider = _useSharedState.emojiProvider,
68
- mentionProvider = _useSharedState.mentionProvider,
69
- canInsertMention = _useSharedState.canInsertMention,
70
- mediaAllowsUploads = _useSharedState.mediaAllowsUploads;
32
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector),
33
+ dateEnabled = _useSharedPluginState.dateEnabled,
34
+ canInsertLink = _useSharedPluginState.canInsertLink,
35
+ activeLinkMark = _useSharedPluginState.activeLinkMark,
36
+ isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
37
+ availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
38
+ imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
39
+ placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
40
+ emojiProvider = _useSharedPluginState.emojiProvider,
41
+ mentionProvider = _useSharedPluginState.mentionProvider,
42
+ canInsertMention = _useSharedPluginState.canInsertMention,
43
+ mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads;
71
44
  var _useMemo = (0, _react.useMemo)(function () {
72
45
  return (0, _createItems.createItems)({
73
46
  isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
4
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
6
  import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -235,39 +235,6 @@ const selector = states => {
235
235
  activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark
236
236
  };
237
237
  };
238
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
239
- return useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector);
240
- }, api => {
241
- const {
242
- dateState,
243
- hyperlinkState,
244
- imageUploadState,
245
- mentionState,
246
- emojiState,
247
- blockTypeState,
248
- mediaState,
249
- typeAheadState,
250
- placeholderTextState,
251
- insertBlockState,
252
- connectivityState
253
- } = useSharedPluginState(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']);
254
- return {
255
- emojiProviderSelector: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
256
- showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker,
257
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
258
- showElementBrowser: insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.showElementBrowser,
259
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
260
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
261
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
262
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
263
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
264
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
265
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
266
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
267
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
268
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark
269
- };
270
- });
271
238
  function ToolbarInsertBlockWithInjectionApi({
272
239
  editorView,
273
240
  editorActions,
@@ -301,7 +268,7 @@ function ToolbarInsertBlockWithInjectionApi({
301
268
  availableWrapperBlockTypes,
302
269
  canInsertLink,
303
270
  activeLinkMark
304
- } = useSharedState(pluginInjectionApi);
271
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector);
305
272
  const emojiProviderPromise = useSharedPluginStateSelector(pluginInjectionApi, 'emoji.emojiProviderPromise', {
306
273
  disabled: !editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)
307
274
  });
@@ -12,7 +12,7 @@ import { useIntl } from 'react-intl-next';
12
12
  import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
13
13
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
14
14
  import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
15
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
15
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
16
16
  import { messages, IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
17
17
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
18
18
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -25,16 +25,6 @@ const selector = states => {
25
25
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
26
26
  };
27
27
  };
28
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
29
- return useSharedPluginStateWithSelector(api, ['connectivity'], selector);
30
- }, api => {
31
- const {
32
- connectivityState
33
- } = useSharedPluginState(api, ['connectivity']);
34
- return {
35
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
36
- };
37
- });
38
28
  const InsertMenu = ({
39
29
  editorView,
40
30
  dropdownItems,
@@ -101,7 +91,7 @@ const InsertMenu = ({
101
91
  }, [editorView, toggleVisiblity, pluginInjectionApi]);
102
92
  const {
103
93
  connectivityMode
104
- } = useSharedState(pluginInjectionApi);
94
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['connectivity'], selector);
105
95
  const getItems = useCallback((query, category) => {
106
96
  const filterForPinWhiteboardsExperiment = featuredItems => {
107
97
  // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { createItems } from '../ToolbarInsertBlock/create-items';
5
5
  const selector = states => {
6
6
  var _states$dateState, _states$hyperlinkStat, _states$hyperlinkStat2, _states$typeAheadStat, _states$blockTypeStat, _states$imageUploadSt, _states$placeholderTe, _states$emojiState, _states$mentionState, _states$mentionState2, _states$mediaState;
@@ -18,34 +18,6 @@ const selector = states => {
18
18
  mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
19
19
  };
20
20
  };
21
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
22
- return useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector);
23
- }, api => {
24
- const {
25
- dateState,
26
- hyperlinkState,
27
- imageUploadState,
28
- mentionState,
29
- emojiState,
30
- blockTypeState,
31
- mediaState,
32
- typeAheadState,
33
- placeholderTextState
34
- } = useSharedPluginState(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']);
35
- return {
36
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
37
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
38
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark,
39
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
40
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
41
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
42
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
43
- emojiProvider: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
44
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
45
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
46
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads
47
- };
48
- });
49
21
  export const useInsertMenuRailItems = (editorView, options, api) => {
50
22
  const {
51
23
  formatMessage
@@ -62,7 +34,7 @@ export const useInsertMenuRailItems = (editorView, options, api) => {
62
34
  mentionProvider,
63
35
  canInsertMention,
64
36
  mediaAllowsUploads
65
- } = useSharedState(api);
37
+ } = useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector);
66
38
  const [_, dropdownItems] = useMemo(() => {
67
39
  return createItems({
68
40
  isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
4
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
6
  import { ToolbarSize } from '@atlaskit/editor-common/types';
7
7
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -241,38 +241,6 @@ var selector = function selector(states) {
241
241
  activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark
242
242
  };
243
243
  };
244
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
245
- return useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector);
246
- }, function (api) {
247
- var _useSharedPluginState = useSharedPluginState(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']),
248
- dateState = _useSharedPluginState.dateState,
249
- hyperlinkState = _useSharedPluginState.hyperlinkState,
250
- imageUploadState = _useSharedPluginState.imageUploadState,
251
- mentionState = _useSharedPluginState.mentionState,
252
- emojiState = _useSharedPluginState.emojiState,
253
- blockTypeState = _useSharedPluginState.blockTypeState,
254
- mediaState = _useSharedPluginState.mediaState,
255
- typeAheadState = _useSharedPluginState.typeAheadState,
256
- placeholderTextState = _useSharedPluginState.placeholderTextState,
257
- insertBlockState = _useSharedPluginState.insertBlockState,
258
- connectivityState = _useSharedPluginState.connectivityState;
259
- return {
260
- emojiProviderSelector: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
261
- showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker,
262
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
263
- showElementBrowser: insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.showElementBrowser,
264
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
265
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
266
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
267
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
268
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
269
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
270
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
271
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
272
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
273
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark
274
- };
275
- });
276
244
  function ToolbarInsertBlockWithInjectionApi(_ref4) {
277
245
  var _pluginInjectionApi$i, _pluginInjectionApi$c2, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
278
246
  var editorView = _ref4.editorView,
@@ -290,21 +258,21 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
290
258
  options = _ref4.options,
291
259
  appearance = _ref4.appearance;
292
260
  var buttons = toolbarSizeToButtons(toolbarSize, appearance);
293
- var _useSharedState = useSharedState(pluginInjectionApi),
294
- emojiProviderSelector = _useSharedState.emojiProviderSelector,
295
- showMediaPicker = _useSharedState.showMediaPicker,
296
- mediaAllowsUploads = _useSharedState.mediaAllowsUploads,
297
- showElementBrowser = _useSharedState.showElementBrowser,
298
- isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
299
- mentionProvider = _useSharedState.mentionProvider,
300
- canInsertMention = _useSharedState.canInsertMention,
301
- dateEnabled = _useSharedState.dateEnabled,
302
- placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
303
- connectivityMode = _useSharedState.connectivityMode,
304
- imageUploadEnabled = _useSharedState.imageUploadEnabled,
305
- availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
306
- canInsertLink = _useSharedState.canInsertLink,
307
- activeLinkMark = _useSharedState.activeLinkMark;
261
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity'], selector),
262
+ emojiProviderSelector = _useSharedPluginState.emojiProviderSelector,
263
+ showMediaPicker = _useSharedPluginState.showMediaPicker,
264
+ mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads,
265
+ showElementBrowser = _useSharedPluginState.showElementBrowser,
266
+ isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
267
+ mentionProvider = _useSharedPluginState.mentionProvider,
268
+ canInsertMention = _useSharedPluginState.canInsertMention,
269
+ dateEnabled = _useSharedPluginState.dateEnabled,
270
+ placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
271
+ connectivityMode = _useSharedPluginState.connectivityMode,
272
+ imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
273
+ availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
274
+ canInsertLink = _useSharedPluginState.canInsertLink,
275
+ activeLinkMark = _useSharedPluginState.activeLinkMark;
308
276
  var emojiProviderPromise = useSharedPluginStateSelector(pluginInjectionApi, 'emoji.emojiProviderPromise', {
309
277
  disabled: !editorExperiment('platform_editor_prevent_toolbar_layout_shifts', true)
310
278
  });
@@ -19,7 +19,7 @@ import { useIntl } from 'react-intl-next';
19
19
  import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
20
20
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
21
21
  import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
22
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
22
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
23
23
  import { messages, IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
24
24
  import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
25
25
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -32,15 +32,6 @@ var selector = function selector(states) {
32
32
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
33
33
  };
34
34
  };
35
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
36
- return useSharedPluginStateWithSelector(api, ['connectivity'], selector);
37
- }, function (api) {
38
- var _useSharedPluginState = useSharedPluginState(api, ['connectivity']),
39
- connectivityState = _useSharedPluginState.connectivityState;
40
- return {
41
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
42
- };
43
- });
44
35
  var InsertMenu = function InsertMenu(_ref) {
45
36
  var _pluginInjectionApi$q6, _pluginInjectionApi$q7;
46
37
  var editorView = _ref.editorView,
@@ -117,8 +108,8 @@ var InsertMenu = function InsertMenu(_ref) {
117
108
  }
118
109
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
119
110
  }, [editorView, toggleVisiblity, pluginInjectionApi]);
120
- var _useSharedState = useSharedState(pluginInjectionApi),
121
- connectivityMode = _useSharedState.connectivityMode;
111
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['connectivity'], selector),
112
+ connectivityMode = _useSharedPluginState.connectivityMode;
122
113
  var getItems = useCallback(function (query, category) {
123
114
  var filterForPinWhiteboardsExperiment = function filterForPinWhiteboardsExperiment(featuredItems) {
124
115
  // Part of ATLAS-95399 to pin whiteboards to the top of the InsertMenu
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useMemo } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { createItems } from '../ToolbarInsertBlock/create-items';
6
6
  var selector = function selector(states) {
7
7
  var _states$dateState, _states$hyperlinkStat, _states$hyperlinkStat2, _states$typeAheadStat, _states$blockTypeStat, _states$imageUploadSt, _states$placeholderTe, _states$emojiState, _states$mentionState, _states$mentionState2, _states$mediaState;
@@ -19,48 +19,21 @@ var selector = function selector(states) {
19
19
  mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
20
20
  };
21
21
  };
22
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
23
- return useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector);
24
- }, function (api) {
25
- var _useSharedPluginState = useSharedPluginState(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
26
- dateState = _useSharedPluginState.dateState,
27
- hyperlinkState = _useSharedPluginState.hyperlinkState,
28
- imageUploadState = _useSharedPluginState.imageUploadState,
29
- mentionState = _useSharedPluginState.mentionState,
30
- emojiState = _useSharedPluginState.emojiState,
31
- blockTypeState = _useSharedPluginState.blockTypeState,
32
- mediaState = _useSharedPluginState.mediaState,
33
- typeAheadState = _useSharedPluginState.typeAheadState,
34
- placeholderTextState = _useSharedPluginState.placeholderTextState;
35
- return {
36
- dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
37
- canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
38
- activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark,
39
- isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
40
- availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
41
- imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
42
- placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
43
- emojiProvider: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
44
- mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
45
- canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
46
- mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads
47
- };
48
- });
49
22
  export var useInsertMenuRailItems = function useInsertMenuRailItems(editorView, options, api) {
50
23
  var _useIntl = useIntl(),
51
24
  formatMessage = _useIntl.formatMessage;
52
- var _useSharedState = useSharedState(api),
53
- dateEnabled = _useSharedState.dateEnabled,
54
- canInsertLink = _useSharedState.canInsertLink,
55
- activeLinkMark = _useSharedState.activeLinkMark,
56
- isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
57
- availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
58
- imageUploadEnabled = _useSharedState.imageUploadEnabled,
59
- placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
60
- emojiProvider = _useSharedState.emojiProvider,
61
- mentionProvider = _useSharedState.mentionProvider,
62
- canInsertMention = _useSharedState.canInsertMention,
63
- mediaAllowsUploads = _useSharedState.mediaAllowsUploads;
25
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector),
26
+ dateEnabled = _useSharedPluginState.dateEnabled,
27
+ canInsertLink = _useSharedPluginState.canInsertLink,
28
+ activeLinkMark = _useSharedPluginState.activeLinkMark,
29
+ isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
30
+ availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
31
+ imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
32
+ placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
33
+ emojiProvider = _useSharedPluginState.emojiProvider,
34
+ mentionProvider = _useSharedPluginState.mentionProvider,
35
+ canInsertMention = _useSharedPluginState.canInsertMention,
36
+ mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads;
64
37
  var _useMemo = useMemo(function () {
65
38
  return createItems({
66
39
  isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "4.3.6",
3
+ "version": "4.3.8",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/editor-plugin-type-ahead": "^3.1.0",
59
59
  "@atlaskit/editor-prosemirror": "7.0.0",
60
60
  "@atlaskit/editor-shared-styles": "^3.6.0",
61
- "@atlaskit/editor-toolbar": "^0.4.0",
61
+ "@atlaskit/editor-toolbar": "^0.5.0",
62
62
  "@atlaskit/editor-toolbar-model": "^0.1.0",
63
63
  "@atlaskit/emoji": "^69.5.0",
64
64
  "@atlaskit/heading": "^5.2.0",
@@ -67,7 +67,7 @@
67
67
  "@atlaskit/platform-feature-flags": "^1.1.0",
68
68
  "@atlaskit/primitives": "^14.12.0",
69
69
  "@atlaskit/theme": "^20.0.0",
70
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
70
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
71
71
  "@atlaskit/tokens": "^6.1.0",
72
72
  "@atlaskit/tooltip": "^20.4.0",
73
73
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "react-virtualized": "^9.8.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^107.32.0",
81
+ "@atlaskit/editor-common": "^107.33.0",
82
82
  "react": "^18.2.0",
83
83
  "react-dom": "^18.2.0",
84
84
  "react-intl-next": "npm:react-intl@^5.18.1"