@atlaskit/editor-plugin-table 10.9.19 → 10.9.21

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 (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +91 -78
  3. package/dist/cjs/nodeviews/TableContainer.js +41 -37
  4. package/dist/cjs/nodeviews/TableResizer.js +15 -11
  5. package/dist/cjs/tablePlugin.js +14 -10
  6. package/dist/cjs/ui/ContentComponent.js +21 -64
  7. package/dist/cjs/ui/DragHandle/index.js +19 -17
  8. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +14 -11
  9. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -10
  10. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +14 -10
  11. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -10
  12. package/dist/cjs/ui/global-styles.js +14 -10
  13. package/dist/cjs/ui/icons/SortingIconWrapper.js +14 -11
  14. package/dist/cjs/ui/toolbar.js +5 -0
  15. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +92 -78
  16. package/dist/es2019/nodeviews/TableContainer.js +44 -39
  17. package/dist/es2019/nodeviews/TableResizer.js +17 -12
  18. package/dist/es2019/tablePlugin.js +16 -11
  19. package/dist/es2019/ui/ContentComponent.js +21 -64
  20. package/dist/es2019/ui/DragHandle/index.js +21 -18
  21. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -12
  22. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +16 -11
  23. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +16 -11
  24. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -11
  25. package/dist/es2019/ui/global-styles.js +16 -11
  26. package/dist/es2019/ui/icons/SortingIconWrapper.js +16 -12
  27. package/dist/es2019/ui/toolbar.js +5 -0
  28. package/dist/esm/nodeviews/TableComponentWithSharedState.js +92 -79
  29. package/dist/esm/nodeviews/TableContainer.js +42 -38
  30. package/dist/esm/nodeviews/TableResizer.js +16 -12
  31. package/dist/esm/tablePlugin.js +15 -11
  32. package/dist/esm/ui/ContentComponent.js +21 -64
  33. package/dist/esm/ui/DragHandle/index.js +20 -18
  34. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +15 -12
  35. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +15 -11
  36. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +15 -11
  37. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +15 -11
  38. package/dist/esm/ui/global-styles.js +15 -11
  39. package/dist/esm/ui/icons/SortingIconWrapper.js +15 -12
  40. package/dist/esm/ui/toolbar.js +5 -0
  41. package/package.json +8 -5
  42. package/src/nodeviews/TableComponentWithSharedState.tsx +97 -125
  43. package/src/nodeviews/TableContainer.tsx +59 -67
  44. package/src/nodeviews/TableResizer.tsx +21 -17
  45. package/src/tablePlugin.tsx +24 -13
  46. package/src/ui/ContentComponent.tsx +19 -64
  47. package/src/ui/DragHandle/index.tsx +24 -24
  48. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +21 -14
  49. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +20 -12
  50. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +20 -13
  51. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +20 -13
  52. package/src/ui/global-styles.tsx +20 -13
  53. package/src/ui/icons/SortingIconWrapper.tsx +20 -14
  54. package/src/ui/toolbar.tsx +7 -0
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
2
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
3
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
4
4
  import { findTable } from '@atlaskit/editor-tables';
5
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -9,6 +9,79 @@ import TableComponent from './TableComponent';
9
9
  // Ignored via go/ees005
10
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
11
 
12
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
13
+ // tableState
14
+ var isTableResizing = useInternalTablePluginStateSelector(api, 'isTableResizing');
15
+ var isHeaderColumnEnabled = useInternalTablePluginStateSelector(api, 'isHeaderColumnEnabled');
16
+ var isHeaderRowEnabled = useInternalTablePluginStateSelector(api, 'isHeaderRowEnabled');
17
+ var ordering = useInternalTablePluginStateSelector(api, 'ordering');
18
+ var isResizing = useInternalTablePluginStateSelector(api, 'isResizing');
19
+ var isInDanger = useInternalTablePluginStateSelector(api, 'isInDanger');
20
+ var hoveredCell = useInternalTablePluginStateSelector(api, 'hoveredCell');
21
+ var hoveredRows = useInternalTablePluginStateSelector(api, 'hoveredRows');
22
+ var isTableHovered = useInternalTablePluginStateSelector(api, 'isTableHovered');
23
+ var isWholeTableInDanger = useInternalTablePluginStateSelector(api, 'isWholeTableInDanger');
24
+
25
+ // mediaState
26
+ var isFullscreen = useSharedPluginStateSelector(api, 'media.isFullscreen');
27
+
28
+ // selectionState
29
+ var selection = useSharedPluginStateSelector(api, 'selection.selection');
30
+
31
+ // editorViewModeState
32
+ var mode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
33
+
34
+ // widthState
35
+ var width = useSharedPluginStateSelector(api, 'width.width');
36
+ var lineLength = useSharedPluginStateSelector(api, 'width.lineLength');
37
+ return {
38
+ tableState: undefined,
39
+ widthState: undefined,
40
+ isTableResizing: isTableResizing,
41
+ isHeaderColumnEnabled: isHeaderColumnEnabled,
42
+ isHeaderRowEnabled: isHeaderRowEnabled,
43
+ ordering: ordering,
44
+ isResizing: isResizing,
45
+ isInDanger: isInDanger,
46
+ hoveredCell: hoveredCell,
47
+ hoveredRows: hoveredRows,
48
+ isTableHovered: isTableHovered,
49
+ isWholeTableInDanger: isWholeTableInDanger,
50
+ isFullscreen: isFullscreen,
51
+ selection: selection,
52
+ mode: mode,
53
+ width: width,
54
+ lineLength: lineLength
55
+ };
56
+ }, function (api) {
57
+ var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode']),
58
+ widthState = _useSharedPluginState.widthState,
59
+ tableState = _useSharedPluginState.tableState,
60
+ mediaState = _useSharedPluginState.mediaState,
61
+ selectionState = _useSharedPluginState.selectionState,
62
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
63
+ var tableStateInternal = tableState;
64
+ return {
65
+ tableState: tableState,
66
+ widthState: widthState,
67
+ isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
68
+ isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
69
+ isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
70
+ ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
71
+ isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
72
+ isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
73
+ hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
74
+ hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
75
+ isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
76
+ isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
77
+ isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
78
+ selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
79
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
80
+ width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
81
+ lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
82
+ };
83
+ });
84
+
12
85
  /**
13
86
  * Use useSharedPluginState to control re-renders from plugin dependencies
14
87
  */
@@ -26,89 +99,29 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
26
99
  forwardRef = _ref.forwardRef,
27
100
  allowTableAlignment = _ref.allowTableAlignment,
28
101
  allowTableResizing = _ref.allowTableResizing;
29
- var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode'], {
30
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
31
- }),
32
- widthState = _useSharedPluginState.widthState,
33
- tableState = _useSharedPluginState.tableState,
34
- mediaState = _useSharedPluginState.mediaState,
35
- selectionState = _useSharedPluginState.selectionState,
36
- editorViewModeState = _useSharedPluginState.editorViewModeState;
37
- var isTableResizingSelector = useInternalTablePluginStateSelector(api, 'isTableResizing', {
38
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
39
- });
40
- var isHeaderColumnEnabledSelector = useInternalTablePluginStateSelector(api, 'isHeaderColumnEnabled', {
41
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
42
- });
43
- var isHeaderRowEnabledSelector = useInternalTablePluginStateSelector(api, 'isHeaderRowEnabled', {
44
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
45
- });
46
- var orderingSelector = useInternalTablePluginStateSelector(api, 'ordering', {
47
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
48
- });
49
- var isResizingSelector = useInternalTablePluginStateSelector(api, 'isResizing', {
50
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
51
- });
52
- var isInDangerSelector = useInternalTablePluginStateSelector(api, 'isInDanger', {
53
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
54
- });
55
- var hoveredCellSelector = useInternalTablePluginStateSelector(api, 'hoveredCell', {
56
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
57
- });
58
- var hoveredRowsSelector = useInternalTablePluginStateSelector(api, 'hoveredRows', {
59
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
60
- });
61
- var isTableHoveredSelector = useInternalTablePluginStateSelector(api, 'isTableHovered', {
62
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
63
- });
64
- var isWholeTableInDangerSelector = useInternalTablePluginStateSelector(api, 'isWholeTableInDanger', {
65
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
66
- });
67
-
68
- // mediaState
69
- var isFullscreenSelector = useSharedPluginStateSelector(api, 'media.isFullscreen', {
70
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
71
- });
72
- var isFullscreen = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isFullscreenSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen;
73
-
74
- // selectionState
75
- var selectionSelector = useSharedPluginStateSelector(api, 'selection.selection', {
76
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
77
- });
78
- var selection = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectionSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
79
-
80
- // editorViewModeState
81
- var editorViewModeSelector = useSharedPluginStateSelector(api, 'editorViewMode.mode', {
82
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
83
- });
84
- var mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? editorViewModeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
102
+ var _useSharedState = useSharedState(api),
103
+ tableState = _useSharedState.tableState,
104
+ widthState = _useSharedState.widthState,
105
+ mode = _useSharedState.mode,
106
+ hoveredCell = _useSharedState.hoveredCell,
107
+ hoveredRows = _useSharedState.hoveredRows,
108
+ isFullscreen = _useSharedState.isFullscreen,
109
+ isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
110
+ isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
111
+ isInDanger = _useSharedState.isInDanger,
112
+ isResizing = _useSharedState.isResizing,
113
+ isTableHovered = _useSharedState.isTableHovered,
114
+ isTableResizing = _useSharedState.isTableResizing,
115
+ isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
116
+ lineLength = _useSharedState.lineLength,
117
+ ordering = _useSharedState.ordering,
118
+ selection = _useSharedState.selection,
119
+ width = _useSharedState.width;
85
120
  var isLivePageViewMode = mode === 'view';
86
-
87
- // widthState
88
- var widthSelector = useSharedPluginStateSelector(api, 'width.width', {
89
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
90
- });
91
- var width = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? widthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.width;
92
- var lineLengthSelector = useSharedPluginStateSelector(api, 'width.lineLength', {
93
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
94
- });
95
- var lineLength = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? lineLengthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.lineLength;
96
121
  if (editorExperiment('platform_editor_usesharedpluginstateselector', false) && !tableState) {
97
122
  return null;
98
123
  }
99
124
 
100
- // tableState
101
- var isTableResizing = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableResizingSelector : tableState.isTableResizing;
102
- var isHeaderColumnEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isHeaderColumnEnabledSelector : tableState.isHeaderColumnEnabled;
103
- var isHeaderRowEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isHeaderRowEnabledSelector : tableState.isHeaderRowEnabled;
104
- var ordering = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? orderingSelector : tableState.ordering;
105
- var isResizing = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isResizingSelector : tableState.isResizing;
106
- var isInDanger = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isInDangerSelector : tableState.isInDanger;
107
- var hoveredCell = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredCellSelector : tableState.hoveredCell;
108
- var hoveredRows = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState.hoveredRows;
109
- var isTableHovered = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableHoveredSelector : tableState.isTableHovered;
110
- var isWholeTableInDanger = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isWholeTableInDangerSelector : tableState.isWholeTableInDanger;
111
-
112
125
  /**
113
126
  * ED-19810
114
127
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
8
8
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
9
  import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
@@ -34,6 +34,23 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
34
34
  "data-testid": "table-container"
35
35
  }, children);
36
36
  });
37
+ var useAlignmentStableContainerSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
38
+ var isFullWidthModeEnabled = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled');
39
+ var wasFullWidthModeEnabled = useSharedPluginStateSelector(pluginInjectionApi, 'table.wasFullWidthModeEnabled');
40
+ return {
41
+ tableState: undefined,
42
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
43
+ wasFullWidthModeEnabled: wasFullWidthModeEnabled
44
+ };
45
+ }, function (pluginInjectionApi) {
46
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table']),
47
+ tableState = _useSharedPluginState.tableState;
48
+ return {
49
+ tableState: tableState,
50
+ isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
51
+ wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
52
+ };
53
+ });
37
54
  var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
38
55
  var node = _ref2.node,
39
56
  children = _ref2.children,
@@ -41,22 +58,10 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
41
58
  getPos = _ref2.getPos,
42
59
  editorView = _ref2.editorView;
43
60
  var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
44
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table'], {
45
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
46
- }),
47
- tableState = _useSharedPluginState.tableState;
48
-
49
- // isFullWidthModeEnabled
50
- var isTableFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
51
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
52
- });
53
- var isFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
54
-
55
- // wasFullWidthModeEnabled
56
- var wasFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.wasFullWidthModeEnabled', {
57
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
58
- });
59
- var wasFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? wasFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled;
61
+ var _useAlignmentStableCo = useAlignmentStableContainerSharedState(pluginInjectionApi),
62
+ tableState = _useAlignmentStableCo.tableState,
63
+ isFullWidthModeEnabled = _useAlignmentStableCo.isFullWidthModeEnabled,
64
+ wasFullWidthModeEnabled = _useAlignmentStableCo.wasFullWidthModeEnabled;
60
65
  useEffect(function () {
61
66
  if (!tableState && editorExperiment('platform_editor_usesharedpluginstateselector', false)) {
62
67
  return;
@@ -115,6 +120,22 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
115
120
  editorView: editorView
116
121
  }, children);
117
122
  };
123
+ var useResizeableTableContainerSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
124
+ var isFullWidthModeEnabled = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled');
125
+ var mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
126
+ return {
127
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
128
+ mode: mode
129
+ };
130
+ }, function (pluginInjectionApi) {
131
+ var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['table', 'editorViewMode']),
132
+ tableState = _useSharedPluginState2.tableState,
133
+ editorViewModeState = _useSharedPluginState2.editorViewModeState;
134
+ return {
135
+ isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
136
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
137
+ };
138
+ });
118
139
  export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
119
140
  var children = _ref4.children,
120
141
  className = _ref4.className,
@@ -139,16 +160,9 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
139
160
  _useState2 = _slicedToArray(_useState, 2),
140
161
  resizing = _useState2[0],
141
162
  setIsResizing = _useState2[1];
142
- var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['table'], {
143
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
144
- }),
145
- tableState = _useSharedPluginState2.tableState;
146
-
147
- // isFullWidthModeEnabled
148
- var isFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
149
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
150
- });
151
- var isFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
163
+ var _useResizeableTableCo = useResizeableTableContainerSharedState(pluginInjectionApi),
164
+ isFullWidthModeEnabled = _useResizeableTableCo.isFullWidthModeEnabled,
165
+ mode = _useResizeableTableCo.mode;
152
166
  var updateContainerHeight = useCallback(function (height) {
153
167
  var _containerRef$current;
154
168
  // current StickyHeader State is not stable to be fetch.
@@ -202,16 +216,6 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
202
216
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
203
217
  }, [pluginInjectionApi]);
204
218
  var tableWidth = getTableContainerWidth(node);
205
- var _useSharedPluginState3 = useSharedPluginState(pluginInjectionApi, ['editorViewMode'], {
206
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
207
- }),
208
- editorViewModeState = _useSharedPluginState3.editorViewModeState;
209
-
210
- // mode
211
- var modeSelector = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode', {
212
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
213
- });
214
- var mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
215
219
  var responsiveContainerWidth = 0;
216
220
  var resizeHandleSpacing = 12;
217
221
  // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
@@ -262,7 +266,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
262
266
  onResizeStop: onResizeStop,
263
267
  isCommentEditor: isCommentEditor
264
268
  };
265
- var isLivePageViewMode = (editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
269
+ var isLivePageViewMode = mode === 'view';
266
270
  return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
267
271
  isTableAlignmentEnabled: isTableAlignmentEnabled,
268
272
  node: node,
@@ -8,7 +8,7 @@ import { useIntl } from 'react-intl-next';
8
8
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
9
9
  import { browser } from '@atlaskit/editor-common/browser';
10
10
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
11
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
12
12
  import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
13
13
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
14
14
  import { logException } from '@atlaskit/editor-common/monitoring';
@@ -17,7 +17,6 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
17
17
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
18
18
  import { findTable } from '@atlaskit/editor-tables/utils';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
21
20
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
22
21
  import { updateWidthToWidest } from '../pm-plugins/commands/misc';
23
22
  import { META_KEYS } from '../pm-plugins/table-analytics';
@@ -96,6 +95,19 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
96
95
  return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < width + guidelineVisibleAdjustment;
97
96
  });
98
97
  };
98
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
99
+ var widthToWidest = useInternalTablePluginStateSelector(pluginInjectionApi, 'widthToWidest');
100
+ return {
101
+ widthToWidest: widthToWidest
102
+ };
103
+ }, function (pluginInjectionApi) {
104
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table']),
105
+ tableState = _useSharedPluginState.tableState;
106
+ var tableStateInternal = tableState;
107
+ return {
108
+ widthToWidest: tableStateInternal.widthToWidest
109
+ };
110
+ });
99
111
  export var TableResizer = function TableResizer(_ref) {
100
112
  var _editorView$state, _pluginInjectionApi$a2;
101
113
  var children = _ref.children,
@@ -127,16 +139,8 @@ export var TableResizer = function TableResizer(_ref) {
127
139
  var isResizing = useRef(false);
128
140
  var areResizeMetaKeysPressed = useRef(false);
129
141
  var resizerRef = useRef(null);
130
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table'], {
131
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
132
- }),
133
- tableState = _useSharedPluginState.tableState;
134
-
135
- // widthToWidest
136
- var widthToWidestSelector = useInternalTablePluginStateSelector(pluginInjectionApi, 'widthToWidest', {
137
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
138
- });
139
- var widthToWidest = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? widthToWidestSelector : tableState.widthToWidest;
142
+ var _useSharedState = useSharedState(pluginInjectionApi),
143
+ widthToWidest = _useSharedState.widthToWidest;
140
144
 
141
145
  // used to reposition tooltip when table is resizing via keyboard
142
146
  var updateTooltip = React.useRef();
@@ -7,7 +7,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TA
7
7
  import { browser } from '@atlaskit/editor-common/browser';
8
8
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
9
9
  import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
10
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
11
  import { IconTable } from '@atlaskit/editor-common/icons';
12
12
  import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
13
13
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
@@ -64,6 +64,18 @@ import { getToolbarConfig } from './ui/toolbar';
64
64
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
65
65
  return {};
66
66
  };
67
+ var useTableSharedState = sharedPluginStateHookMigratorFactory(function (api) {
68
+ var mode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
69
+ return {
70
+ mode: mode
71
+ };
72
+ }, function (api) {
73
+ var _useSharedPluginState = useSharedPluginState(api, ['editorViewMode']),
74
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
75
+ return {
76
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
77
+ };
78
+ });
67
79
 
68
80
  /**
69
81
  * Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
@@ -678,16 +690,8 @@ var tablePlugin = function tablePlugin(_ref) {
678
690
  },
679
691
  usePluginHook: function usePluginHook(_ref24) {
680
692
  var editorView = _ref24.editorView;
681
- var _useSharedPluginState = useSharedPluginState(api, ['editorViewMode'], {
682
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
683
- }),
684
- editorViewModeState = _useSharedPluginState.editorViewModeState;
685
-
686
- // mode
687
- var modeSelector = useSharedPluginStateSelector(api, 'editorViewMode.mode', {
688
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
689
- });
690
- var mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
693
+ var _useTableSharedState = useTableSharedState(api),
694
+ mode = _useTableSharedState.mode;
691
695
  useEffect(function () {
692
696
  var state = editorView.state,
693
697
  dispatch = editorView.dispatch;
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
3
3
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
4
4
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
5
  import FloatingContextualButton from './FloatingContextualButton';
7
6
  import FloatingContextualMenu from './FloatingContextualMenu';
8
7
  import FloatingDeleteButton from './FloatingDeleteButton';
@@ -27,71 +26,29 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
27
26
  defaultGetEditorFeatureFlags = _ref.defaultGetEditorFeatureFlags;
28
27
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
29
28
  var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
30
- var resizingTableLocalId = useInternalTablePluginStateSelector(api, 'resizingTableLocalId', {
31
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
32
- });
33
- var resizingTableRef = useInternalTablePluginStateSelector(api, 'resizingTableRef', {
34
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
35
- });
36
- var isTableResizing = useInternalTablePluginStateSelector(api, 'isTableResizing', {
37
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
38
- });
39
- var isResizing = useInternalTablePluginStateSelector(api, 'isResizing', {
40
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
41
- });
42
- var widthToWidest = useInternalTablePluginStateSelector(api, 'widthToWidest', {
43
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
44
- });
45
- var tableNode = useInternalTablePluginStateSelector(api, 'tableNode', {
46
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
47
- });
48
- var targetCellPosition = useInternalTablePluginStateSelector(api, 'targetCellPosition', {
49
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
50
- });
51
- var isContextualMenuOpen = useInternalTablePluginStateSelector(api, 'isContextualMenuOpen', {
52
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
53
- });
54
- var tableRef = useInternalTablePluginStateSelector(api, 'tableRef', {
55
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
56
- });
57
- var pluginConfig = useInternalTablePluginStateSelector(api, 'pluginConfig', {
58
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
59
- });
60
- var insertColumnButtonIndex = useInternalTablePluginStateSelector(api, 'insertColumnButtonIndex', {
61
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
62
- });
63
- var insertRowButtonIndex = useInternalTablePluginStateSelector(api, 'insertRowButtonIndex', {
64
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
65
- });
66
- var isHeaderColumnEnabled = useInternalTablePluginStateSelector(api, 'isHeaderColumnEnabled', {
67
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
68
- });
69
- var isHeaderRowEnabled = useInternalTablePluginStateSelector(api, 'isHeaderRowEnabled', {
70
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
71
- });
72
- var isDragAndDropEnabled = useInternalTablePluginStateSelector(api, 'isDragAndDropEnabled', {
73
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
74
- });
75
- var tableWrapperTarget = useInternalTablePluginStateSelector(api, 'tableWrapperTarget', {
76
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
77
- });
78
- var isCellMenuOpenByKeyboard = useInternalTablePluginStateSelector(api, 'isCellMenuOpenByKeyboard', {
79
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
80
- });
29
+ var resizingTableLocalId = useInternalTablePluginStateSelector(api, 'resizingTableLocalId');
30
+ var resizingTableRef = useInternalTablePluginStateSelector(api, 'resizingTableRef');
31
+ var isTableResizing = useInternalTablePluginStateSelector(api, 'isTableResizing');
32
+ var isResizing = useInternalTablePluginStateSelector(api, 'isResizing');
33
+ var widthToWidest = useInternalTablePluginStateSelector(api, 'widthToWidest');
34
+ var tableNode = useInternalTablePluginStateSelector(api, 'tableNode');
35
+ var targetCellPosition = useInternalTablePluginStateSelector(api, 'targetCellPosition');
36
+ var isContextualMenuOpen = useInternalTablePluginStateSelector(api, 'isContextualMenuOpen');
37
+ var tableRef = useInternalTablePluginStateSelector(api, 'tableRef');
38
+ var pluginConfig = useInternalTablePluginStateSelector(api, 'pluginConfig');
39
+ var insertColumnButtonIndex = useInternalTablePluginStateSelector(api, 'insertColumnButtonIndex');
40
+ var insertRowButtonIndex = useInternalTablePluginStateSelector(api, 'insertRowButtonIndex');
41
+ var isHeaderColumnEnabled = useInternalTablePluginStateSelector(api, 'isHeaderColumnEnabled');
42
+ var isHeaderRowEnabled = useInternalTablePluginStateSelector(api, 'isHeaderRowEnabled');
43
+ var isDragAndDropEnabled = useInternalTablePluginStateSelector(api, 'isDragAndDropEnabled');
44
+ var tableWrapperTarget = useInternalTablePluginStateSelector(api, 'tableWrapperTarget');
45
+ var isCellMenuOpenByKeyboard = useInternalTablePluginStateSelector(api, 'isCellMenuOpenByKeyboard');
81
46
  var _ref2 = pluginConfig !== null && pluginConfig !== void 0 ? pluginConfig : {},
82
47
  allowControls = _ref2.allowControls;
83
- var stickyHeader = useInternalTablePluginStateSelector(api, 'stickyHeader', {
84
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
85
- });
86
- var dragMenuDirection = useInternalTablePluginStateSelector(api, 'dragMenuDirection', {
87
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
88
- });
89
- var dragMenuIndex = useInternalTablePluginStateSelector(api, 'dragMenuIndex', {
90
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
91
- });
92
- var isDragMenuOpen = useInternalTablePluginStateSelector(api, 'isDragMenuOpen', {
93
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
94
- });
48
+ var stickyHeader = useInternalTablePluginStateSelector(api, 'stickyHeader');
49
+ var dragMenuDirection = useInternalTablePluginStateSelector(api, 'dragMenuDirection');
50
+ var dragMenuIndex = useInternalTablePluginStateSelector(api, 'dragMenuIndex');
51
+ var isDragMenuOpen = useInternalTablePluginStateSelector(api, 'isDragMenuOpen');
95
52
  return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
96
53
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
97
54
  editorView: editorView,
@@ -7,13 +7,12 @@ import classnames from 'classnames';
7
7
  import ReactDOM from 'react-dom';
8
8
  import { injectIntl } from 'react-intl-next';
9
9
  import { browser } from '@atlaskit/editor-common/browser';
10
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
11
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
12
12
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
13
13
  import { findTable, TableMap } from '@atlaskit/editor-tables';
14
14
  import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
15
15
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
16
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
17
16
  import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
18
17
  import { getPluginState } from '../../pm-plugins/plugin-factory';
19
18
  import { findDuplicatePosition, hasMergedCellsInSelection } from '../../pm-plugins/utils/merged-cells';
@@ -245,6 +244,22 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
245
244
  height: previewHeight
246
245
  }), previewContainer));
247
246
  };
247
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
248
+ var hoveredColumns = useInternalTablePluginStateSelector(api, 'hoveredColumns');
249
+ var hoveredRows = useInternalTablePluginStateSelector(api, 'hoveredRows');
250
+ return {
251
+ hoveredColumns: hoveredColumns,
252
+ hoveredRows: hoveredRows
253
+ };
254
+ }, function (api) {
255
+ var _useSharedPluginState = useSharedPluginState(api, ['table']),
256
+ tableState = _useSharedPluginState.tableState;
257
+ var tableStateInternal = tableState;
258
+ return {
259
+ hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
260
+ hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
261
+ };
262
+ });
248
263
  var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
249
264
  var isDragMenuTarget = _ref5.isDragMenuTarget,
250
265
  tableLocalId = _ref5.tableLocalId,
@@ -262,22 +277,9 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
262
277
  editorView = _ref5.editorView,
263
278
  intl = _ref5.intl,
264
279
  api = _ref5.api;
265
- var _ref6 = useSharedPluginState(api, ['table'], {
266
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
267
- }),
268
- tableState = _ref6.tableState;
269
-
270
- // hoveredColumns
271
- var hoveredColumnsSelector = useInternalTablePluginStateSelector(api, 'hoveredColumns', {
272
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
273
- });
274
- var hoveredColumns = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredColumnsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns;
275
-
276
- // hoveredRows
277
- var hoveredRowsSelector = useInternalTablePluginStateSelector(api, 'hoveredRows', {
278
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
279
- });
280
- var hoveredRows = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows;
280
+ var _useSharedState = useSharedState(api),
281
+ hoveredColumns = _useSharedState.hoveredColumns,
282
+ hoveredRows = _useSharedState.hoveredRows;
281
283
  return /*#__PURE__*/React.createElement(DragHandleComponent, {
282
284
  isDragMenuTarget: isDragMenuTarget,
283
285
  tableLocalId: tableLocalId,