@atlaskit/editor-plugin-table 13.0.5 → 13.0.7

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 (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +5 -3
  3. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
  4. package/dist/cjs/nodeviews/TableContainer.js +14 -53
  5. package/dist/cjs/nodeviews/TableResizer.js +2 -15
  6. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +26 -0
  7. package/dist/cjs/tablePlugin.js +30 -213
  8. package/dist/cjs/ui/DragHandle/index.js +9 -26
  9. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
  10. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
  11. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
  12. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
  13. package/dist/cjs/ui/global-styles.js +4 -17
  14. package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
  15. package/dist/es2019/nodeviews/TableComponent.js +5 -3
  16. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
  17. package/dist/es2019/nodeviews/TableContainer.js +11 -54
  18. package/dist/es2019/nodeviews/TableResizer.js +2 -17
  19. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +26 -0
  20. package/dist/es2019/tablePlugin.js +19 -211
  21. package/dist/es2019/ui/DragHandle/index.js +8 -27
  22. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
  23. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
  24. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
  25. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
  26. package/dist/es2019/ui/global-styles.js +6 -21
  27. package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
  28. package/dist/esm/nodeviews/TableComponent.js +5 -3
  29. package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
  30. package/dist/esm/nodeviews/TableContainer.js +15 -54
  31. package/dist/esm/nodeviews/TableResizer.js +3 -16
  32. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +26 -0
  33. package/dist/esm/tablePlugin.js +24 -208
  34. package/dist/esm/ui/DragHandle/index.js +10 -27
  35. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
  36. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
  37. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
  38. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
  39. package/dist/esm/ui/global-styles.js +5 -18
  40. package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
  41. package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  42. package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  43. package/package.json +7 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 13.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5be5ab89fb72d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5be5ab89fb72d) -
8
+ Add tableDragAndDrop insm feature tracking
9
+ - [`790dacebab86f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/790dacebab86f) -
10
+ fix table resize issue when table scailing experiment is on
11
+ - Updated dependencies
12
+
13
+ ## 13.0.6
14
+
15
+ ### Patch Changes
16
+
17
+ - [`f3ccf5a62c62f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f3ccf5a62c62f) -
18
+ PR to cleanup platform_editor_usesharedpluginstatewithselector for table
19
+
3
20
  ## 13.0.5
4
21
 
5
22
  ### Patch Changes
@@ -461,6 +461,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
461
461
  }
462
462
  }
463
463
  });
464
+ if ((0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
465
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
466
+ window.addEventListener('resize', this.handleWindowResizeNewDebounced);
467
+ }
464
468
  }
465
469
  }
466
470
  }, {
@@ -551,8 +555,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
551
555
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
552
556
  window.addEventListener('resize', this.handleWindowResizeDebounced);
553
557
  }
554
- // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
555
- window.addEventListener('resize', this.handleWindowResizeNewDebounced);
556
558
  this.handleTableResizingDebounced();
557
559
  }
558
560
  var currentStickyState = _pluginKey.pluginKey.getState(this.props.view.state);
@@ -606,7 +608,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
606
608
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
607
609
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
608
610
  }
609
- if (allowColumnResizing) {
611
+ if ((0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
610
612
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
611
613
  window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
612
614
  }
@@ -8,13 +8,27 @@ exports.TableComponentWithSharedState = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _editorTables = require("@atlaskit/editor-tables");
11
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
11
  var _TableComponent = _interopRequireDefault(require("./TableComponent"));
14
12
  // Ignored via go/ees005
15
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
14
 
17
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
15
+ /**
16
+ * Use useSharedPluginState to control re-renders from plugin dependencies
17
+ */
18
+ var TableComponentWithSharedState = exports.TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
19
+ var view = _ref.view,
20
+ options = _ref.options,
21
+ getNode = _ref.getNode,
22
+ dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
23
+ api = _ref.api,
24
+ getEditorFeatureFlags = _ref.getEditorFeatureFlags,
25
+ eventDispatcher = _ref.eventDispatcher,
26
+ allowColumnResizing = _ref.allowColumnResizing,
27
+ allowControls = _ref.allowControls,
28
+ getPos = _ref.getPos,
29
+ forwardRef = _ref.forwardRef,
30
+ allowTableAlignment = _ref.allowTableAlignment,
31
+ allowTableResizing = _ref.allowTableResizing;
18
32
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction'], function (states) {
19
33
  var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt;
20
34
  return {
@@ -60,97 +74,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
60
74
  mode = _useSharedPluginState.mode,
61
75
  selection = _useSharedPluginState.selection,
62
76
  width = _useSharedPluginState.width;
63
- return {
64
- tableState: undefined,
65
- widthState: undefined,
66
- isTableResizing: isTableResizing,
67
- isHeaderColumnEnabled: isHeaderColumnEnabled,
68
- isHeaderRowEnabled: isHeaderRowEnabled,
69
- ordering: ordering,
70
- isResizing: isResizing,
71
- isInDanger: isInDanger,
72
- hoveredCell: hoveredCell,
73
- hoveredRows: hoveredRows,
74
- isTableHovered: isTableHovered,
75
- isWholeTableInDanger: isWholeTableInDanger,
76
- isFullscreen: isFullscreen,
77
- selection: selection,
78
- mode: mode,
79
- width: width,
80
- lineLength: lineLength,
81
- interaction: interaction
82
- };
83
- }, function (api) {
84
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']),
85
- widthState = _useSharedPluginState2.widthState,
86
- tableState = _useSharedPluginState2.tableState,
87
- mediaState = _useSharedPluginState2.mediaState,
88
- selectionState = _useSharedPluginState2.selectionState,
89
- editorViewModeState = _useSharedPluginState2.editorViewModeState,
90
- interactionState = _useSharedPluginState2.interactionState;
91
- var tableStateInternal = tableState;
92
- return {
93
- tableState: tableState,
94
- widthState: widthState,
95
- isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
96
- isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
97
- isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
98
- ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
99
- isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
100
- isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
101
- hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
102
- hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
103
- isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
104
- isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
105
- isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
106
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
107
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
108
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
109
- lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
110
- interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
111
- };
112
- });
113
-
114
- /**
115
- * Use useSharedPluginState to control re-renders from plugin dependencies
116
- */
117
- var TableComponentWithSharedState = exports.TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
118
- var view = _ref.view,
119
- options = _ref.options,
120
- getNode = _ref.getNode,
121
- dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
122
- api = _ref.api,
123
- getEditorFeatureFlags = _ref.getEditorFeatureFlags,
124
- eventDispatcher = _ref.eventDispatcher,
125
- allowColumnResizing = _ref.allowColumnResizing,
126
- allowControls = _ref.allowControls,
127
- getPos = _ref.getPos,
128
- forwardRef = _ref.forwardRef,
129
- allowTableAlignment = _ref.allowTableAlignment,
130
- allowTableResizing = _ref.allowTableResizing;
131
- var _useSharedState = useSharedState(api),
132
- tableState = _useSharedState.tableState,
133
- widthState = _useSharedState.widthState,
134
- mode = _useSharedState.mode,
135
- hoveredCell = _useSharedState.hoveredCell,
136
- hoveredRows = _useSharedState.hoveredRows,
137
- isFullscreen = _useSharedState.isFullscreen,
138
- isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
139
- isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
140
- isInDanger = _useSharedState.isInDanger,
141
- isResizing = _useSharedState.isResizing,
142
- isTableHovered = _useSharedState.isTableHovered,
143
- isTableResizing = _useSharedState.isTableResizing,
144
- isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
145
- lineLength = _useSharedState.lineLength,
146
- ordering = _useSharedState.ordering,
147
- selection = _useSharedState.selection,
148
- width = _useSharedState.width,
149
- interaction = _useSharedState.interaction;
150
77
  var isLivePageViewMode = mode === 'view';
151
- if ((0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
152
- return null;
153
- }
154
78
 
155
79
  /**
156
80
  * ED-19810
@@ -184,13 +108,10 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
184
108
  ordering: ordering,
185
109
  isResizing: isResizing,
186
110
  getNode: getNode,
187
- containerWidth: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstatewithselector', true) ? {
111
+ containerWidth: {
188
112
  width: width !== null && width !== void 0 ? width : 0,
189
113
  lineLength: lineLength
190
- } :
191
- // Ignored via go/ees005
192
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
193
- widthState,
114
+ },
194
115
  contentDOM: forwardRef,
195
116
  getEditorFeatureFlags: getEditorFeatureFlags,
196
117
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -45,7 +45,13 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
45
45
  "data-testid": "table-container"
46
46
  }, children);
47
47
  });
48
- var useAlignmentTableContainerSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
48
+ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
49
+ var node = _ref2.node,
50
+ children = _ref2.children,
51
+ pluginInjectionApi = _ref2.pluginInjectionApi,
52
+ getPos = _ref2.getPos,
53
+ editorView = _ref2.editorView;
54
+ var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
49
55
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table'], function (states) {
50
56
  var _states$tableState, _states$tableState2;
51
57
  return {
@@ -55,35 +61,7 @@ var useAlignmentTableContainerSharedState = (0, _hooks.sharedPluginStateHookMigr
55
61
  }),
56
62
  isFullWidthModeEnabled = _useSharedPluginState.isFullWidthModeEnabled,
57
63
  wasFullWidthModeEnabled = _useSharedPluginState.wasFullWidthModeEnabled;
58
- return {
59
- tableState: undefined,
60
- isFullWidthModeEnabled: isFullWidthModeEnabled,
61
- wasFullWidthModeEnabled: wasFullWidthModeEnabled
62
- };
63
- }, function (pluginInjectionApi) {
64
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
65
- tableState = _useSharedPluginState2.tableState;
66
- return {
67
- tableState: tableState,
68
- isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
69
- wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
70
- };
71
- });
72
- var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
73
- var node = _ref2.node,
74
- children = _ref2.children,
75
- pluginInjectionApi = _ref2.pluginInjectionApi,
76
- getPos = _ref2.getPos,
77
- editorView = _ref2.editorView;
78
- var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
79
- var _useAlignmentTableCon = useAlignmentTableContainerSharedState(pluginInjectionApi),
80
- tableState = _useAlignmentTableCon.tableState,
81
- isFullWidthModeEnabled = _useAlignmentTableCon.isFullWidthModeEnabled,
82
- wasFullWidthModeEnabled = _useAlignmentTableCon.wasFullWidthModeEnabled;
83
64
  (0, _react.useEffect)(function () {
84
- if (!tableState && (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
85
- return;
86
- }
87
65
  if (editorView && getPos) {
88
66
  var state = editorView.state,
89
67
  dispatch = editorView.dispatch;
@@ -100,7 +78,7 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
100
78
  }
101
79
  }
102
80
  // eslint-disable-next-line react-hooks/exhaustive-deps
103
- }, [editorView, tableState, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
81
+ }, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
104
82
  var style = (0, _react.useMemo)(function () {
105
83
  return (0, _tableContainerStyles.getAlignmentStyle)(alignment);
106
84
  }, [alignment]);
@@ -146,23 +124,6 @@ var selector = function selector(states) {
146
124
  editorViewModeState: states.editorViewModeState
147
125
  };
148
126
  };
149
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
150
- var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table', 'editorViewMode'], selector),
151
- tableState = _useSharedPluginState3.tableState,
152
- editorViewModeState = _useSharedPluginState3.editorViewModeState;
153
- return {
154
- tableState: tableState,
155
- editorViewModeState: editorViewModeState
156
- };
157
- }, function (api) {
158
- var _useSharedPluginState4 = (0, _hooks.useSharedPluginState)(api, ['table', 'editorViewMode']),
159
- tableState = _useSharedPluginState4.tableState,
160
- editorViewModeState = _useSharedPluginState4.editorViewModeState;
161
- return {
162
- tableState: tableState,
163
- editorViewModeState: editorViewModeState
164
- };
165
- });
166
127
  var getPadding = function getPadding(containerWidth) {
167
128
  return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
168
129
  };
@@ -190,9 +151,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_
190
151
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
191
152
  resizing = _useState2[0],
192
153
  setIsResizing = _useState2[1];
193
- var _useSharedState = useSharedState(pluginInjectionApi),
194
- tableState = _useSharedState.tableState,
195
- editorViewModeState = _useSharedState.editorViewModeState;
154
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
155
+ tableState = _useSharedPluginState2.tableState,
156
+ editorViewModeState = _useSharedPluginState2.editorViewModeState;
196
157
  var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
197
158
  var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
198
159
  var updateContainerHeight = (0, _react.useCallback)(function (height) {
@@ -391,9 +352,9 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
391
352
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
392
353
  tableMaxWidthForFullPageOnLoad = _useState6[0],
393
354
  setTableMaxWidthForFullPageOnLoad = _useState6[1];
394
- var _useSharedState2 = useSharedState(pluginInjectionApi),
395
- tableState = _useSharedState2.tableState,
396
- editorViewModeState = _useSharedState2.editorViewModeState;
355
+ var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
356
+ tableState = _useSharedPluginState3.tableState,
357
+ editorViewModeState = _useSharedPluginState3.editorViewModeState;
397
358
  var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
398
359
  var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
399
360
  var updateContainerHeight = (0, _react.useCallback)(function (height) {
@@ -116,19 +116,6 @@ var selector = function selector(states) {
116
116
  widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
117
117
  };
118
118
  };
119
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
120
- var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table'], selector),
121
- widthToWidest = _useSharedPluginState.widthToWidest;
122
- return {
123
- widthToWidest: widthToWidest
124
- };
125
- }, function (api) {
126
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['table']),
127
- tableState = _useSharedPluginState2.tableState;
128
- return {
129
- widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
130
- };
131
- });
132
119
  var TableResizer = exports.TableResizer = function TableResizer(_ref) {
133
120
  var _editorView$state, _pluginInjectionApi$a2;
134
121
  var children = _ref.children,
@@ -161,8 +148,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
161
148
  var areResizeMetaKeysPressed = (0, _react.useRef)(false);
162
149
  var resizerRef = (0, _react.useRef)(null);
163
150
  var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.interactionState');
164
- var _useSharedState = useSharedState(pluginInjectionApi),
165
- widthToWidest = _useSharedState.widthToWidest;
151
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table'], selector),
152
+ widthToWidest = _useSharedPluginState.widthToWidest;
166
153
 
167
154
  // used to reposition tooltip when table is resizing via keyboard
168
155
  var updateTooltip = _react.default.useRef();
@@ -9,9 +9,11 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
+ var _insm = require("@atlaskit/insm");
12
13
  var _element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
13
14
  var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
14
15
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
17
  var _pluginFactory = require("../plugin-factory");
16
18
  var _pluginKey = require("../plugin-key");
17
19
  var _colgroup = require("../table-resizing/utils/colgroup");
@@ -34,12 +36,20 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
34
36
  return type === 'table-row';
35
37
  },
36
38
  onDragStart: function onDragStart() {
39
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
40
+ var _insm$session;
41
+ (_insm$session = _insm.insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('tableDragAndDrop');
42
+ }
37
43
  // auto scroller doesn't work when scroll-behavior: smooth is set, this monitor temporarily removes it via inline styles
38
44
  // Ignored via go/ees005
39
45
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
40
46
  editorPageScrollContainer.style.setProperty('scroll-behavior', 'unset');
41
47
  },
42
48
  onDrop: function onDrop() {
49
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
50
+ var _insm$session2;
51
+ (_insm$session2 = _insm.insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableDragAndDrop');
52
+ }
43
53
  // 'null' will remove the inline style
44
54
  // Ignored via go/ees005
45
55
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -76,6 +86,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
76
86
  },
77
87
  onDragStart: function onDragStart(_ref7) {
78
88
  var location = _ref7.location;
89
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
90
+ var _insm$session3;
91
+ (_insm$session3 = _insm.insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
92
+ }
79
93
  (0, _commands.toggleDragMenu)(false)(editorView.state, editorView.dispatch);
80
94
  },
81
95
  onDrag: function onDrag(event) {
@@ -124,6 +138,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
124
138
  var _event$source, _event$source2;
125
139
  // If we're able to determine the source type of the dropped element then we should report to analytics that
126
140
  // the drop event was cancelled. Otherwise we will cancel silently.
141
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
142
+ var _insm$session4;
143
+ (_insm$session4 = _insm.insm.session) === null || _insm$session4 === void 0 || _insm$session4.endFeature('tableDragAndDrop');
144
+ }
127
145
  if ((event === null || event === void 0 || (_event$source = event.source) === null || _event$source === void 0 || (_event$source = _event$source.data) === null || _event$source === void 0 ? void 0 : _event$source.type) === 'table-row' || (event === null || event === void 0 || (_event$source2 = event.source) === null || _event$source2 === void 0 || (_event$source2 = _event$source2.data) === null || _event$source2 === void 0 ? void 0 : _event$source2.type) === 'table-column') {
128
146
  var _event$source$data;
129
147
  return (0, _commandsWithAnalytics.clearDropTargetWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.DRAG_AND_DROP, event.source.data.type, (_event$source$data = event.source.data) === null || _event$source$data === void 0 ? void 0 : _event$source$data.indexes, _analytics.TABLE_STATUS.CANCELLED, tr)(editorView.state, editorView.dispatch);
@@ -150,6 +168,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
150
168
  (0, _commandsWithAnalytics.clearDropTargetWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.DRAG_AND_DROP, sourceType, sourceIndexes,
151
169
  // This event is mrked as invalid because the user is attempting to drop an element in an area which has merged cells.
152
170
  _analytics.TABLE_STATUS.INVALID, tr)(editorView.state, editorView.dispatch);
171
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
172
+ var _insm$session5;
173
+ (_insm$session5 = _insm.insm.session) === null || _insm$session5 === void 0 || _insm$session5.endFeature('tableDragAndDrop');
174
+ }
153
175
  return;
154
176
  }
155
177
  requestAnimationFrame(function () {
@@ -179,6 +201,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
179
201
  }
180
202
  }
181
203
  editorView.focus();
204
+ if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
205
+ var _insm$session6;
206
+ (_insm$session6 = _insm.insm.session) === null || _insm$session6 === void 0 || _insm$session6.endFeature('tableDragAndDrop');
207
+ }
182
208
  });
183
209
  }
184
210
  })]));