@atlaskit/editor-plugin-table 7.6.3 → 7.6.5

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 (141) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/commands/column-resize.js +62 -16
  3. package/dist/cjs/commands/go-to-next-cell.js +5 -2
  4. package/dist/cjs/commands/misc.js +3 -2
  5. package/dist/cjs/commands-with-analytics.js +8 -2
  6. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
  7. package/dist/cjs/nodeviews/TableComponent.js +8 -6
  8. package/dist/cjs/nodeviews/TableContainer.js +32 -20
  9. package/dist/cjs/nodeviews/TableResizer.js +40 -28
  10. package/dist/cjs/plugin.js +60 -58
  11. package/dist/cjs/pm-plugins/keymap.js +26 -8
  12. package/dist/cjs/pm-plugins/main.js +15 -4
  13. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
  14. package/dist/cjs/toolbar.js +5 -4
  15. package/dist/cjs/ui/DragHandle/index.js +2 -2
  16. package/dist/cjs/ui/DragPreview/index.js +2 -0
  17. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
  18. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  19. package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
  20. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
  21. package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
  22. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
  23. package/dist/cjs/ui/LayoutButton/index.js +2 -0
  24. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  25. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  26. package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  27. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  28. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  29. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  30. package/dist/cjs/ui/common-styles.js +4 -0
  31. package/dist/cjs/ui/ui-styles.js +93 -37
  32. package/dist/cjs/utils/guidelines.js +1 -1
  33. package/dist/es2019/commands/column-resize.js +53 -4
  34. package/dist/es2019/commands/go-to-next-cell.js +5 -2
  35. package/dist/es2019/commands/misc.js +6 -2
  36. package/dist/es2019/commands-with-analytics.js +8 -2
  37. package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
  38. package/dist/es2019/nodeviews/TableComponent.js +9 -7
  39. package/dist/es2019/nodeviews/TableContainer.js +17 -3
  40. package/dist/es2019/nodeviews/TableResizer.js +27 -17
  41. package/dist/es2019/plugin.js +6 -3
  42. package/dist/es2019/pm-plugins/keymap.js +25 -9
  43. package/dist/es2019/pm-plugins/main.js +15 -4
  44. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
  45. package/dist/es2019/toolbar.js +5 -4
  46. package/dist/es2019/ui/DragHandle/index.js +2 -2
  47. package/dist/es2019/ui/DragPreview/index.js +2 -0
  48. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
  49. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  50. package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
  51. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
  52. package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
  53. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
  54. package/dist/es2019/ui/LayoutButton/index.js +2 -0
  55. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  56. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  57. package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  58. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  59. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  60. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  61. package/dist/es2019/ui/common-styles.js +4 -0
  62. package/dist/es2019/ui/ui-styles.js +66 -70
  63. package/dist/es2019/utils/guidelines.js +1 -1
  64. package/dist/esm/commands/column-resize.js +62 -16
  65. package/dist/esm/commands/go-to-next-cell.js +5 -2
  66. package/dist/esm/commands/misc.js +3 -2
  67. package/dist/esm/commands-with-analytics.js +8 -2
  68. package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
  69. package/dist/esm/nodeviews/TableComponent.js +9 -7
  70. package/dist/esm/nodeviews/TableContainer.js +32 -20
  71. package/dist/esm/nodeviews/TableResizer.js +41 -29
  72. package/dist/esm/plugin.js +60 -58
  73. package/dist/esm/pm-plugins/keymap.js +26 -8
  74. package/dist/esm/pm-plugins/main.js +15 -4
  75. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
  76. package/dist/esm/toolbar.js +5 -4
  77. package/dist/esm/ui/DragHandle/index.js +2 -2
  78. package/dist/esm/ui/DragPreview/index.js +2 -0
  79. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
  80. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
  81. package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
  82. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
  83. package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
  84. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
  85. package/dist/esm/ui/LayoutButton/index.js +2 -0
  86. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  87. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  88. package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  89. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  90. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  91. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  92. package/dist/esm/ui/common-styles.js +4 -0
  93. package/dist/esm/ui/ui-styles.js +93 -37
  94. package/dist/esm/utils/guidelines.js +1 -1
  95. package/dist/types/commands/column-resize.d.ts +23 -4
  96. package/dist/types/commands/go-to-next-cell.d.ts +2 -1
  97. package/dist/types/commands/misc.d.ts +2 -1
  98. package/dist/types/commands-with-analytics.d.ts +2 -1
  99. package/dist/types/nodeviews/TableResizer.d.ts +3 -1
  100. package/dist/types/pm-plugins/keymap.d.ts +3 -1
  101. package/dist/types/types.d.ts +13 -3
  102. package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
  103. package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
  104. package/dist/types-ts4.5/commands/misc.d.ts +2 -1
  105. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
  106. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
  107. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
  108. package/dist/types-ts4.5/types.d.ts +13 -3
  109. package/package.json +3 -6
  110. package/src/commands/column-resize.ts +105 -29
  111. package/src/commands/go-to-next-cell.ts +10 -2
  112. package/src/commands/misc.ts +6 -3
  113. package/src/commands-with-analytics.ts +11 -5
  114. package/src/nodeviews/ExternalDropTargets.tsx +2 -0
  115. package/src/nodeviews/TableComponent.tsx +14 -16
  116. package/src/nodeviews/TableContainer.tsx +18 -3
  117. package/src/nodeviews/TableResizer.tsx +35 -21
  118. package/src/plugin.tsx +4 -1
  119. package/src/pm-plugins/keymap.ts +44 -6
  120. package/src/pm-plugins/main.ts +18 -4
  121. package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
  122. package/src/toolbar.tsx +20 -19
  123. package/src/types.ts +14 -2
  124. package/src/ui/DragHandle/index.tsx +2 -2
  125. package/src/ui/DragPreview/index.tsx +2 -0
  126. package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
  127. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
  128. package/src/ui/FloatingDeleteButton/index.tsx +2 -0
  129. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
  130. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
  131. package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
  132. package/src/ui/LayoutButton/index.tsx +2 -0
  133. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
  134. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
  135. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
  136. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
  137. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
  138. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
  139. package/src/ui/common-styles.ts +2 -0
  140. package/src/ui/ui-styles.ts +90 -79
  141. package/src/utils/guidelines.ts +5 -4
@@ -1,3 +1,4 @@
1
+ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
1
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
3
  import { TableMap } from '@atlaskit/editor-tables';
3
4
  import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
@@ -57,7 +58,10 @@ const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHan
57
58
  }
58
59
  return false;
59
60
  };
60
- export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
61
+ export const initiateKeyboardColumnResizing = ({
62
+ ariaNotify,
63
+ getIntl
64
+ }) => (state, dispatch, view) => {
61
65
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
62
66
  return false;
63
67
  }
@@ -66,12 +70,19 @@ export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
66
70
  } = state;
67
71
  const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
68
72
  const cell = findCellClosestToPos(selection.$from);
73
+ if (ariaNotify && getIntl) {
74
+ ariaNotify(getIntl().formatMessage(messages.startedColumnResize));
75
+ }
69
76
  if (selectionRect && cell && view) {
70
77
  return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
71
78
  }
72
79
  return false;
73
80
  };
74
- export const activateNextResizeArea = direction => (state, dispatch, view) => {
81
+ export const activateNextResizeArea = ({
82
+ direction,
83
+ ariaNotify,
84
+ getIntl
85
+ }) => (state, dispatch, view) => {
75
86
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
76
87
  return false;
77
88
  }
@@ -102,6 +113,18 @@ export const activateNextResizeArea = direction => (state, dispatch, view) => {
102
113
  }
103
114
  const currentCellRect = tableMap.findCell($currentCell.pos - $currentCell.start(-1));
104
115
  const $nextCell = nextCell($currentCell, 'horiz', direction);
116
+ if (ariaNotify && getIntl) {
117
+ let columnDirection = '';
118
+ if (direction === 1) {
119
+ columnDirection = getIntl().formatMessage(messages.columnRightResize);
120
+ }
121
+ if (direction === -1) {
122
+ columnDirection = getIntl().formatMessage(messages.columnLeftResize);
123
+ }
124
+ ariaNotify(getIntl().formatMessage(messages.focusedOtherResize, {
125
+ direction: columnDirection
126
+ }));
127
+ }
105
128
  if ($nextCell) {
106
129
  // we are somewhere in between the side columns of the table
107
130
  const offset = $nextCell.pos - $nextCell.start(-1);
@@ -121,7 +144,13 @@ export const activateNextResizeArea = direction => (state, dispatch, view) => {
121
144
  }
122
145
  return false;
123
146
  };
124
- export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth, isTableScalingEnabled = false) => (state, dispatch, view) => {
147
+ export const changeColumnWidthByStep = ({
148
+ stepSize,
149
+ getEditorContainerWidth,
150
+ isTableScalingEnabled,
151
+ ariaNotify,
152
+ getIntl
153
+ }) => (state, dispatch, view) => {
125
154
  let customTr = state.tr;
126
155
  const fakeDispatch = tr => {
127
156
  customTr = tr;
@@ -183,9 +212,26 @@ export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth, isTab
183
212
  if (dispatch) {
184
213
  dispatch(customTr);
185
214
  }
215
+ if (ariaNotify && getIntl) {
216
+ ariaNotify(getIntl().formatMessage(messages.changedColumnWidth, {
217
+ width: Math.floor(newResizeState.cols[colIndex].width)
218
+ }));
219
+ if (newResizeState.cols.length === colIndex + 1) {
220
+ if (newResizeState.overflow === true) {
221
+ ariaNotify(getIntl().formatMessage(messages.columnResizeLast));
222
+ }
223
+ if (newResizeState.overflow === false) {
224
+ ariaNotify(getIntl().formatMessage(messages.columnResizeOverflow));
225
+ }
226
+ }
227
+ }
186
228
  return true;
187
229
  };
188
- export const stopKeyboardColumnResizing = originalTr => (state, dispatch) => {
230
+ export const stopKeyboardColumnResizing = ({
231
+ ariaNotify,
232
+ getIntl,
233
+ originalTr
234
+ }) => (state, dispatch) => {
189
235
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
190
236
  return false;
191
237
  }
@@ -207,6 +253,9 @@ export const stopKeyboardColumnResizing = originalTr => (state, dispatch) => {
207
253
  tableResizingPluginCreateCommand({
208
254
  type: 'STOP_RESIZING'
209
255
  }, () => customTr.setMeta('scrollIntoView', false))(state, fakeDispatch);
256
+ if (ariaNotify && getIntl) {
257
+ ariaNotify(getIntl().formatMessage(messages.columnResizeStop));
258
+ }
210
259
  if (dispatch) {
211
260
  dispatch(customTr);
212
261
  return true;
@@ -10,7 +10,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
10
10
  import { stopKeyboardColumnResizing } from './column-resize';
11
11
  const TAB_FORWARD_DIRECTION = 1;
12
12
  const TAB_BACKWARD_DIRECTION = -1;
13
- export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch, view) => {
13
+ export const goToNextCell = (editorAnalyticsAPI, ariaNotify, getIntl) => direction => (state, dispatch, view) => {
14
14
  const table = findTable(state.selection);
15
15
  if (!table) {
16
16
  return false;
@@ -19,7 +19,10 @@ export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch,
19
19
  var _getPluginState;
20
20
  const isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
21
21
  if (isColumnResizing) {
22
- stopKeyboardColumnResizing()(state, dispatch, view);
22
+ stopKeyboardColumnResizing({
23
+ ariaNotify: ariaNotify,
24
+ getIntl: getIntl
25
+ })(state, dispatch, view);
23
26
  return true;
24
27
  }
25
28
  }
@@ -1,3 +1,4 @@
1
+ import isEqual from 'lodash/isEqual';
1
2
  import { closestElement, isParagraph, isTextSelection, mapSlice } from '@atlaskit/editor-common/utils';
2
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
3
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -527,13 +528,16 @@ export const updateWidthToWidest = widthToWidest => createCommand(state => {
527
528
  let {
528
529
  widthToWidest: prevWidthToWidest
529
530
  } = getPluginState(state);
530
- if (prevWidthToWidest === widthToWidest) {
531
+ if (isEqual(widthToWidest, prevWidthToWidest)) {
531
532
  return false;
532
533
  }
533
534
  return {
534
535
  type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
535
536
  data: {
536
- widthToWidest
537
+ widthToWidest: {
538
+ ...prevWidthToWidest,
539
+ ...widthToWidest
540
+ }
537
541
  }
538
542
  };
539
543
  });
@@ -168,7 +168,7 @@ export const insertRowWithAnalytics = editorAnalyticsAPI => (inputMethod, option
168
168
  eventType: EVENT_TYPE.TRACK
169
169
  };
170
170
  })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
171
- export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod) => withEditorAnalyticsAPI(state => {
171
+ export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod, ariaNotify, getIntl) => withEditorAnalyticsAPI(state => {
172
172
  const {
173
173
  table,
174
174
  totalRowCount,
@@ -193,7 +193,13 @@ export const changeColumnWidthByStepWithAnalytics = editorAnalyticsAPI => (stepS
193
193
  totalColumnCount
194
194
  }
195
195
  };
196
- })(editorAnalyticsAPI)(changeColumnWidthByStep(stepSize, getEditorContainerWidth, isTableScalingEnabled));
196
+ })(editorAnalyticsAPI)(changeColumnWidthByStep({
197
+ stepSize: stepSize,
198
+ getEditorContainerWidth: getEditorContainerWidth,
199
+ isTableScalingEnabled: isTableScalingEnabled,
200
+ ariaNotify: ariaNotify,
201
+ getIntl: getIntl
202
+ }));
197
203
  export const insertColumnWithAnalytics = (editorAnalyticsAPI, isTableScalingEnabled = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
198
204
  const {
199
205
  totalRowCount,
@@ -41,6 +41,7 @@ export const ExternalDropTargets = ({
41
41
  width: getTableWrapperWidth(),
42
42
  overflow: 'hidden',
43
43
  position: 'absolute',
44
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
44
45
  top: `-${dropTargetExtendedWidth - tableMarginTop}px`,
45
46
  pointerEvents: 'auto',
46
47
  zIndex: `${dropTargetsZIndex}`
@@ -50,6 +51,7 @@ export const ExternalDropTargets = ({
50
51
  style: {
51
52
  display: 'flex',
52
53
  // move drop targets based on table wrapper scroll
54
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
53
55
  marginLeft: `-${getScrollOffset()}px`
54
56
  }
55
57
  }, colWidths === null || colWidths === void 0 ? void 0 : colWidths.map((width, index) => {
@@ -7,7 +7,7 @@ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-commo
7
7
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
8
8
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
9
9
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
10
- import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
10
+ import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
11
11
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
@@ -21,7 +21,6 @@ import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup
21
21
  import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
22
22
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
23
23
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
24
- import { tableOverflowShadowWidth, tableOverflowShadowWidthWide } from '../ui/consts';
25
24
  import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
26
25
  import TableFloatingControls from '../ui/TableFloatingControls';
27
26
  import { containsHeaderRow, isTableNested, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns } from '../utils';
@@ -737,7 +736,7 @@ class TableComponent extends React.Component {
737
736
  style: {
738
737
  visibility: showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
739
738
  top: `${topStickyShadowPosition}px`,
740
- paddingBottom: `${isDragAndDropEnabled ? '1px' : ''}`
739
+ paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
741
740
  }
742
741
  }), /*#__PURE__*/React.createElement("div", {
743
742
  className: classnames(ClassName.TABLE_NODE_WRAPPER),
@@ -756,10 +755,11 @@ class TableComponent extends React.Component {
756
755
  }, allowControls && colControls), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
757
756
  className: ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
758
757
  style: {
759
- height: MAX_BROWSER_SCROLLBAR_HEIGHT,
758
+ height: "var(--ds-space-250, 20px)",
759
+ // MAX_BROWSER_SCROLLBAR_HEIGHT
760
760
  display: 'none',
761
761
  // prevent unwanted scroll during table resize without removing scrollbar container from the dom
762
- width: isResizing ? '0px' : '100%'
762
+ width: isResizing ? "var(--ds-space-0, 0px)" : '100%'
763
763
  }
764
764
  }, /*#__PURE__*/React.createElement("div", {
765
765
  style: {
@@ -773,14 +773,16 @@ class TableComponent extends React.Component {
773
773
  }), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
774
774
  style: {
775
775
  position: 'absolute',
776
- right: getBooleanFF('platform.editor.custom-table-width') ? `${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth}px` : '-2px'
776
+ right: getBooleanFF('platform.editor.custom-table-width') ? `${getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
777
+ : "var(--ds-space-100, 8px)" // tableOverflowShadowWidth
778
+ }` : "var(--ds-space-negative-025, -2px)"
777
779
  }
778
780
  }, /*#__PURE__*/React.createElement("div", {
779
781
  className: `${ClassName.TABLE_RIGHT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
780
782
  style: {
781
783
  visibility: showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
782
784
  top: `${topStickyShadowPosition}px`,
783
- paddingBottom: `${isDragAndDropEnabled ? '1px' : ''}`
785
+ paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
784
786
  }
785
787
  })), /*#__PURE__*/React.createElement("div", {
786
788
  className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
@@ -1,5 +1,6 @@
1
1
  import React, { forwardRef, useCallback, useRef, useState } from 'react';
2
2
  import classNames from 'classnames';
3
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
4
5
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
6
  import { akEditorDefaultLayoutWidth, akEditorGutterPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
@@ -29,7 +30,7 @@ export const InnerContainer = /*#__PURE__*/forwardRef(({
29
30
  className: className,
30
31
  "data-number-column": node.attrs.isNumberColumnEnabled,
31
32
  "data-layout": node.attrs.layout,
32
- "data-test-id": "table-container"
33
+ "data-testid": "table-container"
33
34
  }, children);
34
35
  });
35
36
  export const ResizableTableContainer = /*#__PURE__*/React.memo(({
@@ -46,6 +47,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
46
47
  tableWrapperHeight,
47
48
  isWholeTableInDanger
48
49
  }) => {
50
+ var _node$attrs$localId, _node$attrs;
49
51
  const containerRef = useRef(null);
50
52
  const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
51
53
  const [resizing, setIsResizing] = useState(false);
@@ -102,9 +104,20 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
102
104
  return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
103
105
  }, [pluginInjectionApi]);
104
106
  const tableWidth = getTableContainerWidth(node);
107
+ const {
108
+ tableState
109
+ } = useSharedPluginState(pluginInjectionApi, ['table']);
110
+ const {
111
+ widthToWidest
112
+ } = tableState;
113
+ const currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
114
+
105
115
  // 76 is currently an accepted padding value considering the spacing for resizer handle
106
116
  const responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide;
107
- const width = Math.min(tableWidth, responsiveContainerWidth);
117
+ let width = Math.min(tableWidth, responsiveContainerWidth);
118
+ if (isTableScalingEnabled && currentTableNodeLocalId && widthToWidest && widthToWidest[currentTableNodeLocalId]) {
119
+ width = TABLE_MAX_WIDTH;
120
+ }
108
121
  if (!isResizing) {
109
122
  tableWidthRef.current = width;
110
123
  }
@@ -122,7 +135,8 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
122
135
  attachAnalyticsEvent,
123
136
  displayGapCursor,
124
137
  isTableScalingEnabled,
125
- isWholeTableInDanger
138
+ isWholeTableInDanger,
139
+ pluginInjectionApi
126
140
  };
127
141
  if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
128
142
  tableResizerProps = {
@@ -4,17 +4,16 @@ import rafSchd from 'raf-schd';
4
4
  import { useIntl } from 'react-intl-next';
5
5
  import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
6
6
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
7
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
8
  import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
8
9
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
9
10
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
10
11
  import { browser } from '@atlaskit/editor-common/utils';
11
- import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
12
12
  import { findTable } from '@atlaskit/editor-tables/utils';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { updateWidthToWidest } from '../commands/misc';
15
- import { getPluginState } from '../pm-plugins/plugin-factory';
16
15
  import { META_KEYS } from '../pm-plugins/table-analytics';
17
- import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
16
+ import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
18
17
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
19
18
  import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
20
19
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
@@ -27,7 +26,7 @@ const handles = {
27
26
  };
28
27
  const handleStyles = {
29
28
  right: {
30
- // eslint-disable-next-line
29
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
31
30
  right: '-14px',
32
31
  marginTop: "var(--ds-space-150, 12px)"
33
32
  }
@@ -86,14 +85,22 @@ export const TableResizer = ({
86
85
  attachAnalyticsEvent,
87
86
  displayGapCursor,
88
87
  isTableScalingEnabled,
89
- isWholeTableInDanger
88
+ isWholeTableInDanger,
89
+ pluginInjectionApi
90
90
  }) => {
91
91
  var _findTable, _editorView$state;
92
92
  const currentGap = useRef(0);
93
93
  // track resizing state - use ref over state to avoid re-render
94
94
  const isResizing = useRef(false);
95
95
  const areResizeMetaKeysPressed = useRef(false);
96
+ const [localTableWidth, setLocalTableWidth] = useState(width);
96
97
  const resizerRef = useRef(null);
98
+ const {
99
+ tableState
100
+ } = useSharedPluginState(pluginInjectionApi, ['table']);
101
+ const {
102
+ widthToWidest
103
+ } = tableState;
97
104
 
98
105
  // used to reposition tooltip when table is resizing via keyboard
99
106
  const updateTooltip = React.useRef();
@@ -181,7 +188,7 @@ export const TableResizer = ({
181
188
  }
182
189
  }, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
183
190
  const handleResize = useCallback((originalState, delta) => {
184
- var _defaultGuidelinesFor, _defaultGuidelinesFor2;
191
+ var _node$attrs$localId, _node$attrs, _widestGuideline$posi;
185
192
  countFrames();
186
193
  const newWidth = originalState.width + delta.width;
187
194
  let pos;
@@ -208,15 +215,20 @@ export const TableResizer = ({
208
215
  state,
209
216
  dispatch
210
217
  } = editorView;
211
- const widestGuideLineWidthString = (_defaultGuidelinesFor = defaultGuidelinesForPreserveTable(containerWidth)[16].key) === null || _defaultGuidelinesFor === void 0 ? void 0 : (_defaultGuidelinesFor2 = _defaultGuidelinesFor.match(/[\d]*[.]{0,1}[\d]+/g)) === null || _defaultGuidelinesFor2 === void 0 ? void 0 : _defaultGuidelinesFor2.join('');
212
- const widestGuideLineWidth = parseInt(widestGuideLineWidthString || '', 10);
213
- const shouldUpdateWidthToWidest = !!(isTableScalingEnabled && defaultGuidelinesForPreserveTable(containerWidth).length === 17 && widestGuideLineWidth - newWidth <= 1);
214
- updateWidthToWidest(shouldUpdateWidthToWidest)(state, dispatch);
215
- updateWidth(shouldUpdateWidthToWidest ? akEditorFullWidthLayoutWidth : newWidth);
218
+ const currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
219
+ const widestGuideline = defaultGuidelinesForPreserveTable(containerWidth).filter(guideline => guideline.isFullWidth)[0];
220
+ const widestGuideLineWidth = widestGuideline ? (((_widestGuideline$posi = widestGuideline.position) === null || _widestGuideline$posi === void 0 ? void 0 : _widestGuideline$posi.x) || 0) * 2 : null;
221
+ const shouldUpdateWidthToWidest = !!(isTableScalingEnabled && widestGuideLineWidth && Math.abs(widestGuideLineWidth - newWidth) <= 1);
222
+ shouldUpdateWidthToWidest ? setLocalTableWidth(TABLE_MAX_WIDTH) : setLocalTableWidth(newWidth);
223
+ updateWidthToWidest({
224
+ [currentTableNodeLocalId]: shouldUpdateWidthToWidest
225
+ })(state, dispatch);
226
+ updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
216
227
  return newWidth;
217
228
  }, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
218
229
  const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
219
230
  const handleResizeStop = useCallback((originalState, delta) => {
231
+ var _node$attrs$localId2, _node$attrs2;
220
232
  isResizing.current = false;
221
233
  let newWidth = originalState.width + delta.width;
222
234
  const {
@@ -224,10 +236,8 @@ export const TableResizer = ({
224
236
  dispatch
225
237
  } = editorView;
226
238
  const pos = getPos();
227
- const {
228
- widthToWidest
229
- } = getPluginState(editorView.state);
230
- newWidth = widthToWidest ? akEditorFullWidthLayoutWidth : newWidth;
239
+ const currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
240
+ newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? TABLE_MAX_WIDTH : newWidth;
231
241
  let tr = state.tr.setMeta(tableWidthPluginKey, {
232
242
  resizing: false
233
243
  });
@@ -273,7 +283,7 @@ export const TableResizer = ({
273
283
  onResizeStop();
274
284
  }
275
285
  return newWidth;
276
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled]);
286
+ }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, widthToWidest]);
277
287
  const handleTableSizeChangeOnKeypress = useCallback(step => {
278
288
  const newWidth = width + step;
279
289
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -378,7 +388,7 @@ export const TableResizer = ({
378
388
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
379
389
  ref: resizerRef,
380
390
  enable: handles,
381
- width: width,
391
+ width: localTableWidth,
382
392
  handleAlignmentMethod: "sticky",
383
393
  handleSize: handleSize,
384
394
  handleStyles: handleStyles,
@@ -84,7 +84,8 @@ const tablesPlugin = ({
84
84
  isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
85
85
  // IMPORTANT: Need to continue to pass tableNode to control re-renders
86
86
  // TableComponent listens for node attribute changes to update colgroups
87
- tableNode: tablePluginState.tableNode
87
+ tableNode: tablePluginState.tableNode,
88
+ widthToWidest: tablePluginState.widthToWidest
88
89
  };
89
90
  },
90
91
  actions: {
@@ -168,13 +169,15 @@ const tablesPlugin = ({
168
169
  // plugin as it is currently swallowing backspace events inside tables
169
170
  {
170
171
  name: 'tableKeymap',
171
- plugin: () => {
172
+ plugin: ({
173
+ getIntl
174
+ }) => {
172
175
  const {
173
176
  dragAndDropEnabled,
174
177
  isTableScalingEnabled = false,
175
178
  fullWidthEnabled = false
176
179
  } = options || {};
177
- return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled);
180
+ return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled, api, getIntl);
178
181
  }
179
182
  }, {
180
183
  name: 'tableSelectionKeymap',
@@ -18,10 +18,12 @@ const createTableWithAnalytics = (isTableScalingEnabled, isFullWidthModeEnabled,
18
18
  },
19
19
  eventType: EVENT_TYPE.TRACK
20
20
  })(editorAnalyticsAPI)(createTable(isTableScalingEnabled, isFullWidthModeEnabled));
21
- export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isFullWidthEnabled) {
21
+ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl) {
22
+ var _pluginInjectionApi$a;
22
23
  const list = {};
23
- bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
24
- bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
24
+ const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
25
+ bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
26
+ bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
25
27
  bindKeymapWithCommand(toggleTable.common, createTableWithAnalytics(isTableScalingEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
26
28
  bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
27
29
  bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
@@ -50,12 +52,26 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
50
52
  bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
51
53
  }
52
54
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
53
- bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing, list);
54
- bindKeymapWithCommand(moveRight.common, activateNextResizeArea(1), list);
55
- bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
56
- bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT), list);
57
- bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT), list);
58
- bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing(), list);
55
+ bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
56
+ ariaNotify: ariaNotifyPlugin,
57
+ getIntl: getIntl
58
+ }), list);
59
+ bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
60
+ direction: 1,
61
+ ariaNotify: ariaNotifyPlugin,
62
+ getIntl: getIntl
63
+ }), list);
64
+ bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
65
+ direction: -1,
66
+ ariaNotify: ariaNotifyPlugin,
67
+ getIntl: getIntl
68
+ }), list);
69
+ bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(-10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
70
+ bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI)(10, getEditorContainerWidth, isTableScalingEnabled, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
71
+ bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing({
72
+ ariaNotify: ariaNotifyPlugin,
73
+ getIntl: getIntl
74
+ }), list);
59
75
  }
60
76
  return keymap(list);
61
77
  }
@@ -23,6 +23,7 @@ import { defaultHoveredCell, defaultTableSelection } from './default-table-selec
23
23
  import { createPluginState, getPluginState } from './plugin-factory';
24
24
  import { pluginKey } from './plugin-key';
25
25
  export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) => {
26
+ var _accessibilityUtils;
26
27
  const state = createPluginState(dispatch, {
27
28
  pluginConfig,
28
29
  isTableHovered: false,
@@ -44,6 +45,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
44
45
  // Used to prevent invalid table cell spans being reported more than once per editor/document
45
46
  const invalidTableIds = [];
46
47
  let editorViewRef = null;
48
+ const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_accessibilityUtils = pluginInjectionApi.accessibilityUtils) === null || _accessibilityUtils === void 0 ? void 0 : _accessibilityUtils.actions.ariaNotify;
47
49
  const getCurrentEditorState = () => {
48
50
  const editorView = editorViewRef;
49
51
  if (!editorView) {
@@ -103,7 +105,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
103
105
  }
104
106
  const tableNode = findTable(state.selection);
105
107
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
106
- // when cursor leaves the table we need to stop column resizing
108
+ // when keyboard cursor leaves the table we need to stop column resizing
107
109
  const pluginPrevState = getPluginState(prevState);
108
110
  const isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
109
111
  if (isStopKeyboardColumResizing) {
@@ -115,11 +117,17 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
115
117
  // Add/delete row
116
118
  tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
117
119
  // Jump to another table
118
- stopKeyboardColumnResizing()(state, dispatch);
120
+ stopKeyboardColumnResizing({
121
+ ariaNotify: ariaNotifyPlugin,
122
+ getIntl: getIntl
123
+ })(state, dispatch);
119
124
  }
120
125
  } else if (!tableNode) {
121
126
  // selection outside of table
122
- stopKeyboardColumnResizing()(state, dispatch);
127
+ stopKeyboardColumnResizing({
128
+ ariaNotify: ariaNotifyPlugin,
129
+ getIntl: getIntl
130
+ })(state, dispatch);
123
131
  }
124
132
  }
125
133
  }
@@ -235,7 +243,10 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
235
243
  isKeyboardResize
236
244
  } = getPluginState(state);
237
245
  if (isKeyboardResize) {
238
- stopKeyboardColumnResizing()(state, dispatch);
246
+ stopKeyboardColumnResizing({
247
+ ariaNotify: ariaNotifyPlugin,
248
+ getIntl: getIntl
249
+ })(state, dispatch);
239
250
  return false;
240
251
  }
241
252
  }
@@ -132,7 +132,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
132
132
  /** if column resize had started via keyboard but continued by mouse
133
133
  * or mouse pointer leaves the table but mouse button still pressed
134
134
  */
135
- return stopKeyboardColumnResizing()(state, dispatch, view);
135
+ return stopKeyboardColumnResizing({})(state, dispatch, view);
136
136
  } else {
137
137
  return stopResizing()(state, dispatch);
138
138
  }
@@ -197,7 +197,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
197
197
  /** if column resize had started via keyboard but continued by mouse
198
198
  * or mouse pointer leaves the table but mouse button still pressed
199
199
  */
200
- return stopKeyboardColumnResizing(tr)(state, dispatch, view);
200
+ return stopKeyboardColumnResizing({
201
+ originalTr: tr
202
+ })(state, dispatch, view);
201
203
  } else {
202
204
  return stopResizing(tr)(state, dispatch);
203
205
  }
@@ -14,7 +14,6 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
14
14
  import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
15
15
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
16
16
  import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
17
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
18
17
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
19
18
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
20
19
  import { getPluginState } from './pm-plugins/plugin-factory';
@@ -54,7 +53,7 @@ export const getToolbarMenuConfig = (config, state, {
54
53
  disabled: !state.canCollapseTable,
55
54
  hidden: !config.allowCollapse
56
55
  }];
57
- if (state.isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling')) {
56
+ if (state.isDragAndDropEnabled) {
58
57
  return {
59
58
  id: 'editor.table.tableOptions',
60
59
  type: 'dropdown',
@@ -287,6 +286,7 @@ export const getClosestSelectionOrTableRect = state => {
287
286
  return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : tableRect;
288
287
  };
289
288
  export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) => config => (state, intl) => {
289
+ var _tableObject$node$att, _tableObject$node, _tableObject$node$att2;
290
290
  const tableObject = findTable(state.selection);
291
291
  const pluginState = getPluginState(state);
292
292
  const resizeState = tableResizingPluginKey.getState(state);
@@ -298,7 +298,8 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
298
298
  isTableScalingEnabled,
299
299
  widthToWidest
300
300
  } = pluginState;
301
- if (isTableScalingEnabled && isWidthResizing && widthToWidest) {
301
+ const currentTableNodeLocalId = (_tableObject$node$att = tableObject === null || tableObject === void 0 ? void 0 : (_tableObject$node = tableObject.node) === null || _tableObject$node === void 0 ? void 0 : (_tableObject$node$att2 = _tableObject$node.attrs) === null || _tableObject$node$att2 === void 0 ? void 0 : _tableObject$node$att2.localId) !== null && _tableObject$node$att !== void 0 ? _tableObject$node$att : '';
302
+ if (isTableScalingEnabled && isWidthResizing && widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId]) {
302
303
  const {
303
304
  stickyScrollbar
304
305
  } = getEditorFeatureFlags();
@@ -351,7 +352,7 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
351
352
  let cellItems;
352
353
  cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled);
353
354
  let columnSettingsItems;
354
- columnSettingsItems = pluginState.isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled) : [];
355
+ columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled) : [];
355
356
  const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
356
357
 
357
358
  // Check if we need to show confirm dialog for delete button
@@ -156,8 +156,8 @@ const DragHandleComponent = ({
156
156
  // 16px here because it's the size of drag handle button's large side
157
157
  width: isRow ? `${"var(--ds-space-200, 16px)"}` // 16px here because it's the size of drag handle button's large side
158
158
  : `calc(100% - ${dragTableInsertColumnButtonSize}px)`,
159
- left: isRow ? '3px' : undefined,
160
- bottom: isColumn ? '0' : undefined,
159
+ left: isRow ? `${"var(--ds-space-050, 4px)"}` : undefined,
160
+ bottom: isColumn ? `${"var(--ds-space-0, 0px)"}` : undefined,
161
161
  alignSelf: isColumn ? 'none' : 'center',
162
162
  zIndex: isColumn ? '-1' : 'auto'
163
163
  },