@atlaskit/editor-plugin-table 7.2.3 → 7.3.1

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 (135) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/commands/column-resize.js +115 -45
  4. package/dist/cjs/commands/go-to-next-cell.js +7 -11
  5. package/dist/cjs/commands/misc.js +7 -4
  6. package/dist/cjs/commands/selection.js +7 -5
  7. package/dist/cjs/event-handlers.js +38 -25
  8. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -1
  9. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +33 -1
  10. package/dist/cjs/pm-plugins/drag-and-drop/reducer.js +2 -1
  11. package/dist/cjs/pm-plugins/keymap.js +1 -0
  12. package/dist/cjs/pm-plugins/main.js +43 -9
  13. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
  14. package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
  15. package/dist/cjs/pm-plugins/table-selection-keymap.js +2 -2
  16. package/dist/cjs/reducer.js +5 -2
  17. package/dist/cjs/ui/DragHandle/HandleIconComponent.js +1 -3
  18. package/dist/cjs/ui/DragHandle/index.js +22 -10
  19. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +75 -33
  20. package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +123 -0
  21. package/dist/cjs/ui/FloatingDragMenu/index.js +2 -2
  22. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
  23. package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
  24. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
  25. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
  26. package/dist/cjs/ui/common-styles.js +1 -1
  27. package/dist/cjs/ui/consts.js +3 -2
  28. package/dist/es2019/commands/column-resize.js +100 -35
  29. package/dist/es2019/commands/go-to-next-cell.js +7 -9
  30. package/dist/es2019/commands/misc.js +7 -6
  31. package/dist/es2019/commands/selection.js +9 -9
  32. package/dist/es2019/event-handlers.js +17 -3
  33. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
  34. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +34 -1
  35. package/dist/es2019/pm-plugins/drag-and-drop/reducer.js +2 -1
  36. package/dist/es2019/pm-plugins/keymap.js +3 -2
  37. package/dist/es2019/pm-plugins/main.js +41 -5
  38. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
  39. package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
  40. package/dist/es2019/pm-plugins/table-selection-keymap.js +2 -2
  41. package/dist/es2019/reducer.js +5 -2
  42. package/dist/es2019/ui/DragHandle/HandleIconComponent.js +1 -3
  43. package/dist/es2019/ui/DragHandle/index.js +25 -10
  44. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +72 -32
  45. package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +109 -0
  46. package/dist/es2019/ui/FloatingDragMenu/index.js +2 -2
  47. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
  48. package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
  49. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
  50. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
  51. package/dist/es2019/ui/common-styles.js +11 -1
  52. package/dist/es2019/ui/consts.js +2 -1
  53. package/dist/esm/commands/column-resize.js +105 -35
  54. package/dist/esm/commands/go-to-next-cell.js +7 -11
  55. package/dist/esm/commands/misc.js +7 -4
  56. package/dist/esm/commands/selection.js +9 -7
  57. package/dist/esm/event-handlers.js +38 -25
  58. package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -2
  59. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +33 -1
  60. package/dist/esm/pm-plugins/drag-and-drop/reducer.js +2 -1
  61. package/dist/esm/pm-plugins/keymap.js +3 -2
  62. package/dist/esm/pm-plugins/main.js +38 -4
  63. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
  64. package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
  65. package/dist/esm/pm-plugins/table-selection-keymap.js +2 -2
  66. package/dist/esm/reducer.js +5 -2
  67. package/dist/esm/ui/DragHandle/HandleIconComponent.js +1 -3
  68. package/dist/esm/ui/DragHandle/index.js +21 -9
  69. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +74 -35
  70. package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +116 -0
  71. package/dist/esm/ui/FloatingDragMenu/index.js +2 -2
  72. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
  73. package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
  74. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
  75. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
  76. package/dist/esm/ui/common-styles.js +1 -1
  77. package/dist/esm/ui/consts.js +2 -1
  78. package/dist/types/commands/column-resize.d.ts +2 -0
  79. package/dist/types/commands/misc.d.ts +3 -3
  80. package/dist/types/commands/selection.d.ts +2 -2
  81. package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +1 -0
  82. package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +2 -1
  83. package/dist/types/pm-plugins/drag-and-drop/types.d.ts +2 -0
  84. package/dist/types/types.d.ts +16 -0
  85. package/dist/types/ui/DragHandle/HandleIconComponent.d.ts +1 -2
  86. package/dist/types/ui/DragHandle/index.d.ts +3 -2
  87. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +7 -8
  88. package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +30 -0
  89. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  90. package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
  91. package/dist/types/ui/consts.d.ts +1 -0
  92. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
  93. package/dist/types-ts4.5/commands/misc.d.ts +3 -3
  94. package/dist/types-ts4.5/commands/selection.d.ts +2 -2
  95. package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +1 -0
  96. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +2 -1
  97. package/dist/types-ts4.5/pm-plugins/drag-and-drop/types.d.ts +2 -0
  98. package/dist/types-ts4.5/types.d.ts +16 -0
  99. package/dist/types-ts4.5/ui/DragHandle/HandleIconComponent.d.ts +1 -2
  100. package/dist/types-ts4.5/ui/DragHandle/index.d.ts +3 -2
  101. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +7 -8
  102. package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +30 -0
  103. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  104. package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
  105. package/dist/types-ts4.5/ui/consts.d.ts +1 -0
  106. package/package.json +4 -3
  107. package/src/commands/column-resize.ts +155 -40
  108. package/src/commands/go-to-next-cell.ts +6 -15
  109. package/src/commands/misc.ts +19 -4
  110. package/src/commands/selection.ts +17 -9
  111. package/src/event-handlers.ts +21 -4
  112. package/src/pm-plugins/drag-and-drop/actions.ts +1 -0
  113. package/src/pm-plugins/drag-and-drop/commands.ts +3 -0
  114. package/src/pm-plugins/drag-and-drop/plugin.ts +47 -0
  115. package/src/pm-plugins/drag-and-drop/reducer.ts +1 -0
  116. package/src/pm-plugins/drag-and-drop/types.ts +3 -0
  117. package/src/pm-plugins/keymap.ts +3 -0
  118. package/src/pm-plugins/main.ts +47 -2
  119. package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
  120. package/src/pm-plugins/table-resizing/plugin.ts +18 -1
  121. package/src/pm-plugins/table-selection-keymap.ts +2 -2
  122. package/src/reducer.ts +5 -2
  123. package/src/types.ts +16 -0
  124. package/src/ui/DragHandle/HandleIconComponent.tsx +2 -9
  125. package/src/ui/DragHandle/index.tsx +37 -16
  126. package/src/ui/FloatingDragMenu/DragMenu.tsx +362 -310
  127. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +150 -0
  128. package/src/ui/FloatingDragMenu/index.tsx +3 -3
  129. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +72 -91
  130. package/src/ui/TableFloatingColumnControls/index.tsx +1 -2
  131. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +5 -0
  132. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +89 -104
  133. package/src/ui/common-styles.ts +11 -1
  134. package/src/ui/consts.ts +1 -0
  135. package/tsconfig.app.json +3 -0
@@ -68,4 +68,5 @@ export const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
68
68
  export const TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
69
69
  export const dragMenuDropdownWidth = 250;
70
70
  export const dragTableInsertColumnButtonSize = 16;
71
- export const dropTargetExtendedWidth = 150;
71
+ export const dropTargetExtendedWidth = 150;
72
+ export const colorPalletteColumns = 7;
@@ -2,25 +2,61 @@ 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
+ var getTablePluginCommand = function getTablePluginCommand(actionPayload, originalTr) {
15
+ return createCommand(function () {
16
+ return actionPayload;
17
+ }, function (tr) {
18
+ return (originalTr || tr).setMeta('addToHistory', false);
19
+ });
20
+ };
10
21
  var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
11
22
  return function (state, dispatch) {
12
- addResizeHandleDecorations(rowIndex, columnIndex, true)(state, dispatch);
13
- // Currently only 'right' position is used in showResizeHandleLine
14
- showResizeHandleLine({
15
- left: 0,
23
+ var customTr = state.tr;
24
+ var _getPluginState = getPluginState(state),
25
+ allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
26
+ getIntl = _getPluginState.getIntl;
27
+ var fakeDispatch = function fakeDispatch(tr) {
28
+ customTr = tr;
29
+ };
30
+ if (!allowColumnResizing) {
31
+ return false;
32
+ }
33
+ var decorationsWithWidget = buildColumnResizingDecorations(rowIndex, columnIndex, true, getIntl)({
34
+ tr: customTr,
35
+ decorationSet: getDecorations(state)
36
+ });
37
+ var decorationsWithWidgetAndHandle = updateDecorations(customTr.doc, decorationsWithWidget, createColumnLineResize(state.selection, {
16
38
  right: columnIndex
17
- })(state, dispatch);
18
- tableResizingPluginCreateCommand({
39
+ }), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
40
+ getTablePluginCommand({
41
+ type: 'START_KEYBOARD_COLUMN_RESIZE',
42
+ data: {
43
+ resizeHandleRowIndex: rowIndex,
44
+ resizeHandleColumnIndex: columnIndex,
45
+ resizeHandleIncludeTooltip: true,
46
+ isKeyboardResize: true,
47
+ decorationSet: decorationsWithWidgetAndHandle
48
+ }
49
+ }, customTr)(state, fakeDispatch);
50
+ customTr.setMeta(tableResizingPK, {
19
51
  type: 'SET_RESIZE_HANDLE_POSITION',
20
52
  data: {
21
53
  resizeHandlePos: nextResizeHandlePos
22
54
  }
23
- })(state, dispatch);
55
+ });
56
+ if (dispatch) {
57
+ dispatch(customTr);
58
+ return true;
59
+ }
24
60
  return false;
25
61
  };
26
62
  };
@@ -32,32 +68,19 @@ export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResiz
32
68
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
33
69
  var cell = findCellClosestToPos(selection.$from);
34
70
  if (selectionRect && cell && view) {
35
- var cellAttrs = cell.node.attrs;
36
- var 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;
71
+ return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
48
72
  }
49
73
  return false;
50
74
  };
51
75
  export var activateNextResizeArea = function activateNextResizeArea(direction) {
52
- return function (state, dispatch) {
76
+ return function (state, dispatch, view) {
53
77
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
54
78
  return false;
55
79
  }
56
80
  var _ref = getTableResizingPluginState(state) || {},
57
- resizeHandlePos = _ref.resizeHandlePos,
58
- dragging = _ref.dragging;
81
+ resizeHandlePos = _ref.resizeHandlePos;
59
82
  // If No resizing has initiated, skip to regular handler
60
- if (!resizeHandlePos || !dragging) {
83
+ if (!resizeHandlePos) {
61
84
  return false;
62
85
  }
63
86
  var selection = state.selection;
@@ -82,31 +105,35 @@ export var activateNextResizeArea = function activateNextResizeArea(direction) {
82
105
  // we are somewhere in between the side columns of the table
83
106
  var offset = $nextCell.pos - $nextCell.start(-1);
84
107
  var rectForNextCell = tableMap.findCell(offset);
85
- updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
108
+ return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
86
109
  } else {
87
110
  // current position is in the one of the side columns of the table(left or right)
88
111
  if (currentCellRect.left === 0) {
89
112
  var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
90
113
  var $lastCell = state.doc.resolve(lastCellInCurrentRow);
91
- updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
114
+ return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
92
115
  } else if (tableMap.width === currentCellRect.right) {
93
116
  var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
94
117
  var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
95
- updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
118
+ return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
96
119
  }
97
120
  }
98
- return true;
121
+ return false;
99
122
  };
100
123
  };
101
124
  export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize, getEditorContainerWidth) {
102
125
  return function (state, dispatch, view) {
126
+ var customTr = state.tr;
127
+ var fakeDispatch = function fakeDispatch(tr) {
128
+ customTr = tr;
129
+ };
103
130
  if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
104
131
  return false;
105
132
  }
106
133
  var _getTableResizingPlug = getTableResizingPluginState(state),
107
- resizeHandlePos = _getTableResizingPlug.resizeHandlePos,
108
- dragging = _getTableResizingPlug.dragging;
109
- if (!view || !resizeHandlePos || !dragging) {
134
+ resizeHandlePos = _getTableResizingPlug.resizeHandlePos;
135
+ var cell = findCellClosestToPos(state.selection.$from);
136
+ if (!view || !resizeHandlePos || !cell) {
110
137
  return false;
111
138
  }
112
139
  var $cell = state.doc.resolve(resizeHandlePos);
@@ -119,6 +146,17 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize,
119
146
  if (dom && dom.nodeName !== 'TABLE') {
120
147
  dom = dom.closest('table');
121
148
  }
149
+ var cellAttrs = cell === null || cell === void 0 ? void 0 : cell.node.attrs;
150
+ var 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);
122
160
  var maxSize = getTableMaxWidth({
123
161
  table: originalTable,
124
162
  tableStart: tableStartPosition,
@@ -140,10 +178,42 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(stepSize,
140
178
  // only selected (or selected - 1) columns should be distributed
141
179
  var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
142
180
  var newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
143
- var tr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(state.tr);
181
+ customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
144
182
  if (dispatch) {
145
- dispatch(tr);
183
+ dispatch(customTr);
146
184
  }
147
185
  return true;
148
186
  };
187
+ };
188
+ export var stopKeyboardColumnResizing = function stopKeyboardColumnResizing(originalTr) {
189
+ return function (state, dispatch) {
190
+ if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
191
+ return false;
192
+ }
193
+ var customTr = originalTr || state.tr;
194
+ var fakeDispatch = function fakeDispatch(tr) {
195
+ customTr = tr;
196
+ };
197
+ var decorationWithoutWidget = clearColumnResizingDecorations()({
198
+ tr: customTr,
199
+ decorationSet: getDecorations(state)
200
+ });
201
+ var decorationWithoutWidgetAndHandle = updateDecorations(customTr.doc, decorationWithoutWidget, [], TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
202
+ getTablePluginCommand({
203
+ type: 'STOP_KEYBOARD_COLUMN_RESIZE',
204
+ data: {
205
+ decorationSet: decorationWithoutWidgetAndHandle
206
+ }
207
+ }, customTr)(state, fakeDispatch);
208
+ tableResizingPluginCreateCommand({
209
+ type: 'STOP_RESIZING'
210
+ }, function () {
211
+ return customTr.setMeta('scrollIntoView', false);
212
+ })(state, fakeDispatch);
213
+ if (dispatch) {
214
+ dispatch(customTr);
215
+ return true;
216
+ }
217
+ return false;
218
+ };
149
219
  };
@@ -6,27 +6,23 @@ 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
  var TAB_FORWARD_DIRECTION = 1;
12
12
  var TAB_BACKWARD_DIRECTION = -1;
13
13
  export var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
14
14
  return function (direction) {
15
- return function (state, dispatch) {
15
+ return function (state, dispatch, view) {
16
16
  var table = findTable(state.selection);
17
17
  if (!table) {
18
18
  return false;
19
19
  }
20
20
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
21
- var _getResizePluginState;
22
- var isColumnResizing = !!((_getResizePluginState = getResizePluginState(state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
21
+ var _getPluginState;
22
+ var isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
23
23
  if (isColumnResizing) {
24
- tableResizingPluginCreateCommand({
25
- type: 'STOP_RESIZING'
26
- }, function (originalTr) {
27
- return (state.tr || originalTr).setMeta('scrollIntoView', false);
28
- })(state, dispatch);
29
- hideResizeHandleLine()(state, dispatch);
24
+ stopKeyboardColumnResizing()(state, dispatch, view);
25
+ return true;
30
26
  }
31
27
  }
32
28
  var map = TableMap.get(table.node);
@@ -321,6 +321,7 @@ export var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, targetCel
321
321
  };
322
322
  };
323
323
  export var selectColumn = function selectColumn(column, expand) {
324
+ var triggeredByKeyboard = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
324
325
  return createCommand(function (state) {
325
326
  var cells = getCellsInColumn(column)(state.tr.selection);
326
327
  if (!cells || !cells.length || typeof cells[0].pos !== 'number') {
@@ -337,7 +338,7 @@ export var selectColumn = function selectColumn(column, expand) {
337
338
  }
338
339
  };
339
340
  }, function (tr) {
340
- return selectColumnTransform(column, expand)(tr).setMeta('addToHistory', false);
341
+ return selectColumnTransform(column, expand)(tr).setMeta('addToHistory', false).setMeta('selectedColumnViaKeyboard', triggeredByKeyboard);
341
342
  });
342
343
  };
343
344
  export var selectColumns = function selectColumns(columnIndexes) {
@@ -372,6 +373,7 @@ export var selectColumns = function selectColumns(columnIndexes) {
372
373
  });
373
374
  };
374
375
  export var selectRow = function selectRow(row, expand) {
376
+ var triggeredByKeyboard = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
375
377
  return createCommand(function (state) {
376
378
  var targetCellPosition;
377
379
  var cells = getCellsInRow(row)(state.tr.selection);
@@ -385,7 +387,7 @@ export var selectRow = function selectRow(row, expand) {
385
387
  }
386
388
  };
387
389
  }, function (tr) {
388
- return selectRowTransform(row, expand)(tr).setMeta('addToHistory', false);
390
+ return selectRowTransform(row, expand)(tr).setMeta('addToHistory', false).setMeta('selectedRowViaKeyboard', triggeredByKeyboard);
389
391
  });
390
392
  };
391
393
  export var selectRows = function selectRows(rowIndexes) {
@@ -447,7 +449,7 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
447
449
  return tr.setMeta('addToHistory', false);
448
450
  });
449
451
  };
450
- export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
452
+ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, isKeyboardResize) {
451
453
  return createCommand(function (state) {
452
454
  var tableNode = findTable(state.selection);
453
455
  var _getPluginState2 = getPluginState(state),
@@ -465,7 +467,8 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowI
465
467
  }),
466
468
  resizeHandleRowIndex: rowIndex,
467
469
  resizeHandleColumnIndex: columnIndex,
468
- resizeHandleIncludeTooltip: includeTooltip
470
+ resizeHandleIncludeTooltip: includeTooltip,
471
+ isKeyboardResize: isKeyboardResize || false
469
472
  }
470
473
  };
471
474
  }, function (tr) {
@@ -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 var TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
11
11
  TableSelectionDirection["TopToBottom"] = "TopToBottom";
@@ -82,6 +82,7 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
82
82
  };
83
83
  export var selectColumns = function selectColumns(editorSelectionAPI) {
84
84
  return function () {
85
+ var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
85
86
  return function (state, dispatch) {
86
87
  var selection = state.selection;
87
88
  var table = findTable(selection);
@@ -94,7 +95,7 @@ export var selectColumns = function selectColumns(editorSelectionAPI) {
94
95
  })(state, dispatch);
95
96
  }
96
97
  if (table && rect) {
97
- return selectColumn(rect.left)(state, dispatch);
98
+ return selectColumn(rect.left, undefined, triggeredByKeyboard)(state, dispatch);
98
99
  }
99
100
  return false;
100
101
  };
@@ -102,6 +103,7 @@ export var selectColumns = function selectColumns(editorSelectionAPI) {
102
103
  };
103
104
  export var selectRows = function selectRows(editorSelectionAPI) {
104
105
  return function () {
106
+ var triggeredByKeyboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
105
107
  return function (state, dispatch) {
106
108
  var selection = state.selection;
107
109
  var table = findTable(selection);
@@ -114,7 +116,7 @@ export var selectRows = function selectRows(editorSelectionAPI) {
114
116
  })(state, dispatch);
115
117
  }
116
118
  if (table && rect) {
117
- return selectRow(rect.top)(state, dispatch);
119
+ return selectRow(rect.top, undefined, triggeredByKeyboard)(state, dispatch);
118
120
  }
119
121
  return false;
120
122
  };
@@ -196,8 +198,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
196
198
  var $from = selection.$from;
197
199
  var isColumnResizing = false;
198
200
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
199
- var columResizePluginState = getResizePluginState(state) || {};
200
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
201
+ var columResizePluginState = getPluginState(state) || {};
202
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
201
203
  }
202
204
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
203
205
  // + 3 for: row, cell & paragraph nodes
@@ -230,8 +232,8 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
230
232
  var $to = selection.$to;
231
233
  var isColumnResizing = false;
232
234
  if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
233
- var columResizePluginState = getResizePluginState(state) || {};
234
- isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
235
+ var columResizePluginState = getPluginState(state) || {};
236
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
235
237
  }
236
238
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
237
239
  // + 3 for: row, cell & paragraph nodes
@@ -5,6 +5,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
7
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
9
  import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
9
10
  import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
10
11
  import { getPluginState } from './pm-plugins/plugin-factory';
@@ -163,15 +164,25 @@ export var handleMouseOut = function handleMouseOut(view, mouseEvent) {
163
164
  if (isResizeHandleDecoration(target) && !isResizeHandleDecoration(relatedTarget)) {
164
165
  var _state2 = view.state,
165
166
  _dispatch3 = view.dispatch;
166
- return hideResizeHandleLine()(_state2, _dispatch3);
167
+ if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
168
+ var _getPluginState2 = getPluginState(_state2),
169
+ isKeyboardResize = _getPluginState2.isKeyboardResize;
170
+ if (isKeyboardResize) {
171
+ // no need to hide decoration if column resizing started by keyboard
172
+ return false;
173
+ }
174
+ return hideResizeHandleLine()(_state2, _dispatch3);
175
+ } else {
176
+ return hideResizeHandleLine()(_state2, _dispatch3);
177
+ }
167
178
  }
168
179
  return false;
169
180
  };
170
181
  export var handleMouseEnter = function handleMouseEnter(view, mouseEvent) {
171
182
  var state = view.state,
172
183
  dispatch = view.dispatch;
173
- var _getPluginState2 = getPluginState(state),
174
- isTableHovered = _getPluginState2.isTableHovered;
184
+ var _getPluginState3 = getPluginState(state),
185
+ isTableHovered = _getPluginState3.isTableHovered;
175
186
  if (!isTableHovered) {
176
187
  return setTableHovered(true)(state, dispatch);
177
188
  }
@@ -183,11 +194,11 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
183
194
  }
184
195
  var state = view.state,
185
196
  dispatch = view.dispatch;
186
- var _getPluginState3 = getPluginState(state),
187
- insertColumnButtonIndex = _getPluginState3.insertColumnButtonIndex,
188
- insertRowButtonIndex = _getPluginState3.insertRowButtonIndex,
189
- isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled,
190
- isTableHovered = _getPluginState3.isTableHovered;
197
+ var _getPluginState4 = getPluginState(state),
198
+ insertColumnButtonIndex = _getPluginState4.insertColumnButtonIndex,
199
+ insertRowButtonIndex = _getPluginState4.insertRowButtonIndex,
200
+ isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled,
201
+ isTableHovered = _getPluginState4.isTableHovered;
191
202
  if (isTableHovered) {
192
203
  if (isDragAndDropEnabled) {
193
204
  var _getDragDropPluginSta = getDragDropPluginState(state),
@@ -220,9 +231,9 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
220
231
  if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
221
232
  var state = view.state,
222
233
  dispatch = view.dispatch;
223
- var _getPluginState4 = getPluginState(state),
224
- insertColumnButtonIndex = _getPluginState4.insertColumnButtonIndex,
225
- isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
234
+ var _getPluginState5 = getPluginState(state),
235
+ insertColumnButtonIndex = _getPluginState5.insertColumnButtonIndex,
236
+ isDragAndDropEnabled = _getPluginState5.isDragAndDropEnabled;
226
237
  var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
227
238
  _getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
228
239
  startIndex = _getColumnOrRowIndex10[0],
@@ -235,8 +246,8 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
235
246
  if (isRowControlsButton(element) || isDragRowFloatingInsertDot(element)) {
236
247
  var _state3 = view.state,
237
248
  _dispatch4 = view.dispatch;
238
- var _getPluginState5 = getPluginState(_state3),
239
- insertRowButtonIndex = _getPluginState5.insertRowButtonIndex;
249
+ var _getPluginState6 = getPluginState(_state3),
250
+ insertRowButtonIndex = _getPluginState6.insertRowButtonIndex;
240
251
  var _getColumnOrRowIndex11 = getColumnOrRowIndex(element),
241
252
  _getColumnOrRowIndex12 = _slicedToArray(_getColumnOrRowIndex11, 2),
242
253
  _startIndex3 = _getColumnOrRowIndex12[0],
@@ -251,19 +262,21 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
251
262
  if (_positionColumn !== null) {
252
263
  var _state4 = view.state,
253
264
  _dispatch5 = view.dispatch;
254
- var _getPluginState6 = getPluginState(_state4),
255
- resizeHandleColumnIndex = _getPluginState6.resizeHandleColumnIndex,
256
- resizeHandleRowIndex = _getPluginState6.resizeHandleRowIndex;
265
+ var _getPluginState7 = getPluginState(_state4),
266
+ resizeHandleColumnIndex = _getPluginState7.resizeHandleColumnIndex,
267
+ resizeHandleRowIndex = _getPluginState7.resizeHandleRowIndex;
268
+ var isKeyboardResize = getBooleanFF('platform.editor.a11y-column-resizing_emcvz') ? getPluginState(_state4).isKeyboardResize : false;
257
269
  var tableCell = closestElement(element, 'td, th');
258
270
  var cellStartPosition = view.posAtDOM(tableCell, 0);
259
271
  var rect = findCellRectClosestToPos(_state4.doc.resolve(cellStartPosition));
260
272
  if (rect) {
261
273
  var columnEndIndexTarget = _positionColumn === 'left' ? rect.left : rect.right;
262
274
  var rowIndexTarget = rect.top;
263
- if (columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
275
+ if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
264
276
  target: element,
265
277
  columnEndIndexTarget: columnEndIndexTarget
266
- })) {
278
+ })) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
279
+ ) {
267
280
  return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true)(_state4, _dispatch5);
268
281
  }
269
282
  }
@@ -328,8 +341,8 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
328
341
  if (isTableSelected) {
329
342
  tr = removeTable(tr);
330
343
  } else if (tr.selection.isRowSelection()) {
331
- var _getPluginState7 = getPluginState(newState),
332
- isHeaderRowRequired = _getPluginState7.pluginConfig.isHeaderRowRequired;
344
+ var _getPluginState8 = getPluginState(newState),
345
+ isHeaderRowRequired = _getPluginState8.pluginConfig.isHeaderRowRequired;
333
346
  tr = deleteRows(rect, isHeaderRowRequired)(tr);
334
347
  } else if (tr.selection.isColSelection()) {
335
348
  tr = deleteColumns(rect, getAllowAddColumnCustomStep(oldState), editorView)(tr);
@@ -341,8 +354,8 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
341
354
  return tr;
342
355
  };
343
356
  export var isTableInFocus = function isTableInFocus(view) {
344
- var _getPluginState8, _getResizePluginState;
345
- return !!((_getPluginState8 = getPluginState(view.state)) !== null && _getPluginState8 !== void 0 && _getPluginState8.tableNode) && !((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
357
+ var _getPluginState9, _getResizePluginState;
358
+ return !!((_getPluginState9 = getPluginState(view.state)) !== null && _getPluginState9 !== void 0 && _getPluginState9.tableNode) && !((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
346
359
  };
347
360
  export var whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
348
361
  return function (view, mouseEvent) {
@@ -356,9 +369,9 @@ var trackCellLocation = function trackCellLocation(view, mouseEvent) {
356
369
  var _tableElement$dataset;
357
370
  var target = mouseEvent.target;
358
371
  var maybeTableCell = isElementInTableCell(target);
359
- var _getPluginState9 = getPluginState(view.state),
360
- tableNode = _getPluginState9.tableNode,
361
- tableRef = _getPluginState9.tableRef;
372
+ var _getPluginState10 = getPluginState(view.state),
373
+ tableNode = _getPluginState10.tableNode,
374
+ tableRef = _getPluginState10.tableRef;
362
375
  var tableElement = closestElement(target, 'table');
363
376
 
364
377
  // hover will only trigger if target localId is the same with selected localId
@@ -6,7 +6,6 @@ import { DragAndDropActionType } from './actions';
6
6
  import { DropTargetType } from './consts';
7
7
  import { createCommand, getPluginState } from './plugin-factory';
8
8
  import { pluginKey } from './plugin-key';
9
-
10
9
  // TODO: This command is a placeholder example. Please replace this if required.
11
10
  export var getDecorations = function getDecorations(state) {
12
11
  var _pluginKey$getState;
@@ -79,6 +78,7 @@ export var moveSource = function moveSource(sourceType, sourceIndexes, targetInd
79
78
  });
80
79
  };
81
80
  export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
81
+ var trigger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'mouse';
82
82
  return createCommand(function (state) {
83
83
  var _getPluginState3 = getPluginState(state),
84
84
  previousOpenState = _getPluginState3.isDragMenuOpen,
@@ -105,7 +105,8 @@ export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, i
105
105
  data: {
106
106
  isDragMenuOpen: updatedMenuOpenState,
107
107
  direction: direction !== null && direction !== void 0 ? direction : previousDragMenuDirection,
108
- index: index !== null && index !== void 0 ? index : previousDragMenuIndex
108
+ index: index !== null && index !== void 0 ? index : previousDragMenuIndex,
109
+ isKeyboardModeActive: updatedMenuOpenState && trigger === 'keyboard'
109
110
  }
110
111
  };
111
112
  }, function (tr) {
@@ -164,7 +164,8 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
164
164
  dropTargetIndex: 0,
165
165
  isDragMenuOpen: false,
166
166
  dragMenuIndex: 0,
167
- isDragging: false
167
+ isDragging: false,
168
+ isKeyboardModeActive: false
168
169
  };
169
170
  }),
170
171
  key: pluginKey,
@@ -176,6 +177,20 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
176
177
  var _getPluginState = getPluginState(newState),
177
178
  isDragMenuOpen = _getPluginState.isDragMenuOpen,
178
179
  dragMenuIndex = _getPluginState.dragMenuIndex;
180
+ transactions.forEach(function (transaction) {
181
+ if (transaction.getMeta('selectedRowViaKeyboard')) {
182
+ var button = document.querySelector('#drag-handle-button-row');
183
+ if (button) {
184
+ button.focus();
185
+ }
186
+ }
187
+ if (transaction.getMeta('selectedColumnViaKeyboard')) {
188
+ var _button = document.querySelector('#drag-handle-button-column');
189
+ if (_button) {
190
+ _button.focus();
191
+ }
192
+ }
193
+ });
179
194
 
180
195
  // What's happening here? you asked... In a nutshell;
181
196
  // If the target cell position changes while the drag menu is open then we want to close the drag menu if it has been opened.
@@ -216,6 +231,23 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
216
231
  var _getPluginState2 = getPluginState(state),
217
232
  decorationSet = _getPluginState2.decorationSet;
218
233
  return decorationSet;
234
+ },
235
+ handleKeyDown: function handleKeyDown(view, event) {
236
+ var _ref8;
237
+ var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
238
+ var keysToTrap = ['Enter', ' '];
239
+ var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
240
+ var _getPluginState3 = getPluginState(view.state),
241
+ isDragMenuOpen = _getPluginState3.isDragMenuOpen;
242
+
243
+ // drag handle is focused, and user presses any key return them back to editing
244
+ if (isDragHandleFocused && !isDragMenuOpen && !keysToTrap.includes(event.key)) {
245
+ view.dom.focus();
246
+ return true;
247
+ }
248
+ if (isDragHandleFocused && keysToTrap.includes(event.key) || isDragMenuOpen && keysToTrapWhen.includes(event.key)) {
249
+ return true;
250
+ }
219
251
  }
220
252
  }
221
253
  });
@@ -23,7 +23,8 @@ export default (function (pluginState, action) {
23
23
  return _objectSpread(_objectSpread({}, pluginState), {}, {
24
24
  isDragMenuOpen: action.data.isDragMenuOpen,
25
25
  dragMenuDirection: action.data.direction,
26
- dragMenuIndex: action.data.index
26
+ dragMenuIndex: action.data.index,
27
+ isKeyboardModeActive: action.data.isKeyboardModeActive
27
28
  });
28
29
  default:
29
30
  return pluginState;
@@ -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';
@@ -50,6 +50,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
50
50
  bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
51
51
  bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStep(-10, getEditorContainerWidth), list);
52
52
  bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStep(10, getEditorContainerWidth), list);
53
+ bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing(), list);
53
54
  }
54
55
  return keymap(list);
55
56
  }