@atlaskit/editor-plugin-table 10.9.20 → 10.9.22

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 (61) hide show
  1. package/CHANGELOG.md +21 -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/pm-plugins/main.js +4 -12
  6. package/dist/cjs/tablePlugin.js +22 -12
  7. package/dist/cjs/ui/ContentComponent.js +40 -65
  8. package/dist/cjs/ui/DragHandle/index.js +19 -17
  9. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +14 -11
  10. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -10
  11. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +14 -10
  12. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -10
  13. package/dist/cjs/ui/global-styles.js +14 -10
  14. package/dist/cjs/ui/icons/SortingIconWrapper.js +14 -11
  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/pm-plugins/main.js +4 -12
  19. package/dist/es2019/tablePlugin.js +24 -13
  20. package/dist/es2019/ui/ContentComponent.js +41 -66
  21. package/dist/es2019/ui/DragHandle/index.js +21 -18
  22. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -12
  23. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +16 -11
  24. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +16 -11
  25. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -11
  26. package/dist/es2019/ui/global-styles.js +16 -11
  27. package/dist/es2019/ui/icons/SortingIconWrapper.js +16 -12
  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/pm-plugins/main.js +4 -12
  32. package/dist/esm/tablePlugin.js +23 -13
  33. package/dist/esm/ui/ContentComponent.js +41 -66
  34. package/dist/esm/ui/DragHandle/index.js +20 -18
  35. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +15 -12
  36. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +15 -11
  37. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +15 -11
  38. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +15 -11
  39. package/dist/esm/ui/global-styles.js +15 -11
  40. package/dist/esm/ui/icons/SortingIconWrapper.js +15 -12
  41. package/dist/types/types/index.d.ts +2 -0
  42. package/dist/types/ui/ContentComponent.d.ts +2 -1
  43. package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
  44. package/dist/types-ts4.5/types/index.d.ts +2 -0
  45. package/dist/types-ts4.5/ui/ContentComponent.d.ts +2 -1
  46. package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
  47. package/package.json +4 -7
  48. package/src/nodeviews/TableComponentWithSharedState.tsx +97 -125
  49. package/src/nodeviews/TableContainer.tsx +59 -67
  50. package/src/nodeviews/TableResizer.tsx +21 -17
  51. package/src/pm-plugins/main.ts +5 -13
  52. package/src/tablePlugin.tsx +30 -13
  53. package/src/types/index.ts +2 -0
  54. package/src/ui/ContentComponent.tsx +59 -65
  55. package/src/ui/DragHandle/index.tsx +24 -24
  56. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +20 -13
  57. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +20 -12
  58. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +20 -13
  59. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +20 -13
  60. package/src/ui/global-styles.tsx +20 -13
  61. package/src/ui/icons/SortingIconWrapper.tsx +20 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 10.9.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#154546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154546)
8
+ [`11d9e46f3caaa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/11d9e46f3caaa) -
9
+ Fix tables insertion when platform_editor_usesharedpluginstateselector experiment is enabled
10
+ - [#154340](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154340)
11
+ [`982623fd6523f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/982623fd6523f) -
12
+ [ux] [EDITOR-325] Clean up nested tables feature gate
13
+ `platform_editor_nested_tables_bodied_extension_fix`
14
+
15
+ ## 10.9.21
16
+
17
+ ### Patch Changes
18
+
19
+ - [#153302](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153302)
20
+ [`9fc2b48677873`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fc2b48677873) -
21
+ Refactor to use sharedPluginStateHookMigratorFactory
22
+ - Updated dependencies
23
+
3
24
  ## 10.9.20
4
25
 
5
26
  ### Patch Changes
@@ -15,6 +15,79 @@ var _TableComponent = _interopRequireDefault(require("./TableComponent"));
15
15
  // Ignored via go/ees005
16
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
17
 
18
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
19
+ // tableState
20
+ var isTableResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableResizing');
21
+ var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled');
22
+ var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled');
23
+ var ordering = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'ordering');
24
+ var isResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing');
25
+ var isInDanger = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isInDanger');
26
+ var hoveredCell = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredCell');
27
+ var hoveredRows = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows');
28
+ var isTableHovered = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableHovered');
29
+ var isWholeTableInDanger = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isWholeTableInDanger');
30
+
31
+ // mediaState
32
+ var isFullscreen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen');
33
+
34
+ // selectionState
35
+ var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
36
+
37
+ // editorViewModeState
38
+ var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
39
+
40
+ // widthState
41
+ var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width');
42
+ var lineLength = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength');
43
+ return {
44
+ tableState: undefined,
45
+ widthState: undefined,
46
+ isTableResizing: isTableResizing,
47
+ isHeaderColumnEnabled: isHeaderColumnEnabled,
48
+ isHeaderRowEnabled: isHeaderRowEnabled,
49
+ ordering: ordering,
50
+ isResizing: isResizing,
51
+ isInDanger: isInDanger,
52
+ hoveredCell: hoveredCell,
53
+ hoveredRows: hoveredRows,
54
+ isTableHovered: isTableHovered,
55
+ isWholeTableInDanger: isWholeTableInDanger,
56
+ isFullscreen: isFullscreen,
57
+ selection: selection,
58
+ mode: mode,
59
+ width: width,
60
+ lineLength: lineLength
61
+ };
62
+ }, function (api) {
63
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode']),
64
+ widthState = _useSharedPluginState.widthState,
65
+ tableState = _useSharedPluginState.tableState,
66
+ mediaState = _useSharedPluginState.mediaState,
67
+ selectionState = _useSharedPluginState.selectionState,
68
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
69
+ var tableStateInternal = tableState;
70
+ return {
71
+ tableState: tableState,
72
+ widthState: widthState,
73
+ isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
74
+ isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
75
+ isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
76
+ ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
77
+ isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
78
+ isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
79
+ hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
80
+ hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
81
+ isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
82
+ isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
83
+ isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
84
+ selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
85
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
86
+ width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
87
+ lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
88
+ };
89
+ });
90
+
18
91
  /**
19
92
  * Use useSharedPluginState to control re-renders from plugin dependencies
20
93
  */
@@ -32,89 +105,29 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
32
105
  forwardRef = _ref.forwardRef,
33
106
  allowTableAlignment = _ref.allowTableAlignment,
34
107
  allowTableResizing = _ref.allowTableResizing;
35
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode'], {
36
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
37
- }),
38
- widthState = _useSharedPluginState.widthState,
39
- tableState = _useSharedPluginState.tableState,
40
- mediaState = _useSharedPluginState.mediaState,
41
- selectionState = _useSharedPluginState.selectionState,
42
- editorViewModeState = _useSharedPluginState.editorViewModeState;
43
- var isTableResizingSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableResizing', {
44
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
45
- });
46
- var isHeaderColumnEnabledSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled', {
47
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
48
- });
49
- var isHeaderRowEnabledSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled', {
50
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
51
- });
52
- var orderingSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'ordering', {
53
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
54
- });
55
- var isResizingSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing', {
56
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
57
- });
58
- var isInDangerSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isInDanger', {
59
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
60
- });
61
- var hoveredCellSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredCell', {
62
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
63
- });
64
- var hoveredRowsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows', {
65
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
66
- });
67
- var isTableHoveredSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableHovered', {
68
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
69
- });
70
- var isWholeTableInDangerSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isWholeTableInDanger', {
71
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
72
- });
73
-
74
- // mediaState
75
- var isFullscreenSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen', {
76
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
77
- });
78
- var isFullscreen = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isFullscreenSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen;
79
-
80
- // selectionState
81
- var selectionSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
82
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
83
- });
84
- var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
85
-
86
- // editorViewModeState
87
- var editorViewModeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
88
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
89
- });
90
- var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? editorViewModeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
108
+ var _useSharedState = useSharedState(api),
109
+ tableState = _useSharedState.tableState,
110
+ widthState = _useSharedState.widthState,
111
+ mode = _useSharedState.mode,
112
+ hoveredCell = _useSharedState.hoveredCell,
113
+ hoveredRows = _useSharedState.hoveredRows,
114
+ isFullscreen = _useSharedState.isFullscreen,
115
+ isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
116
+ isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
117
+ isInDanger = _useSharedState.isInDanger,
118
+ isResizing = _useSharedState.isResizing,
119
+ isTableHovered = _useSharedState.isTableHovered,
120
+ isTableResizing = _useSharedState.isTableResizing,
121
+ isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
122
+ lineLength = _useSharedState.lineLength,
123
+ ordering = _useSharedState.ordering,
124
+ selection = _useSharedState.selection,
125
+ width = _useSharedState.width;
91
126
  var isLivePageViewMode = mode === 'view';
92
-
93
- // widthState
94
- var widthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width', {
95
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
96
- });
97
- var width = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.width;
98
- var lineLengthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength', {
99
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
100
- });
101
- var lineLength = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? lineLengthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.lineLength;
102
127
  if ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false) && !tableState) {
103
128
  return null;
104
129
  }
105
130
 
106
- // tableState
107
- var isTableResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableResizingSelector : tableState.isTableResizing;
108
- var isHeaderColumnEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderColumnEnabledSelector : tableState.isHeaderColumnEnabled;
109
- var isHeaderRowEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderRowEnabledSelector : tableState.isHeaderRowEnabled;
110
- var ordering = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? orderingSelector : tableState.ordering;
111
- var isResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isResizingSelector : tableState.isResizing;
112
- var isInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isInDangerSelector : tableState.isInDanger;
113
- var hoveredCell = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredCellSelector : tableState.hoveredCell;
114
- var hoveredRows = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState.hoveredRows;
115
- var isTableHovered = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableHoveredSelector : tableState.isTableHovered;
116
- var isWholeTableInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isWholeTableInDangerSelector : tableState.isWholeTableInDanger;
117
-
118
131
  /**
119
132
  * ED-19810
120
133
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
@@ -44,6 +44,23 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
44
44
  "data-testid": "table-container"
45
45
  }, children);
46
46
  });
47
+ var useAlignmentStableContainerSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
48
+ var isFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled');
49
+ var wasFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.wasFullWidthModeEnabled');
50
+ return {
51
+ tableState: undefined,
52
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
53
+ wasFullWidthModeEnabled: wasFullWidthModeEnabled
54
+ };
55
+ }, function (pluginInjectionApi) {
56
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
57
+ tableState = _useSharedPluginState.tableState;
58
+ return {
59
+ tableState: tableState,
60
+ isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
61
+ wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
62
+ };
63
+ });
47
64
  var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
48
65
  var node = _ref2.node,
49
66
  children = _ref2.children,
@@ -51,22 +68,10 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
51
68
  getPos = _ref2.getPos,
52
69
  editorView = _ref2.editorView;
53
70
  var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
54
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
55
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
56
- }),
57
- tableState = _useSharedPluginState.tableState;
58
-
59
- // isFullWidthModeEnabled
60
- var isTableFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
61
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
62
- });
63
- var isFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
64
-
65
- // wasFullWidthModeEnabled
66
- var wasFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.wasFullWidthModeEnabled', {
67
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
68
- });
69
- var wasFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? wasFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled;
71
+ var _useAlignmentStableCo = useAlignmentStableContainerSharedState(pluginInjectionApi),
72
+ tableState = _useAlignmentStableCo.tableState,
73
+ isFullWidthModeEnabled = _useAlignmentStableCo.isFullWidthModeEnabled,
74
+ wasFullWidthModeEnabled = _useAlignmentStableCo.wasFullWidthModeEnabled;
70
75
  (0, _react.useEffect)(function () {
71
76
  if (!tableState && (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)) {
72
77
  return;
@@ -125,6 +130,22 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
125
130
  editorView: editorView
126
131
  }, children);
127
132
  };
133
+ var useResizeableTableContainerSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
134
+ var isFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled');
135
+ var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
136
+ return {
137
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
138
+ mode: mode
139
+ };
140
+ }, function (pluginInjectionApi) {
141
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table', 'editorViewMode']),
142
+ tableState = _useSharedPluginState2.tableState,
143
+ editorViewModeState = _useSharedPluginState2.editorViewModeState;
144
+ return {
145
+ isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
146
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
147
+ };
148
+ });
128
149
  var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref4) {
129
150
  var children = _ref4.children,
130
151
  className = _ref4.className,
@@ -149,16 +170,9 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
149
170
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
150
171
  resizing = _useState2[0],
151
172
  setIsResizing = _useState2[1];
152
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
153
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
154
- }),
155
- tableState = _useSharedPluginState2.tableState;
156
-
157
- // isFullWidthModeEnabled
158
- var isFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
159
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
160
- });
161
- var isFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
173
+ var _useResizeableTableCo = useResizeableTableContainerSharedState(pluginInjectionApi),
174
+ isFullWidthModeEnabled = _useResizeableTableCo.isFullWidthModeEnabled,
175
+ mode = _useResizeableTableCo.mode;
162
176
  var updateContainerHeight = (0, _react.useCallback)(function (height) {
163
177
  var _containerRef$current;
164
178
  // current StickyHeader State is not stable to be fetch.
@@ -212,16 +226,6 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
212
226
  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;
213
227
  }, [pluginInjectionApi]);
214
228
  var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
215
- var _useSharedPluginState3 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode'], {
216
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
217
- }),
218
- editorViewModeState = _useSharedPluginState3.editorViewModeState;
219
-
220
- // mode
221
- var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode', {
222
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
223
- });
224
- var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
225
229
  var responsiveContainerWidth = 0;
226
230
  var resizeHandleSpacing = 12;
227
231
  // When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
@@ -272,7 +276,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
272
276
  onResizeStop: onResizeStop,
273
277
  isCommentEditor: isCommentEditor
274
278
  };
275
- var isLivePageViewMode = ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? mode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
279
+ var isLivePageViewMode = mode === 'view';
276
280
  return /*#__PURE__*/_react.default.createElement(AlignmentTableContainerWrapper, {
277
281
  isTableAlignmentEnabled: isTableAlignmentEnabled,
278
282
  node: node,
@@ -23,7 +23,6 @@ var _commands = require("@atlaskit/editor-prosemirror/commands");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _utils = require("@atlaskit/editor-tables/utils");
25
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
27
26
  var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
28
27
  var _misc = require("../pm-plugins/commands/misc");
29
28
  var _tableAnalytics = require("../pm-plugins/table-analytics");
@@ -106,6 +105,19 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
106
105
  return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < width + guidelineVisibleAdjustment;
107
106
  });
108
107
  };
108
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
109
+ var widthToWidest = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(pluginInjectionApi, 'widthToWidest');
110
+ return {
111
+ widthToWidest: widthToWidest
112
+ };
113
+ }, function (pluginInjectionApi) {
114
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
115
+ tableState = _useSharedPluginState.tableState;
116
+ var tableStateInternal = tableState;
117
+ return {
118
+ widthToWidest: tableStateInternal.widthToWidest
119
+ };
120
+ });
109
121
  var TableResizer = exports.TableResizer = function TableResizer(_ref) {
110
122
  var _editorView$state, _pluginInjectionApi$a2;
111
123
  var children = _ref.children,
@@ -137,16 +149,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
137
149
  var isResizing = (0, _react.useRef)(false);
138
150
  var areResizeMetaKeysPressed = (0, _react.useRef)(false);
139
151
  var resizerRef = (0, _react.useRef)(null);
140
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
141
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
142
- }),
143
- tableState = _useSharedPluginState.tableState;
144
-
145
- // widthToWidest
146
- var widthToWidestSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(pluginInjectionApi, 'widthToWidest', {
147
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
148
- });
149
- var widthToWidest = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthToWidestSelector : tableState.widthToWidest;
152
+ var _useSharedState = useSharedState(pluginInjectionApi),
153
+ widthToWidest = _useSharedState.widthToWidest;
150
154
 
151
155
  // used to reposition tooltip when table is resizing via keyboard
152
156
  var updateTooltip = _react.default.useRef();
@@ -218,19 +218,11 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
218
218
 
219
219
  // transformSliceToRemoveOpenTable() transforms based on the depth of the root node, assuming that the tables will be at the root
220
220
  // Bodied extensions will contribute to the depth of the table selection so we need to remove them first
221
- if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_bodied_extension_fix')) {
222
- /** If a partial paste of bodied extension, paste only text */
223
- slice = (0, _transforms.transformSliceToRemoveOpenBodiedExtension)(slice, schema);
221
+ /** If a partial paste of bodied extension, paste only text */
222
+ slice = (0, _transforms.transformSliceToRemoveOpenBodiedExtension)(slice, schema);
224
223
 
225
- /** If a partial paste of table, paste only table's content */
226
- slice = (0, _paste.transformSliceToRemoveOpenTable)(slice, schema);
227
- } else {
228
- /** If a partial paste of table, paste only table's content */
229
- slice = (0, _paste.transformSliceToRemoveOpenTable)(slice, schema);
230
-
231
- /** If a partial paste of bodied extension, paste only text */
232
- slice = (0, _transforms.transformSliceToRemoveOpenBodiedExtension)(slice, schema);
233
- }
224
+ /** If a partial paste of table, paste only table's content */
225
+ slice = (0, _paste.transformSliceToRemoveOpenTable)(slice, schema);
234
226
 
235
227
  /** If a partial paste of multi bodied extension, paste only children */
236
228
  slice = (0, _transforms.transformSliceToRemoveOpenMultiBodiedExtension)(slice, schema);
@@ -73,6 +73,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
73
73
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
74
74
  return {};
75
75
  };
76
+ var useTableSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
77
+ var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
78
+ return {
79
+ mode: mode
80
+ };
81
+ }, function (api) {
82
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
83
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
84
+ return {
85
+ mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
86
+ };
87
+ });
76
88
 
77
89
  /**
78
90
  * Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
@@ -116,6 +128,7 @@ var tablePlugin = function tablePlugin(_ref) {
116
128
  var stickyHeadersState = _pluginKey4.pluginKey.getState(editorState);
117
129
  var stickyHeader = stickyHeadersState ? (0, _util.findStickyHeaderForTable)(stickyHeadersState, tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.tablePos) : undefined;
118
130
  var dragAndDropState = _pluginKey2.pluginKey.getState(editorState);
131
+ var sizeSelectorPluginState = _tableSizeSelector.pluginKey.getState(editorState);
119
132
  var sharedStateInternal = {
120
133
  isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
121
134
  wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled),
@@ -149,7 +162,9 @@ var tablePlugin = function tablePlugin(_ref) {
149
162
  stickyHeader: stickyHeader,
150
163
  dragMenuDirection: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
151
164
  dragMenuIndex: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
152
- isDragMenuOpen: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.isDragMenuOpen
165
+ isDragMenuOpen: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.isDragMenuOpen,
166
+ isSizeSelectorOpen: sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.isSelectorOpen,
167
+ sizeSelectorTargetRef: sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef
153
168
  };
154
169
  return sharedStateInternal;
155
170
  },
@@ -462,7 +477,8 @@ var tablePlugin = function tablePlugin(_ref) {
462
477
  popupsBoundariesElement: popupsBoundariesElement,
463
478
  popupsScrollableElement: popupsScrollableElement,
464
479
  defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
465
- defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags
480
+ defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
481
+ isTableSelectorEnabled: isTableSelectorEnabled
466
482
  });
467
483
  }
468
484
  return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
@@ -491,6 +507,8 @@ var tablePlugin = function tablePlugin(_ref) {
491
507
  tableWidthPluginState = _ref21.tableWidthPluginState,
492
508
  dragAndDropState = _ref21.dragAndDropState,
493
509
  sizeSelectorPluginState = _ref21.sizeSelectorPluginState;
510
+ // Any changes made inside `<WithPluginState>` need to be reflected in the
511
+ // `<ContentComponent>` as well.
494
512
  var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
495
513
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
496
514
  var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
@@ -687,16 +705,8 @@ var tablePlugin = function tablePlugin(_ref) {
687
705
  },
688
706
  usePluginHook: function usePluginHook(_ref24) {
689
707
  var editorView = _ref24.editorView;
690
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode'], {
691
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
692
- }),
693
- editorViewModeState = _useSharedPluginState.editorViewModeState;
694
-
695
- // mode
696
- var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
697
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
698
- });
699
- var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
708
+ var _useTableSharedState = useTableSharedState(api),
709
+ mode = _useTableSharedState.mode;
700
710
  (0, _react.useEffect)(function () {
701
711
  var state = editorView.state,
702
712
  dispatch = editorView.dispatch;