@atlaskit/editor-plugin-card 7.7.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 7.7.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`05bf548de34be`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05bf548de34be) -
14
+ PR to cleanup platform_editor_usesharedpluginstatewithselector for card
15
+ - Updated dependencies
16
+
3
17
  ## 7.7.2
4
18
 
5
19
  ### Patch Changes
@@ -47,18 +47,6 @@ var selector = function selector(states) {
47
47
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
48
48
  };
49
49
  };
50
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
51
- return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width', 'editorDisabled'], selector);
52
- }, function (pluginInjectionApi) {
53
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['width', 'editorDisabled']),
54
- widthState = _useSharedPluginState.widthState,
55
- editorDisabledState = _useSharedPluginState.editorDisabledState;
56
- return {
57
- widthStateLineLength: (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0,
58
- widthStateWidth: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
59
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
60
- };
61
- });
62
50
  var CardInner = function CardInner(_ref) {
63
51
  var pluginInjectionApi = _ref.pluginInjectionApi,
64
52
  getPosSafely = _ref.getPosSafely,
@@ -73,10 +61,10 @@ var CardInner = function CardInner(_ref) {
73
61
  heightAlone = _ref.heightAlone,
74
62
  cardProps = _ref.cardProps,
75
63
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
76
- var _useSharedState = useSharedState(pluginInjectionApi),
77
- widthStateLineLength = _useSharedState.widthStateLineLength,
78
- widthStateWidth = _useSharedState.widthStateWidth,
79
- editorDisabled = _useSharedState.editorDisabled;
64
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['width', 'editorDisabled'], selector),
65
+ widthStateLineLength = _useSharedPluginState.widthStateLineLength,
66
+ widthStateWidth = _useSharedPluginState.widthStateWidth,
67
+ editorDisabled = _useSharedPluginState.editorDisabled;
80
68
  var pos = getPosSafely();
81
69
  if (pos === undefined) {
82
70
  return null;
@@ -196,23 +196,11 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
196
196
  });
197
197
  var WrappedInlineCardWithAwareness = (0, _genericCard.Card)(_inlineCardWithAwareness.InlineCardWithAwareness, _ui.UnsupportedInline);
198
198
  var selector = function selector(states) {
199
- var _states$editorViewMod, _states$selectionStat;
199
+ var _states$editorViewMod;
200
200
  return {
201
- mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
202
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
201
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
203
202
  };
204
203
  };
205
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
206
- return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
207
- }, function (pluginInjectionApi) {
208
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['selection', 'editorViewMode']),
209
- selectionState = _useSharedPluginState.selectionState,
210
- editorViewModeState = _useSharedPluginState.editorViewModeState;
211
- return {
212
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
213
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
214
- };
215
- });
216
204
 
217
205
  /**
218
206
  *
@@ -233,8 +221,8 @@ function InlineCardNodeView(props) {
233
221
  isPageSSRed = props.isPageSSRed,
234
222
  provider = props.provider,
235
223
  CompetitorPrompt = props.CompetitorPrompt;
236
- var _useSharedState = useSharedState(pluginInjectionApi),
237
- mode = _useSharedState.mode;
224
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['editorViewMode'], selector),
225
+ mode = _useSharedPluginState.mode;
238
226
  var url = node.attrs.url;
239
227
  var CompetitorPromptComponent = CompetitorPrompt && url ? /*#__PURE__*/_react.default.createElement(CompetitorPrompt, {
240
228
  sourceUrl: url,
@@ -26,17 +26,6 @@ var selector = function selector(states) {
26
26
  selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
27
27
  };
28
28
  };
29
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
30
- return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
31
- }, function (pluginInjectionApi) {
32
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['selection', 'editorViewMode']),
33
- selectionState = _useSharedPluginState.selectionState,
34
- editorViewModeState = _useSharedPluginState.editorViewModeState;
35
- return {
36
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
37
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
38
- };
39
- });
40
29
  var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0, _react.memo)(function (_ref) {
41
30
  var _pluginInjectionApi$c;
42
31
  var node = _ref.node,
@@ -91,9 +80,9 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
91
80
  setIsHovered(isHovered);
92
81
  }
93
82
  }, [isOverlayEnabled]);
94
- var _useSharedState = useSharedState(pluginInjectionApi),
95
- mode = _useSharedState.mode,
96
- selection = _useSharedState.selection;
83
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['selection', 'editorViewMode'], selector),
84
+ mode = _useSharedPluginState.mode,
85
+ selection = _useSharedPluginState.selection;
97
86
  var floatingToolbarNode = selection instanceof _state.NodeSelection && selection.node;
98
87
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
99
88
  var showHoverPreview = floatingToolbarNode !== node && (0, _experiments.editorExperiment)('platform_editor_preview_panel_linking_exp', true, {
@@ -9,39 +9,22 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _linkDatasource = require("@atlaskit/link-datasource");
11
11
  var _linkProvider = require("@atlaskit/link-provider");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
12
  var _datasourceErrorBoundary = require("../datasourceErrorBoundary");
14
13
  var _index = require("./index");
15
14
  var selector = function selector(states) {
16
15
  var _states$cardState, _states$cardState2;
17
16
  return {
18
- cardState: undefined,
19
17
  showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
20
18
  datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
21
19
  };
22
20
  };
23
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
24
- return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['card'], selector);
25
- }, function (pluginInjectionApi) {
26
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
27
- cardState = _useSharedPluginState.cardState;
28
- return {
29
- cardState: cardState,
30
- showDatasourceModal: cardState === null || cardState === void 0 ? void 0 : cardState.showDatasourceModal,
31
- datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
32
- };
33
- });
34
21
  var ModalWithState = function ModalWithState(_ref) {
35
22
  var api = _ref.api,
36
23
  editorView = _ref.editorView;
37
24
  var cardContext = (0, _linkProvider.useSmartLinkContext)();
38
- var _useSharedState = useSharedState(api),
39
- cardState = _useSharedState.cardState,
40
- showDatasourceModal = _useSharedState.showDatasourceModal,
41
- datasourceModalType = _useSharedState.datasourceModalType;
42
- if (!cardState && (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
43
- return null;
44
- }
25
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['card'], selector),
26
+ showDatasourceModal = _useSharedPluginState.showDatasourceModal,
27
+ datasourceModalType = _useSharedPluginState.datasourceModalType;
45
28
  if (!showDatasourceModal || !datasourceModalType) {
46
29
  return null;
47
30
  }
@@ -84,16 +84,6 @@ var selector = function selector(states) {
84
84
  datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
85
85
  };
86
86
  };
87
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
88
- return (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['card'], selector);
89
- }, function (pluginInjectionApi) {
90
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['card']),
91
- cardState = _useSharedPluginState.cardState;
92
- return {
93
- layout: cardState === null || cardState === void 0 ? void 0 : cardState.layout,
94
- datasourceTableRef: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceTableRef
95
- };
96
- });
97
87
  var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
98
88
  var _node$attrs;
99
89
  var editorView = _ref2.editorView,
@@ -105,10 +95,10 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
105
95
  var _getDatasource = (0, _utils3.getDatasource)(editorView),
106
96
  node = _getDatasource.node,
107
97
  pos = _getDatasource.pos;
108
- var _useSharedState = useSharedState(api),
109
- _useSharedState$layou = _useSharedState.layout,
110
- layout = _useSharedState$layou === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _useSharedState$layou,
111
- datasourceTableRef = _useSharedState.datasourceTableRef;
98
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['card'], selector),
99
+ _useSharedPluginState2 = _useSharedPluginState.layout,
100
+ layout = _useSharedPluginState2 === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _useSharedPluginState2,
101
+ datasourceTableRef = _useSharedPluginState.datasourceTableRef;
112
102
  var isDatasource = (0, _utils2.isDatasourceNode)(node);
113
103
  if (!isDatasource) {
114
104
  return null;
@@ -5,7 +5,7 @@ import rafSchedule from 'raf-schd';
5
5
  import uuid from 'uuid/v4';
6
6
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
7
7
  import { EditorCardProvider } from '@atlaskit/editor-card-provider';
8
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
10
10
  import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
11
11
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -27,19 +27,6 @@ const selector = states => {
27
27
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
28
28
  };
29
29
  };
30
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
31
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector);
32
- }, pluginInjectionApi => {
33
- const {
34
- widthState,
35
- editorDisabledState
36
- } = useSharedPluginState(pluginInjectionApi, ['width', 'editorDisabled']);
37
- return {
38
- widthStateLineLength: (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0,
39
- widthStateWidth: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
40
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
41
- };
42
- });
43
30
  const CardInner = ({
44
31
  pluginInjectionApi,
45
32
  getPosSafely,
@@ -59,7 +46,7 @@ const CardInner = ({
59
46
  widthStateLineLength,
60
47
  widthStateWidth,
61
48
  editorDisabled
62
- } = useSharedState(pluginInjectionApi);
49
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector);
63
50
  const pos = getPosSafely();
64
51
  if (pos === undefined) {
65
52
  return null;
@@ -4,7 +4,7 @@ import rafSchedule from 'raf-schd';
4
4
  import uuid from 'uuid/v4';
5
5
  import { EditorCardProvider } from '@atlaskit/editor-card-provider';
6
6
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { Card as SmartCard } from '@atlaskit/smart-card';
@@ -169,24 +169,11 @@ export const InlineCard = /*#__PURE__*/memo(({
169
169
  });
170
170
  const WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
171
171
  const selector = states => {
172
- var _states$editorViewMod, _states$selectionStat;
172
+ var _states$editorViewMod;
173
173
  return {
174
- mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
175
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
174
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
176
175
  };
177
176
  };
178
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
179
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
180
- }, pluginInjectionApi => {
181
- const {
182
- selectionState,
183
- editorViewModeState
184
- } = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']);
185
- return {
186
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
187
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
188
- };
189
- });
190
177
 
191
178
  /**
192
179
  *
@@ -211,7 +198,7 @@ export function InlineCardNodeView(props) {
211
198
  } = props;
212
199
  const {
213
200
  mode
214
- } = useSharedState(pluginInjectionApi);
201
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector);
215
202
  const url = node.attrs.url;
216
203
  const CompetitorPromptComponent = CompetitorPrompt && url ? /*#__PURE__*/React.createElement(CompetitorPrompt, {
217
204
  sourceUrl: url,
@@ -1,5 +1,5 @@
1
1
  import React, { memo, useCallback, useMemo, useState } from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
@@ -16,18 +16,6 @@ const selector = states => {
16
16
  selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
17
17
  };
18
18
  };
19
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
20
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
21
- }, pluginInjectionApi => {
22
- const {
23
- selectionState,
24
- editorViewModeState
25
- } = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']);
26
- return {
27
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
28
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
29
- };
30
- });
31
19
  export const InlineCardWithAwareness = /*#__PURE__*/memo(({
32
20
  node,
33
21
  cardContext,
@@ -73,7 +61,7 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
73
61
  const {
74
62
  mode,
75
63
  selection
76
- } = useSharedState(pluginInjectionApi);
64
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
77
65
  const floatingToolbarNode = selection instanceof NodeSelection && selection.node;
78
66
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
79
67
  const showHoverPreview = floatingToolbarNode !== node && editorExperiment('platform_editor_preview_panel_linking_exp', true, {
@@ -1,43 +1,25 @@
1
1
  import React from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
4
4
  import { EditorSmartCardProviderValueGuard, useSmartLinkContext } from '@atlaskit/link-provider';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
5
  import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
7
6
  import { DatasourceModal } from './index';
8
7
  const selector = states => {
9
8
  var _states$cardState, _states$cardState2;
10
9
  return {
11
- cardState: undefined,
12
10
  showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
13
11
  datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
14
12
  };
15
13
  };
16
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
17
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
18
- }, pluginInjectionApi => {
19
- const {
20
- cardState
21
- } = useSharedPluginState(pluginInjectionApi, ['card']);
22
- return {
23
- cardState,
24
- showDatasourceModal: cardState === null || cardState === void 0 ? void 0 : cardState.showDatasourceModal,
25
- datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
26
- };
27
- });
28
14
  const ModalWithState = ({
29
15
  api,
30
16
  editorView
31
17
  }) => {
32
18
  const cardContext = useSmartLinkContext();
33
19
  const {
34
- cardState,
35
20
  showDatasourceModal,
36
21
  datasourceModalType
37
- } = useSharedState(api);
38
- if (!cardState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
39
- return null;
40
- }
22
+ } = useSharedPluginStateWithSelector(api, ['card'], selector);
41
23
  if (!showDatasourceModal || !datasourceModalType) {
42
24
  return null;
43
25
  }
@@ -7,7 +7,7 @@ import { useCallback, 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 { injectIntl } from 'react-intl-next';
10
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { Popup } from '@atlaskit/editor-common/ui';
12
12
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
13
13
  import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
@@ -78,17 +78,6 @@ const selector = states => {
78
78
  datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
79
79
  };
80
80
  };
81
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
82
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
83
- }, pluginInjectionApi => {
84
- const {
85
- cardState
86
- } = useSharedPluginState(pluginInjectionApi, ['card']);
87
- return {
88
- layout: cardState === null || cardState === void 0 ? void 0 : cardState.layout,
89
- datasourceTableRef: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceTableRef
90
- };
91
- });
92
81
  const LayoutButtonWrapper = ({
93
82
  editorView,
94
83
  mountPoint,
@@ -105,7 +94,7 @@ const LayoutButtonWrapper = ({
105
94
  const {
106
95
  layout = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined,
107
96
  datasourceTableRef
108
- } = useSharedState(api);
97
+ } = useSharedPluginStateWithSelector(api, ['card'], selector);
109
98
  const isDatasource = isDatasourceNode(node);
110
99
  if (!isDatasource) {
111
100
  return null;
@@ -18,7 +18,7 @@ import rafSchedule from 'raf-schd';
18
18
  import uuid from 'uuid/v4';
19
19
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
20
20
  import { EditorCardProvider } from '@atlaskit/editor-card-provider';
21
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
21
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
22
22
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
23
23
  import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
24
24
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -40,18 +40,6 @@ var selector = function selector(states) {
40
40
  editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
41
41
  };
42
42
  };
43
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
44
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector);
45
- }, function (pluginInjectionApi) {
46
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'editorDisabled']),
47
- widthState = _useSharedPluginState.widthState,
48
- editorDisabledState = _useSharedPluginState.editorDisabledState;
49
- return {
50
- widthStateLineLength: (widthState === null || widthState === void 0 ? void 0 : widthState.lineLength) || 0,
51
- widthStateWidth: (widthState === null || widthState === void 0 ? void 0 : widthState.width) || 0,
52
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
53
- };
54
- });
55
43
  var CardInner = function CardInner(_ref) {
56
44
  var pluginInjectionApi = _ref.pluginInjectionApi,
57
45
  getPosSafely = _ref.getPosSafely,
@@ -66,10 +54,10 @@ var CardInner = function CardInner(_ref) {
66
54
  heightAlone = _ref.heightAlone,
67
55
  cardProps = _ref.cardProps,
68
56
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
69
- var _useSharedState = useSharedState(pluginInjectionApi),
70
- widthStateLineLength = _useSharedState.widthStateLineLength,
71
- widthStateWidth = _useSharedState.widthStateWidth,
72
- editorDisabled = _useSharedState.editorDisabled;
57
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector),
58
+ widthStateLineLength = _useSharedPluginState.widthStateLineLength,
59
+ widthStateWidth = _useSharedPluginState.widthStateWidth,
60
+ editorDisabled = _useSharedPluginState.editorDisabled;
73
61
  var pos = getPosSafely();
74
62
  if (pos === undefined) {
75
63
  return null;
@@ -7,7 +7,7 @@ import rafSchedule from 'raf-schd';
7
7
  import uuid from 'uuid/v4';
8
8
  import { EditorCardProvider } from '@atlaskit/editor-card-provider';
9
9
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import { Card as SmartCard } from '@atlaskit/smart-card';
@@ -185,23 +185,11 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
185
185
  });
186
186
  var WrappedInlineCardWithAwareness = Card(InlineCardWithAwareness, UnsupportedInline);
187
187
  var selector = function selector(states) {
188
- var _states$editorViewMod, _states$selectionStat;
188
+ var _states$editorViewMod;
189
189
  return {
190
- mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
191
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
190
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
192
191
  };
193
192
  };
194
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
195
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
196
- }, function (pluginInjectionApi) {
197
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']),
198
- selectionState = _useSharedPluginState.selectionState,
199
- editorViewModeState = _useSharedPluginState.editorViewModeState;
200
- return {
201
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
202
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
203
- };
204
- });
205
193
 
206
194
  /**
207
195
  *
@@ -222,8 +210,8 @@ export function InlineCardNodeView(props) {
222
210
  isPageSSRed = props.isPageSSRed,
223
211
  provider = props.provider,
224
212
  CompetitorPrompt = props.CompetitorPrompt;
225
- var _useSharedState = useSharedState(pluginInjectionApi),
226
- mode = _useSharedState.mode;
213
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['editorViewMode'], selector),
214
+ mode = _useSharedPluginState.mode;
227
215
  var url = node.attrs.url;
228
216
  var CompetitorPromptComponent = CompetitorPrompt && url ? /*#__PURE__*/React.createElement(CompetitorPrompt, {
229
217
  sourceUrl: url,
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { memo, useCallback, useMemo, useState } from 'react';
3
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { HoverLinkOverlay } from '@atlaskit/editor-common/ui';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { getObjectAri, getObjectName, getObjectIconUrl } from '@atlaskit/smart-card';
@@ -17,17 +17,6 @@ var selector = function selector(states) {
17
17
  selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
18
18
  };
19
19
  };
20
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
21
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector);
22
- }, function (pluginInjectionApi) {
23
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['selection', 'editorViewMode']),
24
- selectionState = _useSharedPluginState.selectionState,
25
- editorViewModeState = _useSharedPluginState.editorViewModeState;
26
- return {
27
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
28
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
29
- };
30
- });
31
20
  export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
32
21
  var _pluginInjectionApi$c;
33
22
  var node = _ref.node,
@@ -82,9 +71,9 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
82
71
  setIsHovered(isHovered);
83
72
  }
84
73
  }, [isOverlayEnabled]);
85
- var _useSharedState = useSharedState(pluginInjectionApi),
86
- mode = _useSharedState.mode,
87
- selection = _useSharedState.selection;
74
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['selection', 'editorViewMode'], selector),
75
+ mode = _useSharedPluginState.mode,
76
+ selection = _useSharedPluginState.selection;
88
77
  var floatingToolbarNode = selection instanceof NodeSelection && selection.node;
89
78
  // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
90
79
  var showHoverPreview = floatingToolbarNode !== node && editorExperiment('platform_editor_preview_panel_linking_exp', true, {
@@ -1,40 +1,23 @@
1
1
  import React from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
4
4
  import { EditorSmartCardProviderValueGuard, useSmartLinkContext } from '@atlaskit/link-provider';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
5
  import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
7
6
  import { DatasourceModal } from './index';
8
7
  var selector = function selector(states) {
9
8
  var _states$cardState, _states$cardState2;
10
9
  return {
11
- cardState: undefined,
12
10
  showDatasourceModal: (_states$cardState = states.cardState) === null || _states$cardState === void 0 ? void 0 : _states$cardState.showDatasourceModal,
13
11
  datasourceModalType: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceModalType
14
12
  };
15
13
  };
16
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
17
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
18
- }, function (pluginInjectionApi) {
19
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['card']),
20
- cardState = _useSharedPluginState.cardState;
21
- return {
22
- cardState: cardState,
23
- showDatasourceModal: cardState === null || cardState === void 0 ? void 0 : cardState.showDatasourceModal,
24
- datasourceModalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
25
- };
26
- });
27
14
  var ModalWithState = function ModalWithState(_ref) {
28
15
  var api = _ref.api,
29
16
  editorView = _ref.editorView;
30
17
  var cardContext = useSmartLinkContext();
31
- var _useSharedState = useSharedState(api),
32
- cardState = _useSharedState.cardState,
33
- showDatasourceModal = _useSharedState.showDatasourceModal,
34
- datasourceModalType = _useSharedState.datasourceModalType;
35
- if (!cardState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
36
- return null;
37
- }
18
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['card'], selector),
19
+ showDatasourceModal = _useSharedPluginState.showDatasourceModal,
20
+ datasourceModalType = _useSharedPluginState.datasourceModalType;
38
21
  if (!showDatasourceModal || !datasourceModalType) {
39
22
  return null;
40
23
  }
@@ -10,7 +10,7 @@ import { useCallback, useMemo } from 'react';
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { injectIntl } from 'react-intl-next';
13
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
14
  import { Popup } from '@atlaskit/editor-common/ui';
15
15
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
16
16
  import { getNextBreakoutMode, getTitle } from '@atlaskit/editor-common/utils';
@@ -80,16 +80,6 @@ var selector = function selector(states) {
80
80
  datasourceTableRef: (_states$cardState2 = states.cardState) === null || _states$cardState2 === void 0 ? void 0 : _states$cardState2.datasourceTableRef
81
81
  };
82
82
  };
83
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
84
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['card'], selector);
85
- }, function (pluginInjectionApi) {
86
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['card']),
87
- cardState = _useSharedPluginState.cardState;
88
- return {
89
- layout: cardState === null || cardState === void 0 ? void 0 : cardState.layout,
90
- datasourceTableRef: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceTableRef
91
- };
92
- });
93
83
  var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
94
84
  var _node$attrs;
95
85
  var editorView = _ref2.editorView,
@@ -101,10 +91,10 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
101
91
  var _getDatasource = getDatasource(editorView),
102
92
  node = _getDatasource.node,
103
93
  pos = _getDatasource.pos;
104
- var _useSharedState = useSharedState(api),
105
- _useSharedState$layou = _useSharedState.layout,
106
- layout = _useSharedState$layou === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _useSharedState$layou,
107
- datasourceTableRef = _useSharedState.datasourceTableRef;
94
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['card'], selector),
95
+ _useSharedPluginState2 = _useSharedPluginState.layout,
96
+ layout = _useSharedPluginState2 === void 0 ? (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) || undefined : _useSharedPluginState2,
97
+ datasourceTableRef = _useSharedPluginState.datasourceTableRef;
108
98
  var isDatasource = isDatasourceNode(node);
109
99
  if (!isDatasource) {
110
100
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "7.7.2",
3
+ "version": "8.0.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,16 +34,16 @@
34
34
  "@atlaskit/button": "^23.4.0",
35
35
  "@atlaskit/custom-steps": "^0.11.0",
36
36
  "@atlaskit/editor-card-provider": "^5.6.0",
37
- "@atlaskit/editor-plugin-analytics": "^3.0.0",
38
- "@atlaskit/editor-plugin-base": "^4.1.0",
39
- "@atlaskit/editor-plugin-connectivity": "^3.1.0",
40
- "@atlaskit/editor-plugin-decorations": "^3.1.0",
41
- "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
42
- "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
43
- "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
44
- "@atlaskit/editor-plugin-floating-toolbar": "^5.2.0",
45
- "@atlaskit/editor-plugin-grid": "^3.1.0",
46
- "@atlaskit/editor-plugin-width": "^4.0.0",
37
+ "@atlaskit/editor-plugin-analytics": "^4.0.0",
38
+ "@atlaskit/editor-plugin-base": "^5.0.0",
39
+ "@atlaskit/editor-plugin-connectivity": "^4.0.0",
40
+ "@atlaskit/editor-plugin-decorations": "^4.0.0",
41
+ "@atlaskit/editor-plugin-editor-disabled": "^4.0.0",
42
+ "@atlaskit/editor-plugin-editor-viewmode": "^6.0.0",
43
+ "@atlaskit/editor-plugin-feature-flags": "^3.0.0",
44
+ "@atlaskit/editor-plugin-floating-toolbar": "^6.0.0",
45
+ "@atlaskit/editor-plugin-grid": "^4.0.0",
46
+ "@atlaskit/editor-plugin-width": "^5.0.0",
47
47
  "@atlaskit/editor-prosemirror": "7.0.0",
48
48
  "@atlaskit/editor-shared-styles": "^3.6.0",
49
49
  "@atlaskit/frontend-utilities": "^3.1.0",
@@ -51,16 +51,16 @@
51
51
  "@atlaskit/link": "^3.2.0",
52
52
  "@atlaskit/link-analytics": "^10.0.0",
53
53
  "@atlaskit/link-client-extension": "^5.0.0",
54
- "@atlaskit/link-datasource": "^4.20.0",
54
+ "@atlaskit/link-datasource": "^4.21.0",
55
55
  "@atlaskit/linking-common": "^9.5.0",
56
56
  "@atlaskit/linking-types": "^14.0.0",
57
57
  "@atlaskit/menu": "^8.3.0",
58
58
  "@atlaskit/platform-feature-flags": "^1.1.0",
59
59
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
60
60
  "@atlaskit/primitives": "^14.12.0",
61
- "@atlaskit/smart-card": "^40.15.0",
61
+ "@atlaskit/smart-card": "^40.17.0",
62
62
  "@atlaskit/theme": "^20.0.0",
63
- "@atlaskit/tmp-editor-statsig": "^11.11.0",
63
+ "@atlaskit/tmp-editor-statsig": "^12.0.0",
64
64
  "@atlaskit/tokens": "^6.1.0",
65
65
  "@babel/runtime": "^7.0.0",
66
66
  "@emotion/react": "^11.7.1",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^107.34.0",
73
+ "@atlaskit/editor-common": "^108.0.0",
74
74
  "@atlaskit/link-provider": "^3.7.0",
75
75
  "react": "^18.2.0",
76
76
  "react-intl-next": "npm:react-intl@^5.18.1"