@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
@@ -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();
@@ -211,19 +211,11 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
211
211
 
212
212
  // transformSliceToRemoveOpenTable() transforms based on the depth of the root node, assuming that the tables will be at the root
213
213
  // Bodied extensions will contribute to the depth of the table selection so we need to remove them first
214
- if (fg('platform_editor_nested_tables_bodied_extension_fix')) {
215
- /** If a partial paste of bodied extension, paste only text */
216
- slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
214
+ /** If a partial paste of bodied extension, paste only text */
215
+ slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
217
216
 
218
- /** If a partial paste of table, paste only table's content */
219
- slice = transformSliceToRemoveOpenTable(slice, schema);
220
- } else {
221
- /** If a partial paste of table, paste only table's content */
222
- slice = transformSliceToRemoveOpenTable(slice, schema);
223
-
224
- /** If a partial paste of bodied extension, paste only text */
225
- slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
226
- }
217
+ /** If a partial paste of table, paste only table's content */
218
+ slice = transformSliceToRemoveOpenTable(slice, schema);
227
219
 
228
220
  /** If a partial paste of multi bodied extension, paste only children */
229
221
  slice = transformSliceToRemoveOpenMultiBodiedExtension(slice, schema);
@@ -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`
@@ -107,6 +119,7 @@ var tablePlugin = function tablePlugin(_ref) {
107
119
  var stickyHeadersState = stickyHeadersPluginKey.getState(editorState);
108
120
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.tablePos) : undefined;
109
121
  var dragAndDropState = dragAndDropPluginKey.getState(editorState);
122
+ var sizeSelectorPluginState = sizeSelectorPluginKey.getState(editorState);
110
123
  var sharedStateInternal = {
111
124
  isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
112
125
  wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled),
@@ -140,7 +153,9 @@ var tablePlugin = function tablePlugin(_ref) {
140
153
  stickyHeader: stickyHeader,
141
154
  dragMenuDirection: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
142
155
  dragMenuIndex: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
143
- isDragMenuOpen: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.isDragMenuOpen
156
+ isDragMenuOpen: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.isDragMenuOpen,
157
+ isSizeSelectorOpen: sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.isSelectorOpen,
158
+ sizeSelectorTargetRef: sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef
144
159
  };
145
160
  return sharedStateInternal;
146
161
  },
@@ -453,7 +468,8 @@ var tablePlugin = function tablePlugin(_ref) {
453
468
  popupsBoundariesElement: popupsBoundariesElement,
454
469
  popupsScrollableElement: popupsScrollableElement,
455
470
  defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
456
- defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags
471
+ defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
472
+ isTableSelectorEnabled: isTableSelectorEnabled
457
473
  });
458
474
  }
459
475
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
@@ -482,6 +498,8 @@ var tablePlugin = function tablePlugin(_ref) {
482
498
  tableWidthPluginState = _ref21.tableWidthPluginState,
483
499
  dragAndDropState = _ref21.dragAndDropState,
484
500
  sizeSelectorPluginState = _ref21.sizeSelectorPluginState;
501
+ // Any changes made inside `<WithPluginState>` need to be reflected in the
502
+ // `<ContentComponent>` as well.
485
503
  var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
486
504
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
487
505
  var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
@@ -678,16 +696,8 @@ var tablePlugin = function tablePlugin(_ref) {
678
696
  },
679
697
  usePluginHook: function usePluginHook(_ref24) {
680
698
  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;
699
+ var _useTableSharedState = useTableSharedState(api),
700
+ mode = _useTableSharedState.mode;
691
701
  useEffect(function () {
692
702
  var state = editorView.state,
693
703
  dispatch = editorView.dispatch;