@atlaskit/editor-plugin-table 13.0.4 → 13.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
  3. package/dist/cjs/nodeviews/TableContainer.js +14 -53
  4. package/dist/cjs/nodeviews/TableResizer.js +2 -15
  5. package/dist/cjs/nodeviews/table.js +4 -4
  6. package/dist/cjs/tablePlugin.js +30 -213
  7. package/dist/cjs/ui/DragHandle/index.js +9 -26
  8. package/dist/cjs/ui/DragPreview/index.js +1 -1
  9. package/dist/cjs/ui/FloatingContextualButton/styles.js +1 -1
  10. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  11. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
  12. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
  13. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
  14. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
  15. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
  16. package/dist/cjs/ui/TableFullWidthLabel/index.js +1 -1
  17. package/dist/cjs/ui/global-styles.js +4 -17
  18. package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
  19. package/dist/cjs/ui/ui-styles.js +1 -1
  20. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
  21. package/dist/es2019/nodeviews/TableContainer.js +11 -54
  22. package/dist/es2019/nodeviews/TableResizer.js +2 -17
  23. package/dist/es2019/nodeviews/table.js +4 -4
  24. package/dist/es2019/tablePlugin.js +19 -211
  25. package/dist/es2019/ui/DragHandle/index.js +8 -27
  26. package/dist/es2019/ui/DragPreview/index.js +1 -1
  27. package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -1
  28. package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
  29. package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
  30. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
  31. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
  32. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
  33. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
  34. package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -1
  35. package/dist/es2019/ui/global-styles.js +6 -21
  36. package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
  37. package/dist/es2019/ui/ui-styles.js +1 -1
  38. package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
  39. package/dist/esm/nodeviews/TableContainer.js +15 -54
  40. package/dist/esm/nodeviews/TableResizer.js +3 -16
  41. package/dist/esm/nodeviews/table.js +4 -4
  42. package/dist/esm/tablePlugin.js +24 -208
  43. package/dist/esm/ui/DragHandle/index.js +10 -27
  44. package/dist/esm/ui/DragPreview/index.js +1 -1
  45. package/dist/esm/ui/FloatingContextualButton/styles.js +1 -1
  46. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  47. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  48. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
  49. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
  50. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
  51. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
  52. package/dist/esm/ui/TableFullWidthLabel/index.js +1 -1
  53. package/dist/esm/ui/global-styles.js +5 -18
  54. package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
  55. package/dist/esm/ui/ui-styles.js +1 -1
  56. package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  57. package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  58. package/package.json +4 -4
@@ -13,7 +13,10 @@ var _commonStyles = require("./common-styles");
13
13
  */
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
15
15
 
16
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
16
+ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
17
+ var featureFlags = _ref.featureFlags,
18
+ isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
19
+ api = _ref.api;
17
20
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
18
21
  var _states$editorViewMod;
19
22
  return {
@@ -21,22 +24,6 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
21
24
  };
22
25
  }),
23
26
  mode = _useSharedPluginState.mode;
24
- return {
25
- mode: mode
26
- };
27
- }, function (api) {
28
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
29
- editorViewModeState = _useSharedPluginState2.editorViewModeState;
30
- return {
31
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
32
- };
33
- });
34
- var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
35
- var featureFlags = _ref.featureFlags,
36
- isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
37
- api = _ref.api;
38
- var _useSharedState = useSharedState(api),
39
- mode = _useSharedState.mode;
40
27
  var isLivePageViewMode = mode === 'view';
41
28
  return (0, _react.jsx)(_react.Global, {
42
29
  styles: (0, _commonStyles.tableStyles)({
@@ -8,27 +8,14 @@ exports.SortingIconWrapper = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _table = require("@atlaskit/editor-common/table");
11
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
12
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
11
+ var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
12
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(props.api, ['editorViewMode'], function (states) {
13
13
  var _states$editorViewMod;
14
14
  return {
15
15
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
16
16
  };
17
17
  }),
18
18
  mode = _useSharedPluginState.mode;
19
- return {
20
- mode: mode
21
- };
22
- }, function (api) {
23
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
24
- editorViewModeState = _useSharedPluginState2.editorViewModeState;
25
- return {
26
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
27
- };
28
- });
29
- var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
30
- var _useSharedState = useSharedState(props.api),
31
- mode = _useSharedState.mode;
32
19
  if (mode === 'edit') {
33
20
  return null;
34
21
  }
@@ -35,7 +35,7 @@ var InsertMarker = exports.InsertMarker = function InsertMarker(cssString) {
35
35
  return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\t", ";\n\t\t", "\n\t}\n"])), _types.TableCssClassName.CONTROLS_INSERT_MARKER, Marker(), cssString);
36
36
  };
37
37
  var Button = function Button(cssString) {
38
- return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\tborder-radius: ", ";\n\tborder-width: 0px;\n\tdisplay: inline-flex;\n\tmax-width: 100%;\n\ttext-align: center;\n\tmargin: 0px;\n\tpadding: 0px;\n\ttext-decoration: none;\n\ttransition:\n\t\tbackground 0.1s ease-out 0s,\n\t\tbox-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38) 0s;\n\toutline: none !important;\n\tcursor: none;\n\n\t> .", " {\n\t\tdisplay: inline-flex;\n\t\tmax-height: 100%;\n\t\tmax-width: 100%;\n\t}\n\t", "\n"])), "var(--ds-border-radius, 3px)", _types.TableCssClassName.CONTROLS_BUTTON_ICON, cssString);
38
+ return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\tborder-radius: ", ";\n\tborder-width: 0px;\n\tdisplay: inline-flex;\n\tmax-width: 100%;\n\ttext-align: center;\n\tmargin: 0px;\n\tpadding: 0px;\n\ttext-decoration: none;\n\ttransition:\n\t\tbackground 0.1s ease-out 0s,\n\t\tbox-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38) 0s;\n\toutline: none !important;\n\tcursor: none;\n\n\t> .", " {\n\t\tdisplay: inline-flex;\n\t\tmax-height: 100%;\n\t\tmax-width: 100%;\n\t}\n\t", "\n"])), "var(--ds-radius-small, 3px)", _types.TableCssClassName.CONTROLS_BUTTON_ICON, cssString);
39
39
  };
40
40
 
41
41
  // Explicit pixel values required here to ensure classic row controls align correctly
@@ -1,14 +1,29 @@
1
1
  import React from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { findTable } from '@atlaskit/editor-tables';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
4
  import TableComponent from './TableComponent';
7
5
 
8
6
  // Ignored via go/ees005
9
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
8
 
11
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
9
+ /**
10
+ * Use useSharedPluginState to control re-renders from plugin dependencies
11
+ */
12
+ export const TableComponentWithSharedState = ({
13
+ view,
14
+ options,
15
+ getNode,
16
+ dispatchAnalyticsEvent,
17
+ api,
18
+ getEditorFeatureFlags,
19
+ eventDispatcher,
20
+ allowColumnResizing,
21
+ allowControls,
22
+ getPos,
23
+ forwardRef,
24
+ allowTableAlignment,
25
+ allowTableResizing
26
+ }) => {
12
27
  const {
13
28
  isTableResizing,
14
29
  isHeaderColumnEnabled,
@@ -55,100 +70,7 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
55
70
  interaction: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState
56
71
  };
57
72
  });
58
- return {
59
- tableState: undefined,
60
- widthState: undefined,
61
- isTableResizing,
62
- isHeaderColumnEnabled,
63
- isHeaderRowEnabled,
64
- ordering,
65
- isResizing,
66
- isInDanger,
67
- hoveredCell,
68
- hoveredRows,
69
- isTableHovered,
70
- isWholeTableInDanger,
71
- isFullscreen,
72
- selection,
73
- mode,
74
- width,
75
- lineLength,
76
- interaction
77
- };
78
- }, api => {
79
- const {
80
- widthState,
81
- tableState,
82
- mediaState,
83
- selectionState,
84
- editorViewModeState,
85
- interactionState
86
- } = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']);
87
- const tableStateInternal = tableState;
88
- return {
89
- tableState,
90
- widthState,
91
- isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
92
- isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
93
- isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
94
- ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
95
- isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
96
- isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
97
- hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
98
- hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
99
- isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
100
- isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
101
- isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
102
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
103
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
104
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
105
- lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
106
- interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
107
- };
108
- });
109
-
110
- /**
111
- * Use useSharedPluginState to control re-renders from plugin dependencies
112
- */
113
- export const TableComponentWithSharedState = ({
114
- view,
115
- options,
116
- getNode,
117
- dispatchAnalyticsEvent,
118
- api,
119
- getEditorFeatureFlags,
120
- eventDispatcher,
121
- allowColumnResizing,
122
- allowControls,
123
- getPos,
124
- forwardRef,
125
- allowTableAlignment,
126
- allowTableResizing
127
- }) => {
128
- const {
129
- tableState,
130
- widthState,
131
- mode,
132
- hoveredCell,
133
- hoveredRows,
134
- isFullscreen,
135
- isHeaderColumnEnabled,
136
- isHeaderRowEnabled,
137
- isInDanger,
138
- isResizing,
139
- isTableHovered,
140
- isTableResizing,
141
- isWholeTableInDanger,
142
- lineLength,
143
- ordering,
144
- selection,
145
- width,
146
- interaction
147
- } = useSharedState(api);
148
73
  const isLivePageViewMode = mode === 'view';
149
- if (expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
150
- return null;
151
- }
152
74
 
153
75
  /**
154
76
  * ED-19810
@@ -182,13 +104,10 @@ export const TableComponentWithSharedState = ({
182
104
  ordering: ordering,
183
105
  isResizing: isResizing,
184
106
  getNode: getNode,
185
- containerWidth: editorExperiment('platform_editor_usesharedpluginstatewithselector', true) ? {
107
+ containerWidth: {
186
108
  width: width !== null && width !== void 0 ? width : 0,
187
109
  lineLength
188
- } :
189
- // Ignored via go/ees005
190
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
191
- widthState,
110
+ },
192
111
  contentDOM: forwardRef,
193
112
  getEditorFeatureFlags: getEditorFeatureFlags,
194
113
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -3,7 +3,7 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
3
3
  import classNames from 'classnames';
4
4
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { isSSR } from '@atlaskit/editor-common/core-utils';
6
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
8
8
  import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -36,32 +36,6 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
36
36
  "data-testid": "table-container"
37
37
  }, children);
38
38
  });
39
- const useAlignmentTableContainerSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
40
- const {
41
- isFullWidthModeEnabled,
42
- wasFullWidthModeEnabled
43
- } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
44
- var _states$tableState, _states$tableState2;
45
- return {
46
- isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
47
- wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
48
- };
49
- });
50
- return {
51
- tableState: undefined,
52
- isFullWidthModeEnabled,
53
- wasFullWidthModeEnabled
54
- };
55
- }, pluginInjectionApi => {
56
- const {
57
- tableState
58
- } = useSharedPluginState(pluginInjectionApi, ['table']);
59
- return {
60
- tableState,
61
- isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
62
- wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
63
- };
64
- });
65
39
  const AlignmentTableContainer = ({
66
40
  node,
67
41
  children,
@@ -71,14 +45,16 @@ const AlignmentTableContainer = ({
71
45
  }) => {
72
46
  const alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
73
47
  const {
74
- tableState,
75
48
  isFullWidthModeEnabled,
76
49
  wasFullWidthModeEnabled
77
- } = useAlignmentTableContainerSharedState(pluginInjectionApi);
50
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
51
+ var _states$tableState, _states$tableState2;
52
+ return {
53
+ isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
54
+ wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
55
+ };
56
+ });
78
57
  useEffect(() => {
79
- if (!tableState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
80
- return;
81
- }
82
58
  if (editorView && getPos) {
83
59
  const {
84
60
  state,
@@ -97,7 +73,7 @@ const AlignmentTableContainer = ({
97
73
  }
98
74
  }
99
75
  // eslint-disable-next-line react-hooks/exhaustive-deps
100
- }, [editorView, tableState, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
76
+ }, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
101
77
  const style = useMemo(() => {
102
78
  return getAlignmentStyle(alignment);
103
79
  }, [alignment]);
@@ -142,25 +118,6 @@ const selector = states => ({
142
118
  tableState: states.tableState,
143
119
  editorViewModeState: states.editorViewModeState
144
120
  });
145
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
146
- const {
147
- tableState,
148
- editorViewModeState
149
- } = useSharedPluginStateWithSelector(api, ['table', 'editorViewMode'], selector);
150
- return {
151
- tableState,
152
- editorViewModeState
153
- };
154
- }, api => {
155
- const {
156
- tableState,
157
- editorViewModeState
158
- } = useSharedPluginState(api, ['table', 'editorViewMode']);
159
- return {
160
- tableState,
161
- editorViewModeState
162
- };
163
- });
164
121
  const getPadding = containerWidth => {
165
122
  return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
166
123
  };
@@ -189,7 +146,7 @@ const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
189
146
  const {
190
147
  tableState,
191
148
  editorViewModeState
192
- } = useSharedState(pluginInjectionApi);
149
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
193
150
  const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
194
151
  const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
195
152
  const updateContainerHeight = useCallback(height => {
@@ -386,7 +343,7 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
386
343
  const {
387
344
  tableState,
388
345
  editorViewModeState
389
- } = useSharedState(pluginInjectionApi);
346
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
390
347
  const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
391
348
  const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
392
349
  const updateContainerHeight = useCallback(height => {
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl-next';
4
4
  import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
5
5
  import { browser } from '@atlaskit/editor-common/browser';
6
6
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
7
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
9
9
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
10
10
  import { logException } from '@atlaskit/editor-common/monitoring';
@@ -103,21 +103,6 @@ const selector = states => {
103
103
  widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
104
104
  };
105
105
  };
106
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
107
- const {
108
- widthToWidest
109
- } = useSharedPluginStateWithSelector(api, ['table'], selector);
110
- return {
111
- widthToWidest
112
- };
113
- }, api => {
114
- const {
115
- tableState
116
- } = useSharedPluginState(api, ['table']);
117
- return {
118
- widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
119
- };
120
- });
121
106
  export const TableResizer = ({
122
107
  children,
123
108
  width,
@@ -153,7 +138,7 @@ export const TableResizer = ({
153
138
  const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
154
139
  const {
155
140
  widthToWidest
156
- } = useSharedState(pluginInjectionApi);
141
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], selector);
157
142
 
158
143
  // used to reposition tooltip when table is resizing via keyboard
159
144
  const updateTooltip = React.useRef();
@@ -62,7 +62,7 @@ export default class TableView extends ReactNodeView {
62
62
  this.eventDispatcher = props.eventDispatcher;
63
63
  this.options = props.options;
64
64
  this.getEditorFeatureFlags = props.getEditorFeatureFlags;
65
- this.handleRef = node => this._handleTableRef(node, props.node);
65
+ this.handleRef = node => this._handleTableRef(node);
66
66
  }
67
67
  getContentDOM() {
68
68
  var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3, _this$reactComponentP4;
@@ -100,7 +100,7 @@ export default class TableView extends ReactNodeView {
100
100
  * wasn't at start of node. This prevents duplicate tables and maintains editor state during
101
101
  * the DOM manipulation.
102
102
  */
103
- _handleTableRef(node, pmNode) {
103
+ _handleTableRef(node) {
104
104
  let oldIgnoreMutation;
105
105
  let selectionBookmark;
106
106
  let mutationsIgnored = false;
@@ -127,8 +127,8 @@ export default class TableView extends ReactNodeView {
127
127
  selectionBookmark = this.view.state.selection.getBookmark();
128
128
  }
129
129
  if (this.dom && expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
130
- this.dom.setAttribute('data-ssr-placeholder', `table-nodeview-${pmNode.attrs.localId}`);
131
- this.dom.setAttribute('data-ssr-placeholder-replace', `table-nodeview-${pmNode.attrs.localId}`);
130
+ this.dom.setAttribute('data-ssr-placeholder', `table-nodeview-${this.node.attrs.localId}`);
131
+ this.dom.setAttribute('data-ssr-placeholder-replace', `table-nodeview-${this.node.attrs.localId}`);
132
132
  }
133
133
 
134
134
  // Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.