@atlaskit/editor-plugin-table 7.2.2 → 7.3.0

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 (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/commands/column-resize.js +115 -45
  3. package/dist/cjs/commands/go-to-next-cell.js +7 -11
  4. package/dist/cjs/commands/misc.js +3 -2
  5. package/dist/cjs/commands/selection.js +3 -3
  6. package/dist/cjs/event-handlers.js +38 -25
  7. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
  8. package/dist/cjs/pm-plugins/keymap.js +1 -0
  9. package/dist/cjs/pm-plugins/main.js +43 -9
  10. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
  11. package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
  12. package/dist/cjs/reducer.js +5 -2
  13. package/dist/cjs/utils/drag-menu.js +37 -23
  14. package/dist/cjs/utils/merged-cells.js +66 -1
  15. package/dist/es2019/commands/column-resize.js +100 -35
  16. package/dist/es2019/commands/go-to-next-cell.js +7 -9
  17. package/dist/es2019/commands/misc.js +3 -2
  18. package/dist/es2019/commands/selection.js +5 -5
  19. package/dist/es2019/event-handlers.js +17 -3
  20. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  21. package/dist/es2019/pm-plugins/keymap.js +3 -2
  22. package/dist/es2019/pm-plugins/main.js +41 -5
  23. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
  24. package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
  25. package/dist/es2019/reducer.js +5 -2
  26. package/dist/es2019/utils/drag-menu.js +38 -14
  27. package/dist/es2019/utils/merged-cells.js +73 -0
  28. package/dist/esm/commands/column-resize.js +105 -35
  29. package/dist/esm/commands/go-to-next-cell.js +7 -11
  30. package/dist/esm/commands/misc.js +3 -2
  31. package/dist/esm/commands/selection.js +5 -5
  32. package/dist/esm/event-handlers.js +38 -25
  33. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
  34. package/dist/esm/pm-plugins/keymap.js +3 -2
  35. package/dist/esm/pm-plugins/main.js +38 -4
  36. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
  37. package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
  38. package/dist/esm/reducer.js +5 -2
  39. package/dist/esm/utils/drag-menu.js +36 -22
  40. package/dist/esm/utils/merged-cells.js +65 -0
  41. package/dist/types/commands/column-resize.d.ts +2 -0
  42. package/dist/types/commands/misc.d.ts +1 -1
  43. package/dist/types/types.d.ts +16 -0
  44. package/dist/types/utils/drag-menu.d.ts +4 -1
  45. package/dist/types/utils/merged-cells.d.ts +2 -0
  46. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
  47. package/dist/types-ts4.5/commands/misc.d.ts +1 -1
  48. package/dist/types-ts4.5/types.d.ts +16 -0
  49. package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
  50. package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
  51. package/package.json +10 -17
  52. package/src/commands/column-resize.ts +155 -40
  53. package/src/commands/go-to-next-cell.ts +6 -15
  54. package/src/commands/misc.ts +2 -0
  55. package/src/commands/selection.ts +5 -5
  56. package/src/event-handlers.ts +21 -4
  57. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
  58. package/src/pm-plugins/keymap.ts +3 -0
  59. package/src/pm-plugins/main.ts +47 -2
  60. package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
  61. package/src/pm-plugins/table-resizing/plugin.ts +18 -1
  62. package/src/reducer.ts +5 -2
  63. package/src/types.ts +16 -0
  64. package/src/utils/drag-menu.ts +94 -20
  65. package/src/utils/merged-cells.ts +78 -0
  66. package/tsconfig.dev.json +0 -69
  67. package/tsconfig.json +2 -877
  68. package/examples/99-testing.tsx +0 -140
  69. package/examples/config.jsonc +0 -14
  70. package/src/__tests__/unit/analytics.ts +0 -888
  71. package/src/__tests__/unit/collab.ts +0 -93
  72. package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
  73. package/src/__tests__/unit/commands/insert.ts +0 -137
  74. package/src/__tests__/unit/commands/misc.ts +0 -185
  75. package/src/__tests__/unit/commands/sort.ts +0 -128
  76. package/src/__tests__/unit/commands.ts +0 -745
  77. package/src/__tests__/unit/copy-button.ts +0 -22
  78. package/src/__tests__/unit/copy-paste.ts +0 -677
  79. package/src/__tests__/unit/event-handlers/index.ts +0 -125
  80. package/src/__tests__/unit/event-handlers.ts +0 -296
  81. package/src/__tests__/unit/fix-tables.ts +0 -164
  82. package/src/__tests__/unit/get-toolbar-config.ts +0 -127
  83. package/src/__tests__/unit/handlers.ts +0 -98
  84. package/src/__tests__/unit/hover-selection.ts +0 -230
  85. package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
  86. package/src/__tests__/unit/index.ts +0 -912
  87. package/src/__tests__/unit/layout.ts +0 -146
  88. package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
  89. package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
  90. package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
  91. package/src/__tests__/unit/nodeviews/cell.ts +0 -132
  92. package/src/__tests__/unit/nodeviews/table.ts +0 -129
  93. package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
  94. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
  95. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
  96. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
  97. package/src/__tests__/unit/pm-plugins/main.ts +0 -214
  98. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
  99. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
  100. package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
  101. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
  102. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
  103. package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
  104. package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
  105. package/src/__tests__/unit/sort-column.ts +0 -399
  106. package/src/__tests__/unit/toolbar.ts +0 -512
  107. package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
  108. package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
  109. package/src/__tests__/unit/transforms/merging.ts +0 -392
  110. package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
  111. package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
  112. package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
  113. package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
  114. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
  115. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
  116. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
  117. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
  118. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
  119. package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
  120. package/src/__tests__/unit/ui/RowControls.tsx +0 -294
  121. package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
  122. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
  123. package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
  124. package/src/__tests__/unit/undo-redo.ts +0 -220
  125. package/src/__tests__/unit/utils/analytics.ts +0 -98
  126. package/src/__tests__/unit/utils/collapse.ts +0 -57
  127. package/src/__tests__/unit/utils/column-controls.ts +0 -205
  128. package/src/__tests__/unit/utils/dom.ts +0 -180
  129. package/src/__tests__/unit/utils/merged-cells.ts +0 -156
  130. package/src/__tests__/unit/utils/nodes.ts +0 -79
  131. package/src/__tests__/unit/utils/row-controls.ts +0 -195
  132. package/src/__tests__/unit/utils/table.ts +0 -96
  133. package/src/__tests__/unit/utils.ts +0 -670
  134. package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
  135. package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
  136. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -3
  137. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -3
  138. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -3
  139. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -3
  140. package/src/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -3
  141. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -3
  142. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -3
  143. package/src/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -3
  144. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
  145. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
  146. package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
  147. package/src/__tests__/visual-regression/copy-button.ts +0 -181
  148. package/src/__tests__/visual-regression/index.ts +0 -62
  149. package/src/__tests__/visual-regression/sticky-header.ts +0 -61
@@ -2,24 +2,59 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { TableMap } from '@atlaskit/editor-tables';
3
3
  import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
4
4
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { getDecorations } from '../pm-plugins/decorations/plugin';
6
+ import { buildColumnResizingDecorations, clearColumnResizingDecorations } from '../pm-plugins/decorations/utils';
7
+ import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
5
8
  import { getPluginState as getTableResizingPluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
9
+ import { pluginKey as tableResizingPK } from '../pm-plugins/table-resizing/plugin-key';
6
10
  import { currentColWidth, getResizeState, getTableMaxWidth, resizeColumn, updateControls } from '../pm-plugins/table-resizing/utils';
7
11
  import { updateColumnWidths } from '../transforms';
8
- import { getSelectedColumnIndexes } from '../utils';
9
- import { addResizeHandleDecorations, showResizeHandleLine } from './index';
12
+ import { TableDecorations } from '../types';
13
+ import { createColumnLineResize, getSelectedColumnIndexes, updateDecorations } from '../utils';
14
+ const getTablePluginCommand = (actionPayload, originalTr) => {
15
+ return createCommand(() => actionPayload, tr => (originalTr || tr).setMeta('addToHistory', false));
16
+ };
10
17
  const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHandlePos) => (state, dispatch) => {
11
- addResizeHandleDecorations(rowIndex, columnIndex, true)(state, dispatch);
12
- // Currently only 'right' position is used in showResizeHandleLine
13
- showResizeHandleLine({
14
- left: 0,
18
+ let customTr = state.tr;
19
+ const {
20
+ pluginConfig: {
21
+ allowColumnResizing
22
+ },
23
+ getIntl
24
+ } = getPluginState(state);
25
+ const fakeDispatch = tr => {
26
+ customTr = tr;
27
+ };
28
+ if (!allowColumnResizing) {
29
+ return false;
30
+ }
31
+ const decorationsWithWidget = buildColumnResizingDecorations(rowIndex, columnIndex, true, getIntl)({
32
+ tr: customTr,
33
+ decorationSet: getDecorations(state)
34
+ });
35
+ const decorationsWithWidgetAndHandle = updateDecorations(customTr.doc, decorationsWithWidget, createColumnLineResize(state.selection, {
15
36
  right: columnIndex
16
- })(state, dispatch);
17
- tableResizingPluginCreateCommand({
37
+ }), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
38
+ getTablePluginCommand({
39
+ type: 'START_KEYBOARD_COLUMN_RESIZE',
40
+ data: {
41
+ resizeHandleRowIndex: rowIndex,
42
+ resizeHandleColumnIndex: columnIndex,
43
+ resizeHandleIncludeTooltip: true,
44
+ isKeyboardResize: true,
45
+ decorationSet: decorationsWithWidgetAndHandle
46
+ }
47
+ }, customTr)(state, fakeDispatch);
48
+ customTr.setMeta(tableResizingPK, {
18
49
  type: 'SET_RESIZE_HANDLE_POSITION',
19
50
  data: {
20
51
  resizeHandlePos: nextResizeHandlePos
21
52
  }
22
- })(state, dispatch);
53
+ });
54
+ if (dispatch) {
55
+ dispatch(customTr);
56
+ return true;
57
+ }
23
58
  return false;
24
59
  };
25
60
  export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
@@ -32,32 +67,19 @@ export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
32
67
  const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
33
68
  const cell = findCellClosestToPos(selection.$from);
34
69
  if (selectionRect && cell && view) {
35
- const cellAttrs = cell.node.attrs;
36
- const width = currentColWidth(view, cell.pos, cellAttrs);
37
- updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
38
- tableResizingPluginCreateCommand({
39
- type: 'SET_DRAGGING',
40
- data: {
41
- dragging: {
42
- startX: 0,
43
- startWidth: width
44
- }
45
- }
46
- })(state, dispatch);
47
- return true;
70
+ return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
48
71
  }
49
72
  return false;
50
73
  };
51
- export const activateNextResizeArea = direction => (state, dispatch) => {
74
+ export const activateNextResizeArea = direction => (state, dispatch, view) => {
52
75
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
53
76
  return false;
54
77
  }
55
78
  const {
56
- resizeHandlePos,
57
- dragging
79
+ resizeHandlePos
58
80
  } = getTableResizingPluginState(state) || {};
59
81
  // If No resizing has initiated, skip to regular handler
60
- if (!resizeHandlePos || !dragging) {
82
+ if (!resizeHandlePos) {
61
83
  return false;
62
84
  }
63
85
  const {
@@ -84,30 +106,34 @@ export const activateNextResizeArea = direction => (state, dispatch) => {
84
106
  // we are somewhere in between the side columns of the table
85
107
  const offset = $nextCell.pos - $nextCell.start(-1);
86
108
  const rectForNextCell = tableMap.findCell(offset);
87
- updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
109
+ return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
88
110
  } else {
89
111
  // current position is in the one of the side columns of the table(left or right)
90
112
  if (currentCellRect.left === 0) {
91
113
  const lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
92
114
  const $lastCell = state.doc.resolve(lastCellInCurrentRow);
93
- updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
115
+ return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
94
116
  } else if (tableMap.width === currentCellRect.right) {
95
117
  const firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
96
118
  const $nextCell = state.doc.resolve(firsCellInCurrentRow);
97
- updateResizeHandleAndStatePosition(currentCellRect.top, 1, $nextCell.pos)(state, dispatch);
119
+ return updateResizeHandleAndStatePosition(currentCellRect.top, 1, $nextCell.pos)(state, dispatch);
98
120
  }
99
121
  }
100
- return true;
122
+ return false;
101
123
  };
102
124
  export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (state, dispatch, view) => {
125
+ let customTr = state.tr;
126
+ const fakeDispatch = tr => {
127
+ customTr = tr;
128
+ };
103
129
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
104
130
  return false;
105
131
  }
106
132
  const {
107
- resizeHandlePos,
108
- dragging
133
+ resizeHandlePos
109
134
  } = getTableResizingPluginState(state);
110
- if (!view || !resizeHandlePos || !dragging) {
135
+ const cell = findCellClosestToPos(state.selection.$from);
136
+ if (!view || !resizeHandlePos || !cell) {
111
137
  return false;
112
138
  }
113
139
  const $cell = state.doc.resolve(resizeHandlePos);
@@ -120,6 +146,17 @@ export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (s
120
146
  if (dom && dom.nodeName !== 'TABLE') {
121
147
  dom = dom.closest('table');
122
148
  }
149
+ const cellAttrs = cell === null || cell === void 0 ? void 0 : cell.node.attrs;
150
+ const width = currentColWidth(view, cell === null || cell === void 0 ? void 0 : cell.pos, cellAttrs);
151
+ tableResizingPluginCreateCommand({
152
+ type: 'SET_DRAGGING',
153
+ data: {
154
+ dragging: {
155
+ startX: 0,
156
+ startWidth: width
157
+ }
158
+ }
159
+ })(state, fakeDispatch);
123
160
  const maxSize = getTableMaxWidth({
124
161
  table: originalTable,
125
162
  tableStart: tableStartPosition,
@@ -141,9 +178,37 @@ export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (s
141
178
  // only selected (or selected - 1) columns should be distributed
142
179
  const resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
143
180
  const newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
144
- const tr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(state.tr);
181
+ customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
145
182
  if (dispatch) {
146
- dispatch(tr);
183
+ dispatch(customTr);
147
184
  }
148
185
  return true;
186
+ };
187
+ export const stopKeyboardColumnResizing = originalTr => (state, dispatch) => {
188
+ if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
189
+ return false;
190
+ }
191
+ let customTr = originalTr || state.tr;
192
+ const fakeDispatch = tr => {
193
+ customTr = tr;
194
+ };
195
+ const decorationWithoutWidget = clearColumnResizingDecorations()({
196
+ tr: customTr,
197
+ decorationSet: getDecorations(state)
198
+ });
199
+ const decorationWithoutWidgetAndHandle = updateDecorations(customTr.doc, decorationWithoutWidget, [], TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
200
+ getTablePluginCommand({
201
+ type: 'STOP_KEYBOARD_COLUMN_RESIZE',
202
+ data: {
203
+ decorationSet: decorationWithoutWidgetAndHandle
204
+ }
205
+ }, customTr)(state, fakeDispatch);
206
+ tableResizingPluginCreateCommand({
207
+ type: 'STOP_RESIZING'
208
+ }, () => customTr.setMeta('scrollIntoView', false))(state, fakeDispatch);
209
+ if (dispatch) {
210
+ dispatch(customTr);
211
+ return true;
212
+ }
213
+ return false;
149
214
  };
@@ -6,23 +6,21 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { goToNextCell as baseGotoNextCell, findTable } from '@atlaskit/editor-tables/utils';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
8
  import { insertRowWithAnalytics } from '../commands-with-analytics';
9
- import { getPluginState as getResizePluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
10
- import { hideResizeHandleLine } from './hover';
9
+ import { getPluginState } from '../pm-plugins/plugin-factory';
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) => {
13
+ export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch, view) => {
14
14
  const table = findTable(state.selection);
15
15
  if (!table) {
16
16
  return false;
17
17
  }
18
18
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
19
- var _getResizePluginState;
20
- const isColumnResizing = !!((_getResizePluginState = getResizePluginState(state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
19
+ var _getPluginState;
20
+ const isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
21
21
  if (isColumnResizing) {
22
- tableResizingPluginCreateCommand({
23
- type: 'STOP_RESIZING'
24
- }, originalTr => (state.tr || originalTr).setMeta('scrollIntoView', false))(state, dispatch);
25
- hideResizeHandleLine()(state, dispatch);
22
+ stopKeyboardColumnResizing()(state, dispatch, view);
23
+ return true;
26
24
  }
27
25
  }
28
26
  const map = TableMap.get(table.node);
@@ -423,7 +423,7 @@ export const showInsertRowButton = rowIndex => createCommand(_ => rowIndex > -1
423
423
  export const hideInsertColumnOrRowButton = () => createCommand({
424
424
  type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON'
425
425
  }, tr => tr.setMeta('addToHistory', false));
426
- export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip) => createCommand(state => {
426
+ export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip, isKeyboardResize) => createCommand(state => {
427
427
  const tableNode = findTable(state.selection);
428
428
  const {
429
429
  pluginConfig: {
@@ -443,7 +443,8 @@ export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip
443
443
  }),
444
444
  resizeHandleRowIndex: rowIndex,
445
445
  resizeHandleColumnIndex: columnIndex,
446
- resizeHandleIncludeTooltip: includeTooltip
446
+ resizeHandleIncludeTooltip: includeTooltip,
447
+ isKeyboardResize: isKeyboardResize || false
447
448
  }
448
449
  };
449
450
  }, tr => tr.setMeta('addToHistory', false));
@@ -5,7 +5,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { findTable, isColumnSelected, isRowSelected, isTableSelected, selectedRect } from '@atlaskit/editor-tables/utils';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
  import { selectColumn, selectRow } from '../commands/misc';
8
- import { getPluginState as getResizePluginState } from '../pm-plugins/table-resizing/plugin-factory';
8
+ import { getPluginState } from '../pm-plugins/plugin-factory';
9
9
  import { getClosestSelectionRect } from '../toolbar';
10
10
  export let TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
11
11
  TableSelectionDirection["TopToBottom"] = "TopToBottom";
@@ -179,8 +179,8 @@ const arrowLeftFromText = editorSelectionAPI => selection => (state, dispatch) =
179
179
  } = selection;
180
180
  let isColumnResizing = false;
181
181
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
182
- const columResizePluginState = getResizePluginState(state) || {};
183
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
182
+ const columResizePluginState = getPluginState(state) || {};
183
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
184
184
  }
185
185
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
186
186
  // + 3 for: row, cell & paragraph nodes
@@ -211,8 +211,8 @@ const arrowRightFromText = editorSelectionAPI => selection => (state, dispatch)
211
211
  } = selection;
212
212
  let isColumnResizing = false;
213
213
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
214
- const columResizePluginState = getResizePluginState(state) || {};
215
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
214
+ const columResizePluginState = getPluginState(state) || {};
215
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
216
216
  }
217
217
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
218
218
  // + 3 for: row, cell & paragraph nodes
@@ -4,6 +4,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
8
9
  import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
9
10
  import { getPluginState } from './pm-plugins/plugin-factory';
@@ -164,7 +165,18 @@ export const handleMouseOut = (view, mouseEvent) => {
164
165
  state,
165
166
  dispatch
166
167
  } = view;
167
- return hideResizeHandleLine()(state, dispatch);
168
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
169
+ const {
170
+ isKeyboardResize
171
+ } = getPluginState(state);
172
+ if (isKeyboardResize) {
173
+ // no need to hide decoration if column resizing started by keyboard
174
+ return false;
175
+ }
176
+ return hideResizeHandleLine()(state, dispatch);
177
+ } else {
178
+ return hideResizeHandleLine()(state, dispatch);
179
+ }
168
180
  }
169
181
  return false;
170
182
  };
@@ -265,16 +277,18 @@ export const handleMouseMove = (view, event, elementContentRects) => {
265
277
  resizeHandleColumnIndex,
266
278
  resizeHandleRowIndex
267
279
  } = getPluginState(state);
280
+ const isKeyboardResize = getBooleanFF('platform.editor.a11y-column-resizing_emcvz') ? getPluginState(state).isKeyboardResize : false;
268
281
  const tableCell = closestElement(element, 'td, th');
269
282
  const cellStartPosition = view.posAtDOM(tableCell, 0);
270
283
  const rect = findCellRectClosestToPos(state.doc.resolve(cellStartPosition));
271
284
  if (rect) {
272
285
  const columnEndIndexTarget = positionColumn === 'left' ? rect.left : rect.right;
273
286
  const rowIndexTarget = rect.top;
274
- if (columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
287
+ if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
275
288
  target: element,
276
289
  columnEndIndexTarget
277
- })) {
290
+ })) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
291
+ ) {
278
292
  return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true)(state, dispatch);
279
293
  }
280
294
  }
@@ -1,8 +1,9 @@
1
1
  import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
2
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
3
  import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
4
- import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
4
+ import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo } from '../../utils';
5
5
  import { withEditorAnalyticsAPI } from '../../utils/analytics';
6
+ import { canMove, getTargetIndex } from '../../utils/drag-menu';
6
7
  import { clearDropTarget, moveSource } from './commands';
7
8
  export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, status, tr) => {
8
9
  return withEditorAnalyticsAPI(({
@@ -81,30 +82,13 @@ export const moveSourceWithAnalyticsViaShortcut = editorAnalyticsAPI => (sourceT
81
82
  if (selectedIndexes.length === 0) {
82
83
  return false;
83
84
  }
84
-
85
- // const sourceIndex = selectedIndexes[0];
86
- // we can move only by one row/column
87
- // 'direction' can only be 1 (for right or down) or -1 (for left or up)
88
- const targetIndex = Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
89
-
90
- // We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
91
85
  const {
92
86
  totalRowCount,
93
87
  totalColumnCount
94
88
  } = getSelectedTableInfo(selection);
95
- const isValidTargetIndex = targetIndex < 0 ? false : isRow ? targetIndex <= totalRowCount - 1 : targetIndex <= totalColumnCount - 1;
96
- if (!isValidTargetIndex) {
97
- return false;
98
- }
99
-
100
- // We can move only if there are no merged cells in the source or target row/column
101
- const hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
102
- if (hasMergedCellsInSource) {
103
- return false;
104
- }
105
- const hasMergedCellsInTarget = isRow ? hasMergedCellsInRow(targetIndex)(selection) : hasMergedCellsInColumn(targetIndex)(selection);
106
- if (hasMergedCellsInTarget) {
89
+ if (!canMove(sourceType, direction, isRow ? totalRowCount : totalColumnCount, selection, selectionRect)) {
107
90
  return false;
108
91
  }
92
+ const targetIndex = getTargetIndex(selectedIndexes, direction);
109
93
  return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, selectedIndexes, targetIndex)(state, dispatch);
110
94
  };
@@ -1,11 +1,11 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
2
+ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
6
  import { createTable, goToNextCell, moveCursorBackward } from '../commands';
7
7
  import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
8
- import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
8
+ import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
9
9
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
10
10
  import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
11
11
  import { withEditorAnalyticsAPI } from '../utils/analytics';
@@ -48,6 +48,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
48
48
  bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
49
49
  bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStep(-10, getEditorContainerWidth), list);
50
50
  bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStep(10, getEditorContainerWidth), list);
51
+ bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing(), list);
51
52
  }
52
53
  return keymap(list);
53
54
  }
@@ -4,7 +4,11 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension } from '@atlaskit/editor-common/transforms';
5
5
  import { browser, closestElement } from '@atlaskit/editor-common/utils';
6
6
  import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
+ import { TableMap } from '@atlaskit/editor-tables';
8
+ import { findTable } from '@atlaskit/editor-tables/utils';
9
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
10
  import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
11
+ import { stopKeyboardColumnResizing } from '../commands/column-resize';
8
12
  import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
9
13
  import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
10
14
  import { createTableView } from '../nodeviews/table';
@@ -91,7 +95,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
91
95
  const domAtPos = editorView.domAtPos.bind(editorView);
92
96
  editorViewRef = editorView;
93
97
  return {
94
- update: view => {
98
+ update: (view, prevState) => {
95
99
  const {
96
100
  state,
97
101
  dispatch
@@ -106,6 +110,28 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
106
110
  if (parent) {
107
111
  tableRef = parent.querySelector('table') || undefined;
108
112
  }
113
+ const tableNode = findTable(state.selection);
114
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
115
+ // when cursor leaves the table we need to stop column resizing
116
+ const pluginPrevState = getPluginState(prevState);
117
+ const isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
118
+ if (isStopKeyboardColumResizing) {
119
+ const isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
120
+ if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
121
+ const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
122
+ const newRowsNumber = TableMap.get(tableNode.node).height;
123
+ if (oldRowsNumber !== newRowsNumber ||
124
+ // Add/delete row
125
+ tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
126
+ // Jump to another table
127
+ stopKeyboardColumnResizing()(state, dispatch);
128
+ }
129
+ } else if (!tableNode) {
130
+ // selection outside of table
131
+ stopKeyboardColumnResizing()(state, dispatch);
132
+ }
133
+ }
134
+ }
109
135
  }
110
136
  if (pluginState.tableRef !== tableRef) {
111
137
  setTableRef(tableRef)(state, dispatch);
@@ -208,10 +234,20 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
208
234
  const maybeTr = closestElement(domRef, 'tr');
209
235
  return maybeTr ? maybeTr.classList.contains('sticky') : false;
210
236
  },
211
- handleTextInput: ({
212
- state,
213
- dispatch
214
- }, _from, _to, text) => {
237
+ handleTextInput: (view, _from, _to, text) => {
238
+ const {
239
+ state,
240
+ dispatch
241
+ } = view;
242
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
243
+ const {
244
+ isKeyboardResize
245
+ } = getPluginState(state);
246
+ if (isKeyboardResize) {
247
+ stopKeyboardColumnResizing()(state, dispatch);
248
+ return false;
249
+ }
250
+ }
215
251
  const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
216
252
  if (tr.selectionSet) {
217
253
  dispatch(tr);
@@ -5,9 +5,11 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { stopKeyboardColumnResizing } from '../../commands/column-resize';
8
9
  import { updateResizeHandleDecorations } from '../../commands/misc';
9
10
  import { updateColumnWidths } from '../../transforms';
10
11
  import { getSelectedColumnIndexes } from '../../utils';
12
+ import { getPluginState as getTablePluginState } from '../plugin-factory';
11
13
  import { META_KEYS } from '../table-analytics';
12
14
  import { evenColumns, setDragging, stopResizing } from './commands';
13
15
  import { getPluginState } from './plugin-factory';
@@ -22,6 +24,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
22
24
  if (editorDisabled || localResizeHandlePos === null || !pointsAtCell(state.doc.resolve(localResizeHandlePos))) {
23
25
  return false;
24
26
  }
27
+ const {
28
+ isKeyboardResize
29
+ } = getTablePluginState(state);
25
30
  event.preventDefault();
26
31
  const tr = view.state.tr;
27
32
  tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
@@ -96,6 +101,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
96
101
  dragging,
97
102
  resizeHandlePos
98
103
  } = getPluginState(state);
104
+ const {
105
+ isTableHovered
106
+ } = getTablePluginState(state);
99
107
  if (resizeHandlePos === null) {
100
108
  return stopResizing()(state, dispatch);
101
109
  }
@@ -108,9 +116,20 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
108
116
  const start = $cell.start(-1);
109
117
  const table = $cell.node(-1);
110
118
 
111
- // If we let go in the same place we started, dont need to do anything.
119
+ // If we let go in the same place we started, don't need to do anything.
112
120
  if (dragging && clientX === dragging.startX) {
113
- return stopResizing()(state, dispatch);
121
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
122
+ if (isKeyboardResize || !isTableHovered) {
123
+ /** if column resize had started via keyboard but continued by mouse
124
+ * or mouse pointer leaves the table but mouse button still pressed
125
+ */
126
+ return stopKeyboardColumnResizing()(state, dispatch, view);
127
+ } else {
128
+ return stopResizing()(state, dispatch);
129
+ }
130
+ } else {
131
+ return stopResizing()(state, dispatch);
132
+ }
114
133
  }
115
134
  let {
116
135
  tr
@@ -148,7 +167,18 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
148
167
  })(tr);
149
168
  }
150
169
  }
151
- return stopResizing(tr)(state, dispatch);
170
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
171
+ if (isKeyboardResize || !isTableHovered) {
172
+ /** if column resize had started via keyboard but continued by mouse
173
+ * or mouse pointer leaves the table but mouse button still pressed
174
+ */
175
+ return stopKeyboardColumnResizing(tr)(state, dispatch, view);
176
+ } else {
177
+ return stopResizing(tr)(state, dispatch);
178
+ }
179
+ } else {
180
+ return stopResizing(tr)(state, dispatch);
181
+ }
152
182
  }
153
183
  }
154
184
  function move(event) {
@@ -163,7 +193,10 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
163
193
  dragging,
164
194
  resizeHandlePos
165
195
  } = getPluginState(state);
166
- if (!which || !dragging || resizeHandlePos === null || !pointsAtCell(state.doc.resolve(resizeHandlePos))) {
196
+ const {
197
+ isTableHovered
198
+ } = getTablePluginState(state);
199
+ if (!which || !dragging || resizeHandlePos === null || !pointsAtCell(state.doc.resolve(resizeHandlePos)) || !isTableHovered && getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
167
200
  return finish(event);
168
201
  }
169
202
  const $cell = state.doc.resolve(resizeHandlePos);
@@ -1,6 +1,8 @@
1
1
  import classnames from 'classnames';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { TableCssClassName as ClassName } from '../../types';
5
+ import { getPluginState as getTablePluginState } from '../plugin-factory';
4
6
  import { setResizeHandlePos } from './commands';
5
7
  import { handleMouseDown } from './event-handlers';
6
8
  import { createPluginState, getPluginState } from './plugin-factory';
@@ -38,7 +40,20 @@ export function createPlugin(dispatch, {
38
40
  const {
39
41
  dragging
40
42
  } = getPluginState(state);
41
- if (resizeHandlePos !== null && !dragging) {
43
+ let isColumnKeyboardResizeStarted = false;
44
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
45
+ /*
46
+ We need to start listening mouse events if column resize started from keyboard.
47
+ This will allow continue resizing via mouse
48
+ */
49
+ const {
50
+ isKeyboardResize
51
+ } = getTablePluginState(state);
52
+ if (isKeyboardResize) {
53
+ isColumnKeyboardResizeStarted = isKeyboardResize;
54
+ }
55
+ }
56
+ if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
42
57
  if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI)) {
43
58
  const {
44
59
  state,
@@ -75,8 +75,9 @@ export default ((pluginState, action) => {
75
75
  resizeHandleColumnIndex: undefined,
76
76
  resizeHandleRowIndex: undefined
77
77
  };
78
+ case 'START_KEYBOARD_COLUMN_RESIZE':
78
79
  case 'ADD_RESIZE_HANDLE_DECORATIONS':
79
- if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip) {
80
+ if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip && action.data.isKeyboardResize === pluginState.isKeyboardResize) {
80
81
  return pluginState;
81
82
  }
82
83
  return {
@@ -99,6 +100,7 @@ export default ((pluginState, action) => {
99
100
  resizeHandleRowIndex: resizeHandleRowIndex !== null && resizeHandleRowIndex !== void 0 ? resizeHandleRowIndex : pluginState.resizeHandleRowIndex,
100
101
  resizeHandleIncludeTooltip: resizeHandleIncludeTooltip !== null && resizeHandleIncludeTooltip !== void 0 ? resizeHandleIncludeTooltip : pluginState.resizeHandleIncludeTooltip
101
102
  };
103
+ case 'STOP_KEYBOARD_COLUMN_RESIZE':
102
104
  case 'REMOVE_RESIZE_HANDLE_DECORATIONS':
103
105
  if (!pluginState.isResizeHandleWidgetAdded) {
104
106
  return pluginState;
@@ -108,7 +110,8 @@ export default ((pluginState, action) => {
108
110
  ...action.data,
109
111
  resizeHandleColumnIndex: undefined,
110
112
  resizeHandleRowIndex: undefined,
111
- isResizeHandleWidgetAdded: false
113
+ isResizeHandleWidgetAdded: false,
114
+ isKeyboardResize: undefined
112
115
  };
113
116
  case 'SET_TABLE_REF':
114
117
  case 'HOVER_ROWS':