@atlaskit/editor-plugin-table 13.0.5 → 13.0.6

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
  3. package/dist/cjs/nodeviews/TableContainer.js +14 -53
  4. package/dist/cjs/nodeviews/TableResizer.js +2 -15
  5. package/dist/cjs/tablePlugin.js +30 -213
  6. package/dist/cjs/ui/DragHandle/index.js +9 -26
  7. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
  8. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
  9. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
  10. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
  11. package/dist/cjs/ui/global-styles.js +4 -17
  12. package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
  13. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
  14. package/dist/es2019/nodeviews/TableContainer.js +11 -54
  15. package/dist/es2019/nodeviews/TableResizer.js +2 -17
  16. package/dist/es2019/tablePlugin.js +19 -211
  17. package/dist/es2019/ui/DragHandle/index.js +8 -27
  18. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
  19. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
  20. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
  21. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
  22. package/dist/es2019/ui/global-styles.js +6 -21
  23. package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
  24. package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
  25. package/dist/esm/nodeviews/TableContainer.js +15 -54
  26. package/dist/esm/nodeviews/TableResizer.js +3 -16
  27. package/dist/esm/tablePlugin.js +24 -208
  28. package/dist/esm/ui/DragHandle/index.js +10 -27
  29. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
  30. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
  31. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
  32. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
  33. package/dist/esm/ui/global-styles.js +5 -18
  34. package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
  35. package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  36. package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  37. package/package.json +2 -2
@@ -254,29 +254,6 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
254
254
  height: previewHeight
255
255
  }), previewContainer));
256
256
  };
257
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
258
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table'], function (states) {
259
- var _states$tableState, _states$tableState2;
260
- return {
261
- hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
262
- hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
263
- };
264
- }),
265
- hoveredColumns = _useSharedPluginState.hoveredColumns,
266
- hoveredRows = _useSharedPluginState.hoveredRows;
267
- return {
268
- hoveredColumns: hoveredColumns,
269
- hoveredRows: hoveredRows
270
- };
271
- }, function (api) {
272
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['table']),
273
- tableState = _useSharedPluginState2.tableState;
274
- var tableStateInternal = tableState;
275
- return {
276
- hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
277
- hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
278
- };
279
- });
280
257
  var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
281
258
  var isDragMenuTarget = _ref5.isDragMenuTarget,
282
259
  tableLocalId = _ref5.tableLocalId,
@@ -294,9 +271,15 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
294
271
  editorView = _ref5.editorView,
295
272
  intl = _ref5.intl,
296
273
  api = _ref5.api;
297
- var _useSharedState = useSharedState(api),
298
- hoveredColumns = _useSharedState.hoveredColumns,
299
- hoveredRows = _useSharedState.hoveredRows;
274
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table'], function (states) {
275
+ var _states$tableState, _states$tableState2;
276
+ return {
277
+ hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
278
+ hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
279
+ };
280
+ }),
281
+ hoveredColumns = _useSharedPluginState.hoveredColumns,
282
+ hoveredRows = _useSharedPluginState.hoveredRows;
300
283
  return /*#__PURE__*/_react.default.createElement(DragHandleComponent, {
301
284
  isDragMenuTarget: isDragMenuTarget,
302
285
  tableLocalId: tableLocalId,
@@ -31,24 +31,6 @@ var getSelectedColumns = function getSelectedColumns(selection) {
31
31
  }
32
32
  return [];
33
33
  };
34
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
35
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
36
- var _states$selectionStat;
37
- return {
38
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
39
- };
40
- }),
41
- selection = _useSharedPluginState.selection;
42
- return {
43
- selection: selection
44
- };
45
- }, function (api) {
46
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['selection']),
47
- selectionState = _useSharedPluginState2.selectionState;
48
- return {
49
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
50
- };
51
- });
52
34
  var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
53
35
  var _colWidths$map$join;
54
36
  var editorView = _ref.editorView,
@@ -67,8 +49,13 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
67
49
  getScrollOffset = _ref.getScrollOffset,
68
50
  api = _ref.api;
69
51
  var columnControlsRef = (0, _react.useRef)(null);
70
- var _useSharedState = useSharedState(api),
71
- selection = _useSharedState.selection;
52
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
53
+ var _states$selectionStat;
54
+ return {
55
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
56
+ };
57
+ }),
58
+ selection = _useSharedPluginState.selection;
72
59
  var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
73
60
  return (
74
61
  // when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
@@ -58,7 +58,12 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
58
58
  className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
59
59
  }));
60
60
  };
61
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
61
+ var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
62
+ var editorView = _ref2.editorView,
63
+ isInDanger = _ref2.isInDanger,
64
+ isResizing = _ref2.isResizing,
65
+ formatMessage = _ref2.intl.formatMessage,
66
+ api = _ref2.api;
62
67
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
63
68
  var _states$selectionStat;
64
69
  return {
@@ -66,24 +71,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
66
71
  };
67
72
  }),
68
73
  selection = _useSharedPluginState.selection;
69
- return {
70
- selection: selection
71
- };
72
- }, function (api) {
73
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['selection']),
74
- selectionState = _useSharedPluginState2.selectionState;
75
- return {
76
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
77
- };
78
- });
79
- var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
80
- var editorView = _ref2.editorView,
81
- isInDanger = _ref2.isInDanger,
82
- isResizing = _ref2.isResizing,
83
- formatMessage = _ref2.intl.formatMessage,
84
- api = _ref2.api;
85
- var _useSharedState = useSharedState(api),
86
- selection = _useSharedState.selection;
87
74
  var handleOnClick = function handleOnClick() {
88
75
  var state = editorView.state,
89
76
  dispatch = editorView.dispatch;
@@ -9,24 +9,6 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _ClassicCornerControls = require("./CornerControls/ClassicCornerControls");
11
11
  var _ClassicControls = require("./RowControls/ClassicControls");
12
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
13
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
14
- var _states$selectionStat;
15
- return {
16
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
17
- };
18
- }),
19
- selection = _useSharedPluginState.selection;
20
- return {
21
- selection: selection
22
- };
23
- }, function (api) {
24
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['selection']),
25
- selectionState = _useSharedPluginState2.selectionState;
26
- return {
27
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
28
- };
29
- });
30
12
  var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = function FloatingControlsWithSelection(_ref) {
31
13
  var editorView = _ref.editorView,
32
14
  tableRef = _ref.tableRef,
@@ -40,8 +22,13 @@ var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = func
40
22
  selectRow = _ref.selectRow,
41
23
  tableActive = _ref.tableActive,
42
24
  api = _ref.api;
43
- var _useSharedState = useSharedState(api),
44
- selection = _useSharedState.selection;
25
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
26
+ var _states$selectionStat;
27
+ return {
28
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
29
+ };
30
+ }),
31
+ selection = _useSharedPluginState.selection;
45
32
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClassicCornerControls.CornerControls, {
46
33
  editorView: editorView,
47
34
  tableRef: tableRef,
@@ -286,24 +286,6 @@ var DragControls = exports.DragControls = function DragControls(_ref) {
286
286
  }), rowHandles())
287
287
  );
288
288
  };
289
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
290
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
291
- var _states$selectionStat;
292
- return {
293
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
294
- };
295
- }),
296
- selection = _useSharedPluginState.selection;
297
- return {
298
- selection: selection
299
- };
300
- }, function (api) {
301
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['selection']),
302
- selectionState = _useSharedPluginState2.selectionState;
303
- return {
304
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
305
- };
306
- });
307
289
  var DragControlsWithSelection = exports.DragControlsWithSelection = function DragControlsWithSelection(_ref5) {
308
290
  var editorView = _ref5.editorView,
309
291
  tableRef = _ref5.tableRef,
@@ -319,8 +301,13 @@ var DragControlsWithSelection = exports.DragControlsWithSelection = function Dra
319
301
  selectRows = _ref5.selectRows,
320
302
  updateCellHoverLocation = _ref5.updateCellHoverLocation,
321
303
  api = _ref5.api;
322
- var _useSharedState = useSharedState(api),
323
- selection = _useSharedState.selection;
304
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
305
+ var _states$selectionStat;
306
+ return {
307
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
308
+ };
309
+ }),
310
+ selection = _useSharedPluginState.selection;
324
311
  return /*#__PURE__*/_react.default.createElement(DragControls, {
325
312
  editorView: editorView,
326
313
  tableRef: tableRef,
@@ -13,7 +13,10 @@ var _commonStyles = require("./common-styles");
13
13
  */
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
15
15
 
16
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
16
+ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
17
+ var featureFlags = _ref.featureFlags,
18
+ isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
19
+ api = _ref.api;
17
20
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
18
21
  var _states$editorViewMod;
19
22
  return {
@@ -21,22 +24,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
21
24
  };
22
25
  }),
23
26
  mode = _useSharedPluginState.mode;
24
- return {
25
- mode: mode
26
- };
27
- }, function (api) {
28
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
29
- editorViewModeState = _useSharedPluginState2.editorViewModeState;
30
- return {
31
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
32
- };
33
- });
34
- var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
35
- var featureFlags = _ref.featureFlags,
36
- isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
37
- api = _ref.api;
38
- var _useSharedState = useSharedState(api),
39
- mode = _useSharedState.mode;
40
27
  var isLivePageViewMode = mode === 'view';
41
28
  return (0, _react.jsx)(_react.Global, {
42
29
  styles: (0, _commonStyles.tableStyles)({
@@ -8,27 +8,14 @@ exports.SortingIconWrapper = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _table = require("@atlaskit/editor-common/table");
11
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
12
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
11
+ var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
12
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(props.api, ['editorViewMode'], function (states) {
13
13
  var _states$editorViewMod;
14
14
  return {
15
15
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
16
16
  };
17
17
  }),
18
18
  mode = _useSharedPluginState.mode;
19
- return {
20
- mode: mode
21
- };
22
- }, function (api) {
23
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
24
- editorViewModeState = _useSharedPluginState2.editorViewModeState;
25
- return {
26
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
27
- };
28
- });
29
- var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
30
- var _useSharedState = useSharedState(props.api),
31
- mode = _useSharedState.mode;
32
19
  if (mode === 'edit') {
33
20
  return null;
34
21
  }
@@ -1,14 +1,29 @@
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 { findTable } from '@atlaskit/editor-tables';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
4
  import TableComponent from './TableComponent';
7
5
 
8
6
  // Ignored via go/ees005
9
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
8
 
11
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
9
+ /**
10
+ * Use useSharedPluginState to control re-renders from plugin dependencies
11
+ */
12
+ export const TableComponentWithSharedState = ({
13
+ view,
14
+ options,
15
+ getNode,
16
+ dispatchAnalyticsEvent,
17
+ api,
18
+ getEditorFeatureFlags,
19
+ eventDispatcher,
20
+ allowColumnResizing,
21
+ allowControls,
22
+ getPos,
23
+ forwardRef,
24
+ allowTableAlignment,
25
+ allowTableResizing
26
+ }) => {
12
27
  const {
13
28
  isTableResizing,
14
29
  isHeaderColumnEnabled,
@@ -55,100 +70,7 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
55
70
  interaction: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState
56
71
  };
57
72
  });
58
- return {
59
- tableState: undefined,
60
- widthState: undefined,
61
- isTableResizing,
62
- isHeaderColumnEnabled,
63
- isHeaderRowEnabled,
64
- ordering,
65
- isResizing,
66
- isInDanger,
67
- hoveredCell,
68
- hoveredRows,
69
- isTableHovered,
70
- isWholeTableInDanger,
71
- isFullscreen,
72
- selection,
73
- mode,
74
- width,
75
- lineLength,
76
- interaction
77
- };
78
- }, api => {
79
- const {
80
- widthState,
81
- tableState,
82
- mediaState,
83
- selectionState,
84
- editorViewModeState,
85
- interactionState
86
- } = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']);
87
- const tableStateInternal = tableState;
88
- return {
89
- tableState,
90
- widthState,
91
- isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
92
- isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
93
- isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
94
- ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
95
- isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
96
- isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
97
- hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
98
- hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
99
- isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
100
- isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
101
- isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
102
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
103
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
104
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
105
- lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
106
- interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
107
- };
108
- });
109
-
110
- /**
111
- * Use useSharedPluginState to control re-renders from plugin dependencies
112
- */
113
- export const TableComponentWithSharedState = ({
114
- view,
115
- options,
116
- getNode,
117
- dispatchAnalyticsEvent,
118
- api,
119
- getEditorFeatureFlags,
120
- eventDispatcher,
121
- allowColumnResizing,
122
- allowControls,
123
- getPos,
124
- forwardRef,
125
- allowTableAlignment,
126
- allowTableResizing
127
- }) => {
128
- const {
129
- tableState,
130
- widthState,
131
- mode,
132
- hoveredCell,
133
- hoveredRows,
134
- isFullscreen,
135
- isHeaderColumnEnabled,
136
- isHeaderRowEnabled,
137
- isInDanger,
138
- isResizing,
139
- isTableHovered,
140
- isTableResizing,
141
- isWholeTableInDanger,
142
- lineLength,
143
- ordering,
144
- selection,
145
- width,
146
- interaction
147
- } = useSharedState(api);
148
73
  const isLivePageViewMode = mode === 'view';
149
- if (expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
150
- return null;
151
- }
152
74
 
153
75
  /**
154
76
  * ED-19810
@@ -182,13 +104,10 @@ export const TableComponentWithSharedState = ({
182
104
  ordering: ordering,
183
105
  isResizing: isResizing,
184
106
  getNode: getNode,
185
- containerWidth: editorExperiment('platform_editor_usesharedpluginstatewithselector', true) ? {
107
+ containerWidth: {
186
108
  width: width !== null && width !== void 0 ? width : 0,
187
109
  lineLength
188
- } :
189
- // Ignored via go/ees005
190
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
191
- widthState,
110
+ },
192
111
  contentDOM: forwardRef,
193
112
  getEditorFeatureFlags: getEditorFeatureFlags,
194
113
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -3,7 +3,7 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
3
3
  import classNames from 'classnames';
4
4
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { isSSR } from '@atlaskit/editor-common/core-utils';
6
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
8
8
  import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -36,32 +36,6 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
36
36
  "data-testid": "table-container"
37
37
  }, children);
38
38
  });
39
- const useAlignmentTableContainerSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
40
- const {
41
- isFullWidthModeEnabled,
42
- wasFullWidthModeEnabled
43
- } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
44
- var _states$tableState, _states$tableState2;
45
- return {
46
- isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
47
- wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
48
- };
49
- });
50
- return {
51
- tableState: undefined,
52
- isFullWidthModeEnabled,
53
- wasFullWidthModeEnabled
54
- };
55
- }, pluginInjectionApi => {
56
- const {
57
- tableState
58
- } = useSharedPluginState(pluginInjectionApi, ['table']);
59
- return {
60
- tableState,
61
- isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
62
- wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
63
- };
64
- });
65
39
  const AlignmentTableContainer = ({
66
40
  node,
67
41
  children,
@@ -71,14 +45,16 @@ const AlignmentTableContainer = ({
71
45
  }) => {
72
46
  const alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
73
47
  const {
74
- tableState,
75
48
  isFullWidthModeEnabled,
76
49
  wasFullWidthModeEnabled
77
- } = useAlignmentTableContainerSharedState(pluginInjectionApi);
50
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
51
+ var _states$tableState, _states$tableState2;
52
+ return {
53
+ isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
54
+ wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
55
+ };
56
+ });
78
57
  useEffect(() => {
79
- if (!tableState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
80
- return;
81
- }
82
58
  if (editorView && getPos) {
83
59
  const {
84
60
  state,
@@ -97,7 +73,7 @@ const AlignmentTableContainer = ({
97
73
  }
98
74
  }
99
75
  // eslint-disable-next-line react-hooks/exhaustive-deps
100
- }, [editorView, tableState, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
76
+ }, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
101
77
  const style = useMemo(() => {
102
78
  return getAlignmentStyle(alignment);
103
79
  }, [alignment]);
@@ -142,25 +118,6 @@ const selector = states => ({
142
118
  tableState: states.tableState,
143
119
  editorViewModeState: states.editorViewModeState
144
120
  });
145
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
146
- const {
147
- tableState,
148
- editorViewModeState
149
- } = useSharedPluginStateWithSelector(api, ['table', 'editorViewMode'], selector);
150
- return {
151
- tableState,
152
- editorViewModeState
153
- };
154
- }, api => {
155
- const {
156
- tableState,
157
- editorViewModeState
158
- } = useSharedPluginState(api, ['table', 'editorViewMode']);
159
- return {
160
- tableState,
161
- editorViewModeState
162
- };
163
- });
164
121
  const getPadding = containerWidth => {
165
122
  return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
166
123
  };
@@ -189,7 +146,7 @@ const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
189
146
  const {
190
147
  tableState,
191
148
  editorViewModeState
192
- } = useSharedState(pluginInjectionApi);
149
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
193
150
  const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
194
151
  const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
195
152
  const updateContainerHeight = useCallback(height => {
@@ -386,7 +343,7 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
386
343
  const {
387
344
  tableState,
388
345
  editorViewModeState
389
- } = useSharedState(pluginInjectionApi);
346
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
390
347
  const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
391
348
  const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
392
349
  const updateContainerHeight = useCallback(height => {
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl-next';
4
4
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
5
5
  import { browser } from '@atlaskit/editor-common/browser';
6
6
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
7
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
9
9
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
10
10
  import { logException } from '@atlaskit/editor-common/monitoring';
@@ -103,21 +103,6 @@ const selector = states => {
103
103
  widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
104
104
  };
105
105
  };
106
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
107
- const {
108
- widthToWidest
109
- } = useSharedPluginStateWithSelector(api, ['table'], selector);
110
- return {
111
- widthToWidest
112
- };
113
- }, api => {
114
- const {
115
- tableState
116
- } = useSharedPluginState(api, ['table']);
117
- return {
118
- widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
119
- };
120
- });
121
106
  export const TableResizer = ({
122
107
  children,
123
108
  width,
@@ -153,7 +138,7 @@ export const TableResizer = ({
153
138
  const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
154
139
  const {
155
140
  widthToWidest
156
- } = useSharedState(pluginInjectionApi);
141
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], selector);
157
142
 
158
143
  // used to reposition tooltip when table is resizing via keyboard
159
144
  const updateTooltip = React.useRef();