@atlaskit/editor-plugin-table 7.6.4 → 7.6.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 (109) hide show
  1. package/CHANGELOG.md +14 -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-with-analytics.js +8 -2
  5. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
  6. package/dist/cjs/nodeviews/TableComponent.js +8 -6
  7. package/dist/cjs/nodeviews/TableResizer.js +2 -1
  8. package/dist/cjs/plugin.js +58 -57
  9. package/dist/cjs/pm-plugins/keymap.js +26 -8
  10. package/dist/cjs/pm-plugins/main.js +15 -4
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
  12. package/dist/cjs/ui/DragHandle/index.js +2 -2
  13. package/dist/cjs/ui/DragPreview/index.js +2 -0
  14. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
  15. package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
  16. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
  17. package/dist/cjs/ui/LayoutButton/index.js +2 -0
  18. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  19. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  20. package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  21. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  22. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  23. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  24. package/dist/cjs/ui/common-styles.js +4 -0
  25. package/dist/cjs/ui/ui-styles.js +93 -37
  26. package/dist/es2019/commands/column-resize.js +53 -4
  27. package/dist/es2019/commands/go-to-next-cell.js +5 -2
  28. package/dist/es2019/commands-with-analytics.js +8 -2
  29. package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
  30. package/dist/es2019/nodeviews/TableComponent.js +9 -7
  31. package/dist/es2019/nodeviews/TableResizer.js +2 -1
  32. package/dist/es2019/plugin.js +4 -2
  33. package/dist/es2019/pm-plugins/keymap.js +25 -9
  34. package/dist/es2019/pm-plugins/main.js +15 -4
  35. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
  36. package/dist/es2019/ui/DragHandle/index.js +2 -2
  37. package/dist/es2019/ui/DragPreview/index.js +2 -0
  38. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
  39. package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
  40. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
  41. package/dist/es2019/ui/LayoutButton/index.js +2 -0
  42. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  43. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  44. package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  45. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  46. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  47. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  48. package/dist/es2019/ui/common-styles.js +4 -0
  49. package/dist/es2019/ui/ui-styles.js +66 -70
  50. package/dist/esm/commands/column-resize.js +62 -16
  51. package/dist/esm/commands/go-to-next-cell.js +5 -2
  52. package/dist/esm/commands-with-analytics.js +8 -2
  53. package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
  54. package/dist/esm/nodeviews/TableComponent.js +9 -7
  55. package/dist/esm/nodeviews/TableResizer.js +2 -1
  56. package/dist/esm/plugin.js +58 -57
  57. package/dist/esm/pm-plugins/keymap.js +26 -8
  58. package/dist/esm/pm-plugins/main.js +15 -4
  59. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
  60. package/dist/esm/ui/DragHandle/index.js +2 -2
  61. package/dist/esm/ui/DragPreview/index.js +2 -0
  62. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
  63. package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
  64. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
  65. package/dist/esm/ui/LayoutButton/index.js +2 -0
  66. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
  67. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
  68. package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
  69. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
  70. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
  71. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  72. package/dist/esm/ui/common-styles.js +4 -0
  73. package/dist/esm/ui/ui-styles.js +93 -37
  74. package/dist/types/commands/column-resize.d.ts +23 -4
  75. package/dist/types/commands/go-to-next-cell.d.ts +2 -1
  76. package/dist/types/commands-with-analytics.d.ts +2 -1
  77. package/dist/types/pm-plugins/keymap.d.ts +3 -1
  78. package/dist/types/types.d.ts +7 -0
  79. package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
  80. package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
  81. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
  82. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
  83. package/dist/types-ts4.5/types.d.ts +7 -0
  84. package/package.json +4 -4
  85. package/src/commands/column-resize.ts +105 -29
  86. package/src/commands/go-to-next-cell.ts +10 -2
  87. package/src/commands-with-analytics.ts +11 -5
  88. package/src/nodeviews/ExternalDropTargets.tsx +2 -0
  89. package/src/nodeviews/TableComponent.tsx +14 -16
  90. package/src/nodeviews/TableResizer.tsx +2 -1
  91. package/src/plugin.tsx +3 -1
  92. package/src/pm-plugins/keymap.ts +44 -6
  93. package/src/pm-plugins/main.ts +18 -4
  94. package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
  95. package/src/types.ts +8 -0
  96. package/src/ui/DragHandle/index.tsx +2 -2
  97. package/src/ui/DragPreview/index.tsx +2 -0
  98. package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
  99. package/src/ui/FloatingDeleteButton/index.tsx +2 -0
  100. package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
  101. package/src/ui/LayoutButton/index.tsx +2 -0
  102. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
  103. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
  104. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
  105. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
  106. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
  107. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
  108. package/src/ui/common-styles.ts +2 -0
  109. package/src/ui/ui-styles.ts +90 -79
@@ -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
  }
@@ -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,
@@ -26,7 +26,7 @@ const handles = {
26
26
  };
27
27
  const handleStyles = {
28
28
  right: {
29
- // eslint-disable-next-line
29
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
30
30
  right: '-14px',
31
31
  marginTop: "var(--ds-space-150, 12px)"
32
32
  }
@@ -289,6 +289,7 @@ export const TableResizer = ({
289
289
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
290
290
  return;
291
291
  }
292
+ setLocalTableWidth(newWidth);
292
293
  handleResizeStop({
293
294
  width: width,
294
295
  x: 0,
@@ -169,13 +169,15 @@ const tablesPlugin = ({
169
169
  // plugin as it is currently swallowing backspace events inside tables
170
170
  {
171
171
  name: 'tableKeymap',
172
- plugin: () => {
172
+ plugin: ({
173
+ getIntl
174
+ }) => {
173
175
  const {
174
176
  dragAndDropEnabled,
175
177
  isTableScalingEnabled = false,
176
178
  fullWidthEnabled = false
177
179
  } = options || {};
178
- return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled);
180
+ return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, fullWidthEnabled, api, getIntl);
179
181
  }
180
182
  }, {
181
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
  }
@@ -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
  },
@@ -25,7 +25,9 @@ export const DragPreview = ({
25
25
  }, /*#__PURE__*/React.createElement(DragInMotionIcon, {
26
26
  style: {
27
27
  position: 'absolute',
28
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
28
29
  marginLeft: `${marginLeft}px`,
30
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
29
31
  marginTop: `${marginTop}px`,
30
32
  transform: transform
31
33
  }
@@ -94,25 +94,29 @@ export const FixedButton = ({
94
94
  ref: observerTargetRef,
95
95
  style: {
96
96
  position: 'absolute',
97
- top: '0px',
98
- left: '0px',
99
- width: `${BUTTON_WIDTH}px`,
100
- height: `${BUTTON_WIDTH}px`
97
+ top: "var(--ds-space-0, 0px)",
98
+ left: "var(--ds-space-0, 0px)",
99
+ width: "var(--ds-space-250, 20px)",
100
+ // BUTTON_WIDTH
101
+ height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
101
102
  }
102
103
  }, /*#__PURE__*/React.createElement("div", {
103
104
  ref: fixedButtonRef,
104
105
  style: {
105
106
  position: 'fixed',
107
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
106
108
  top: stickyHeader.top + stickyHeader.padding + offset * 2,
107
109
  zIndex: akEditorTableCellOnStickyHeaderZIndex,
110
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
108
111
  left: calcLeftPos({
109
112
  buttonWidth: BUTTON_WIDTH,
110
113
  cellRectLeft: targetCellRect.left,
111
114
  cellRefWidth: targetCellRef.clientWidth,
112
115
  offset
113
116
  }),
114
- width: `${BUTTON_WIDTH}px`,
115
- height: `${BUTTON_WIDTH}px`
117
+ width: "var(--ds-space-250, 20px)",
118
+ // BUTTON_WIDTH
119
+ height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
116
120
  },
117
121
  className: ClassName.CONTEXTUAL_MENU_BUTTON_FIXED
118
122
  }, children)), mountTo);
@@ -251,8 +251,10 @@ class FloatingDeleteButton extends Component {
251
251
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
252
252
  style: {
253
253
  position: 'fixed',
254
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
254
255
  top: pos.top,
255
256
  zIndex: stickyRowZIndex,
257
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
256
258
  left: rect.left + (pos.left || 0) - (this.state.selectionType === 'column' ? this.state.scrollLeft : 0) - (this.props.isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0)
257
259
  }
258
260
  }, button), mountTo);
@@ -90,6 +90,7 @@ export const InsertButtonForDragAndDrop = ({
90
90
  left: "var(--ds-space-150, 12px)"
91
91
  } : {
92
92
  height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
93
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
93
94
  top: '-3px'
94
95
  }
95
96
  })));
@@ -97,7 +97,9 @@ class LayoutButton extends React.Component {
97
97
  "aria-label": title,
98
98
  style: {
99
99
  position: 'fixed',
100
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
100
101
  top: pos.top + 22,
102
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
101
103
  left: tablePos.right
102
104
  }
103
105
  }, button);
@@ -187,7 +187,9 @@ export const ColumnControls = ({
187
187
  "data-testid": "table-floating-column-controls",
188
188
  style: {
189
189
  gridTemplateColumns: widths,
190
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
190
191
  marginTop,
192
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
191
193
  width: stickyTop ? containerWidth : undefined,
192
194
  overflowX: stickyTop ? 'hidden' : 'visible',
193
195
  pointerEvents: isDragging ? 'none' : undefined
@@ -74,8 +74,11 @@ export const ColumnDropTarget = ({
74
74
  return /*#__PURE__*/React.createElement("div", {
75
75
  ref: dropTargetRef,
76
76
  style: {
77
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
77
78
  width: width && `${width - 1}px`,
79
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
78
80
  height: height && `${height}px`,
81
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
79
82
  marginTop: marginTop && `${marginTop}px`,
80
83
  pointerEvents: 'auto',
81
84
  flexShrink: 0
@@ -67,6 +67,7 @@ class CornerControlComponent extends Component {
67
67
  sticky: this.props.stickyTop !== undefined
68
68
  }),
69
69
  style: {
70
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
70
71
  top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
71
72
  },
72
73
  contentEditable: false
@@ -93,6 +93,7 @@ export default class NumberColumn extends Component {
93
93
  return /*#__PURE__*/React.createElement("div", {
94
94
  className: ClassName.NUMBERED_COLUMN,
95
95
  style: {
96
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
96
97
  marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
97
98
  borderLeft: isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined
98
99
  },
@@ -58,9 +58,13 @@ class RowControlsComponent extends Component {
58
58
  className: `${ClassName.ROW_CONTROLS_BUTTON_WRAP} ${getRowClassNames(startIndex, selectionState || selection, hoveredRows, isInDanger, isResizing)} ${thisRowSticky ? 'sticky' : ''}`,
59
59
  key: startIndex,
60
60
  style: {
61
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
61
62
  height: height,
63
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
62
64
  marginTop: `${marginTop}px`,
65
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
63
66
  top: thisRowSticky ? `${this.props.stickyTop + 3}px` : undefined,
67
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
64
68
  paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
65
69
  }
66
70
  }, /*#__PURE__*/React.createElement("button", {
@@ -127,6 +127,7 @@ const DragControlsComponent = ({
127
127
  width: '9px',
128
128
  height: '100%',
129
129
  position: 'relative',
130
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
130
131
  right: '-0.5px'
131
132
  },
132
133
  "data-testid": `table-floating-row-${isHover ? rowIndex : selectedRowIndexes[0]}-drag-handle`
@@ -171,7 +172,8 @@ const DragControlsComponent = ({
171
172
  style: {
172
173
  gridTemplateRows: heights,
173
174
  gridTemplateColumns: isDragging ? `${dropTargetExtendedWidth}px 14px ${tableWidth}px` : '0px 14px 0px',
174
- left: isDragging ? `-${dropTargetExtendedWidth + 2}px` : `-2px`
175
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
176
+ left: isDragging ? `-${dropTargetExtendedWidth + 2}px` : "var(--ds-space-negative-025, -2px)"
175
177
  },
176
178
  onMouseMove: handleMouseMove,
177
179
  contentEditable: false
@@ -130,6 +130,8 @@ const tableBorderStyles = () => {
130
130
  return `border: 1px solid ${tableBorderDeleteColor}`;
131
131
  }
132
132
  };
133
+
134
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
133
135
  const tableStickyHeaderColumnControlsDecorationsStyle = () => {
134
136
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
135
137
  return css`
@@ -1012,6 +1014,8 @@ export const tableStyles = props => css`
1012
1014
 
1013
1015
  ${shadowSentinelStyles}
1014
1016
  `;
1017
+
1018
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
1015
1019
  export const tableFullPageEditorStyles = css`
1016
1020
  .ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
1017
1021
  margin-left: 0;