@atlaskit/editor-plugin-table 5.7.9 → 5.8.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 (105) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/commands/column-resize.js +155 -0
  4. package/dist/cjs/commands/go-to-next-cell.js +15 -0
  5. package/dist/cjs/commands/selection.js +16 -3
  6. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -1
  7. package/dist/cjs/plugin.js +2 -1
  8. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
  9. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +2 -1
  10. package/dist/cjs/pm-plugins/keymap.js +9 -0
  11. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +18 -7
  12. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
  13. package/dist/cjs/types.js +8 -1
  14. package/dist/cjs/ui/DragHandle/index.js +1 -1
  15. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +187 -17
  16. package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
  17. package/dist/cjs/ui/FloatingDragMenu/styles.js +19 -0
  18. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  19. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  20. package/dist/cjs/ui/consts.js +2 -1
  21. package/dist/cjs/ui/ui-styles.js +6 -2
  22. package/dist/cjs/utils/decoration.js +14 -4
  23. package/dist/es2019/commands/column-resize.js +149 -0
  24. package/dist/es2019/commands/go-to-next-cell.js +13 -0
  25. package/dist/es2019/commands/selection.js +16 -3
  26. package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -1
  27. package/dist/es2019/plugin.js +2 -1
  28. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
  29. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -1
  30. package/dist/es2019/pm-plugins/keymap.js +10 -1
  31. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +19 -8
  32. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
  33. package/dist/es2019/types.js +8 -1
  34. package/dist/es2019/ui/DragHandle/index.js +1 -1
  35. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +177 -7
  36. package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
  37. package/dist/es2019/ui/FloatingDragMenu/styles.js +62 -0
  38. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  39. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  40. package/dist/es2019/ui/consts.js +2 -1
  41. package/dist/es2019/ui/ui-styles.js +108 -65
  42. package/dist/es2019/utils/decoration.js +14 -4
  43. package/dist/esm/commands/column-resize.js +149 -0
  44. package/dist/esm/commands/go-to-next-cell.js +15 -0
  45. package/dist/esm/commands/selection.js +16 -3
  46. package/dist/esm/nodeviews/ExternalDropTargets.js +2 -1
  47. package/dist/esm/plugin.js +2 -1
  48. package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -3
  49. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +2 -1
  50. package/dist/esm/pm-plugins/keymap.js +10 -1
  51. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +19 -8
  52. package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
  53. package/dist/esm/types.js +8 -1
  54. package/dist/esm/ui/DragHandle/index.js +1 -1
  55. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +177 -7
  56. package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
  57. package/dist/esm/ui/FloatingDragMenu/styles.js +12 -0
  58. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
  59. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  60. package/dist/esm/ui/consts.js +2 -1
  61. package/dist/esm/ui/ui-styles.js +7 -3
  62. package/dist/esm/utils/decoration.js +14 -4
  63. package/dist/types/commands/column-resize.d.ts +5 -0
  64. package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  65. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  66. package/dist/types/types.d.ts +7 -0
  67. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  68. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  69. package/dist/types/ui/FloatingDragMenu/styles.d.ts +3 -0
  70. package/dist/types/ui/consts.d.ts +1 -1
  71. package/dist/types/utils/decoration.d.ts +2 -2
  72. package/dist/types-ts4.5/commands/column-resize.d.ts +5 -0
  73. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
  74. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  75. package/dist/types-ts4.5/types.d.ts +7 -0
  76. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  77. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  78. package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +3 -0
  79. package/dist/types-ts4.5/ui/consts.d.ts +1 -1
  80. package/dist/types-ts4.5/utils/decoration.d.ts +2 -2
  81. package/package.json +8 -4
  82. package/src/__tests__/unit/analytics.ts +5 -1
  83. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +295 -0
  84. package/src/__tests__/unit/ui/RowDragControls.tsx +5 -4
  85. package/src/commands/column-resize.ts +257 -0
  86. package/src/commands/go-to-next-cell.ts +21 -0
  87. package/src/commands/selection.ts +19 -2
  88. package/src/nodeviews/ExternalDropTargets.tsx +1 -0
  89. package/src/plugin.tsx +1 -0
  90. package/src/pm-plugins/drag-and-drop/commands.ts +3 -2
  91. package/src/pm-plugins/drag-and-drop/plugin.ts +10 -4
  92. package/src/pm-plugins/keymap.ts +35 -0
  93. package/src/pm-plugins/table-resizing/event-handlers.ts +33 -21
  94. package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
  95. package/src/types.ts +9 -0
  96. package/src/ui/DragHandle/index.tsx +1 -1
  97. package/src/ui/FloatingDragMenu/DragMenu.tsx +226 -7
  98. package/src/ui/FloatingDragMenu/index.tsx +4 -1
  99. package/src/ui/FloatingDragMenu/styles.ts +71 -0
  100. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +35 -37
  101. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +33 -33
  102. package/src/ui/consts.ts +6 -1
  103. package/src/ui/ui-styles.ts +115 -64
  104. package/src/utils/decoration.ts +27 -8
  105. package/tsconfig.app.json +3 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 5.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#57215](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/57215) [`73841c209537`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/73841c209537) - [ux] ECA11Y-107: Add basic keyboard navigation for resize sliders
8
+
9
+ ### Patch Changes
10
+
11
+ - [#66092](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66092) [`b436457c489f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b436457c489f) - [ux] ED-21241: Add new menu items to the drag handle menus
12
+ - Updated dependencies
13
+
14
+ ## 5.7.10
15
+
16
+ ### Patch Changes
17
+
18
+ - [#66128](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66128) [`a276b9ce0b8f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a276b9ce0b8f) - Add data test ids to elements, introduce table tests
19
+ - [#66453](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66453) [`a43a37f6b703`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a43a37f6b703) - [ux] Updates color of insert line when drop target has merged cells.
20
+ - Updated dependencies
21
+
3
22
  ## 5.7.9
4
23
 
5
24
  ### Patch Changes
@@ -60,6 +60,9 @@
60
60
  {
61
61
  "path": "../../../design-system/theme/afm-cc/tsconfig.json"
62
62
  },
63
+ {
64
+ "path": "../../../design-system/toggle/afm-cc/tsconfig.json"
65
+ },
63
66
  {
64
67
  "path": "../../../design-system/tokens/afm-cc/tsconfig.json"
65
68
  },
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initiateKeyboardColumnResizing = exports.changeColumnWidthByStep = exports.activateNextResizeArea = void 0;
7
+ var _styles = require("@atlaskit/editor-common/styles");
8
+ var _editorTables = require("@atlaskit/editor-tables");
9
+ var _utils = require("@atlaskit/editor-tables/src/utils");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
+ var _pluginFactory = require("../pm-plugins/table-resizing/plugin-factory");
12
+ var _utils2 = require("../pm-plugins/table-resizing/utils");
13
+ var _transforms = require("../transforms");
14
+ var _utils3 = require("../utils");
15
+ var _index = require("./index");
16
+ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
17
+ return function (state, dispatch) {
18
+ (0, _index.addResizeHandleDecorations)(rowIndex, columnIndex, true)(state, dispatch);
19
+ // Currently only 'right' position is used in showResizeHandleLine
20
+ (0, _index.showResizeHandleLine)({
21
+ left: 0,
22
+ right: columnIndex
23
+ })(state, dispatch);
24
+ (0, _pluginFactory.createCommand)({
25
+ type: 'SET_RESIZE_HANDLE_POSITION',
26
+ data: {
27
+ resizeHandlePos: nextResizeHandlePos
28
+ }
29
+ })(state, dispatch);
30
+ return false;
31
+ };
32
+ };
33
+ var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(state, dispatch, view) {
34
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
35
+ return false;
36
+ }
37
+ var selection = state.selection;
38
+ var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
39
+ var cell = (0, _utils.findCellClosestToPos)(selection.$from);
40
+ if (selectionRect && cell && view) {
41
+ var cellAttrs = cell.node.attrs;
42
+ var width = (0, _utils2.currentColWidth)(view, cell.pos, cellAttrs);
43
+ updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
44
+ (0, _pluginFactory.createCommand)({
45
+ type: 'SET_DRAGGING',
46
+ data: {
47
+ dragging: {
48
+ startX: 0,
49
+ startWidth: width
50
+ }
51
+ }
52
+ })(state, dispatch);
53
+ return true;
54
+ }
55
+ return false;
56
+ };
57
+ var activateNextResizeArea = exports.activateNextResizeArea = function activateNextResizeArea(direction) {
58
+ return function (state, dispatch) {
59
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
60
+ return false;
61
+ }
62
+ var _ref = (0, _pluginFactory.getPluginState)(state) || {},
63
+ resizeHandlePos = _ref.resizeHandlePos,
64
+ dragging = _ref.dragging;
65
+ // If No resizing has initiated, skip to regular handler
66
+ if (!resizeHandlePos || !dragging) {
67
+ return false;
68
+ }
69
+ var selection = state.selection;
70
+ var cell = (0, _utils.findCellClosestToPos)(selection.$from);
71
+ if (!cell) {
72
+ // cursor position may be changed by mouse to be outside of table;
73
+ return false;
74
+ }
75
+ var $currentCell = state.doc.resolve(resizeHandlePos);
76
+ if (!$currentCell) {
77
+ return false;
78
+ }
79
+ var tableNode = $currentCell.node(-1);
80
+ var closestTable = (0, _utils.findTableClosestToPos)($currentCell);
81
+ var tableMap = _editorTables.TableMap.get(tableNode);
82
+ if (!tableNode || !closestTable || !tableMap) {
83
+ return false;
84
+ }
85
+ var currentCellRect = tableMap.findCell($currentCell.pos - $currentCell.start(-1));
86
+ var $nextCell = (0, _utils.nextCell)($currentCell, 'horiz', direction);
87
+ if ($nextCell) {
88
+ // we are somewhere in between the side columns of the table
89
+ var offset = $nextCell.pos - $nextCell.start(-1);
90
+ var rectForNextCell = tableMap.findCell(offset);
91
+ updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
92
+ } else {
93
+ // current position is in the one of the side columns of the table(left or right)
94
+ if (currentCellRect.left === 0) {
95
+ var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
96
+ var $lastCell = state.doc.resolve(lastCellInCurrentRow);
97
+ updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
98
+ } else if (tableMap.width === currentCellRect.right) {
99
+ var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
100
+ var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
101
+ updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
102
+ }
103
+ }
104
+ return true;
105
+ };
106
+ };
107
+ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeColumnWidthByStep(stepSize, getEditorContainerWidth) {
108
+ return function (state, dispatch, view) {
109
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
110
+ return false;
111
+ }
112
+ var _getTableResizingPlug = (0, _pluginFactory.getPluginState)(state),
113
+ resizeHandlePos = _getTableResizingPlug.resizeHandlePos,
114
+ dragging = _getTableResizingPlug.dragging;
115
+ if (!view || !resizeHandlePos || !dragging) {
116
+ return false;
117
+ }
118
+ var $cell = state.doc.resolve(resizeHandlePos);
119
+ var tableStartPosition = $cell.start(-1);
120
+ var originalTable = $cell.node(-1);
121
+ var map = _editorTables.TableMap.get(originalTable);
122
+ var domAtPos = view.domAtPos.bind(view);
123
+ var colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
124
+ var dom = domAtPos(tableStartPosition).node;
125
+ if (dom && dom.nodeName !== 'TABLE') {
126
+ dom = dom.closest('table');
127
+ }
128
+ var maxSize = (0, _utils2.getTableMaxWidth)({
129
+ table: originalTable,
130
+ tableStart: tableStartPosition,
131
+ state: state,
132
+ layout: originalTable.attrs.layout,
133
+ getEditorContainerWidth: getEditorContainerWidth
134
+ });
135
+ var initialResizeState = (0, _utils2.getResizeState)({
136
+ minWidth: _styles.tableCellMinWidth,
137
+ maxSize: maxSize,
138
+ table: originalTable,
139
+ tableRef: dom,
140
+ start: tableStartPosition,
141
+ domAtPos: domAtPos
142
+ });
143
+ (0, _utils2.updateControls)()(state);
144
+ var selectionRect = (0, _utils.getSelectionRect)(state.selection);
145
+ var selectedColumns = selectionRect ? (0, _utils3.getSelectedColumnIndexes)(selectionRect) : [];
146
+ // only selected (or selected - 1) columns should be distributed
147
+ var resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
148
+ var newResizeState = (0, _utils2.resizeColumn)(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
149
+ var tr = (0, _transforms.updateColumnWidths)(newResizeState, originalTable, tableStartPosition)(state.tr);
150
+ if (dispatch) {
151
+ dispatch(tr);
152
+ }
153
+ return true;
154
+ };
155
+ };
@@ -8,7 +8,10 @@ var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _utils = require("@atlaskit/editor-prosemirror/utils");
9
9
  var _tableMap = require("@atlaskit/editor-tables/table-map");
10
10
  var _utils2 = require("@atlaskit/editor-tables/utils");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _commandsWithAnalytics = require("../commands-with-analytics");
13
+ var _pluginFactory = require("../pm-plugins/table-resizing/plugin-factory");
14
+ var _hover = require("./hover");
12
15
  // #region Constants
13
16
 
14
17
  var TAB_FORWARD_DIRECTION = 1;
@@ -20,6 +23,18 @@ var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsA
20
23
  if (!table) {
21
24
  return false;
22
25
  }
26
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
27
+ var _getResizePluginState;
28
+ var isColumnResizing = !!((_getResizePluginState = (0, _pluginFactory.getPluginState)(state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging);
29
+ if (isColumnResizing) {
30
+ (0, _pluginFactory.createCommand)({
31
+ type: 'STOP_RESIZING'
32
+ }, function (originalTr) {
33
+ return (state.tr || originalTr).setMeta('scrollIntoView', false);
34
+ })(state, dispatch);
35
+ (0, _hover.hideResizeHandleLine)()(state, dispatch);
36
+ }
37
+ }
23
38
  var map = _tableMap.TableMap.get(table.node);
24
39
  var _state$schema$nodes = state.schema.nodes,
25
40
  tableCell = _state$schema$nodes.tableCell,
@@ -9,7 +9,9 @@ var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
10
10
  var _tableMap = require("@atlaskit/editor-tables/table-map");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _misc = require("../commands/misc");
14
+ var _pluginFactory = require("../pm-plugins/table-resizing/plugin-factory");
13
15
  var _toolbar = require("../toolbar");
14
16
  var TableSelectionDirection = exports.TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
15
17
  TableSelectionDirection["TopToBottom"] = "TopToBottom";
@@ -198,9 +200,14 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
198
200
  var table = (0, _utils.findTable)(selection);
199
201
  if (table) {
200
202
  var $from = selection.$from;
203
+ var isColumnResizing = false;
204
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
205
+ var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
206
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
207
+ }
201
208
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
202
209
  // + 3 for: row, cell & paragraph nodes
203
- editorSelectionAPI) {
210
+ editorSelectionAPI && !isColumnResizing) {
204
211
  var selectionState = editorSelectionAPI.sharedState.currentState() || {};
205
212
  if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === _selection.RelativeSelectionPos.Before) {
206
213
  // we have a text selection at start of first table cell, directly inside a top level paragraph,
@@ -227,8 +234,14 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
227
234
  var table = (0, _utils.findTable)(selection);
228
235
  if (table) {
229
236
  var $to = selection.$to;
230
- if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
231
- ) {
237
+ var isColumnResizing = false;
238
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
239
+ var columResizePluginState = (0, _pluginFactory.getPluginState)(state) || {};
240
+ isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.dragging);
241
+ }
242
+ if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
243
+ // + 3 for: row, cell & paragraph nodes
244
+ !isColumnResizing) {
232
245
  // we have a text selection at end of last table cell, directly inside a top level paragraph,
233
246
  // and want to set a full table cell selection
234
247
  return selectFullTable(editorSelectionAPI)({
@@ -55,7 +55,8 @@ var ExternalDropTargets = exports.ExternalDropTargets = function ExternalDropTar
55
55
  top: "-".concat(_consts.dropTargetExtendedWidth - _styles.tableMarginTop, "px"),
56
56
  pointerEvents: 'auto',
57
57
  zIndex: "".concat(_consts.dropTargetsZIndex)
58
- }
58
+ },
59
+ "data-testid": "table-floating-column-extended-drop-targets"
59
60
  }, /*#__PURE__*/_react.default.createElement("div", {
60
61
  style: {
61
62
  display: 'flex',
@@ -362,7 +362,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
362
362
  canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
363
363
  getEditorContainerWidth: defaultGetEditorContainerWidth,
364
364
  editorAnalyticsAPI: editorAnalyticsAPI,
365
- stickyHeaders: stickyHeader
365
+ stickyHeaders: stickyHeader,
366
+ pluginConfig: pluginConfig
366
367
  }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
367
368
  editorView: editorView,
368
369
  selection: editorView.state.selection,
@@ -22,7 +22,7 @@ var getDecorations = exports.getDecorations = function getDecorations(state) {
22
22
  var updatePluginStateDecorations = exports.updatePluginStateDecorations = function updatePluginStateDecorations(state, decorations, key) {
23
23
  return (0, _utils2.updateDecorations)(state.doc, getDecorations(state), decorations, key);
24
24
  };
25
- var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, tr) {
25
+ var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, hasMergedCells, tr) {
26
26
  return (0, _pluginFactory.createCommand)(function (state) {
27
27
  var _getPluginState = (0, _pluginFactory.getPluginState)(state),
28
28
  dropTargetType = _getPluginState.dropTargetType,
@@ -32,9 +32,9 @@ var setDropTarget = exports.setDropTarget = function setDropTarget(type, index,
32
32
  }
33
33
  var decorationSet = _view.DecorationSet.empty;
34
34
  if (type === 'column') {
35
- decorationSet = updatePluginStateDecorations(state, (0, _utils2.createColumnInsertLine)(index, state.selection), _types.TableDecorations.COLUMN_INSERT_LINE);
35
+ decorationSet = updatePluginStateDecorations(state, (0, _utils2.createColumnInsertLine)(index, state.selection, hasMergedCells), _types.TableDecorations.COLUMN_INSERT_LINE);
36
36
  } else if (type === 'row') {
37
- decorationSet = updatePluginStateDecorations(state, (0, _utils2.createRowInsertLine)(index, state.selection), _types.TableDecorations.ROW_INSERT_LINE);
37
+ decorationSet = updatePluginStateDecorations(state, (0, _utils2.createRowInsertLine)(index, state.selection, hasMergedCells), _types.TableDecorations.ROW_INSERT_LINE);
38
38
  }
39
39
  return {
40
40
  type: _actions.DragAndDropActionType.SET_DROP_TARGET,
@@ -138,7 +138,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
138
138
  var sourceType = data.sourceType,
139
139
  targetAdjustedIndex = data.targetAdjustedIndex;
140
140
  var dropTargetType = sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN;
141
- (0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex)(editorView.state, editorView.dispatch);
141
+ var hasMergedCells = (0, _utils2.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
142
+ (0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
142
143
  },
143
144
  onDrop: function onDrop(event) {
144
145
  var _cell$row, _cell$col;
@@ -9,8 +9,10 @@ var _analytics = require("@atlaskit/editor-common/analytics");
9
9
  var _keymaps = require("@atlaskit/editor-common/keymaps");
10
10
  var _commands = require("@atlaskit/editor-prosemirror/commands");
11
11
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _commands2 = require("../commands");
13
14
  var _commandsWithAnalytics = require("../commands-with-analytics");
15
+ var _columnResize = require("../commands/column-resize");
14
16
  var _insert = require("../commands/insert");
15
17
  var _commandsWithAnalytics2 = require("../pm-plugins/drag-and-drop/commands-with-analytics");
16
18
  var _analytics2 = require("../utils/analytics");
@@ -49,6 +51,13 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
49
51
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteColumn.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI), list);
50
52
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteRow.common, (0, _commandsWithAnalytics.deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut)(editorAnalyticsAPI), list);
51
53
  }
54
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
55
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.startColumnResizing.common, _columnResize.initiateKeyboardColumnResizing, list);
56
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _columnResize.activateNextResizeArea)(1), list);
57
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _columnResize.activateNextResizeArea)(-1), list);
58
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.decreaseMediaSize.common, (0, _columnResize.changeColumnWidthByStep)(-10, getEditorContainerWidth), list);
59
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.increaseMediaSize.common, (0, _columnResize.changeColumnWidthByStep)(10, getEditorContainerWidth), list);
60
+ }
52
61
  return (0, _keymap.keymap)(list);
53
62
  }
54
63
  var _default = exports.default = keymapPlugin;
@@ -41,13 +41,24 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
41
41
  if (dom && dom.nodeName !== 'TABLE') {
42
42
  dom = dom.closest('table');
43
43
  }
44
- var containerWidth = getEditorContainerWidth();
45
- var parentWidth = (0, _nodeWidth.getParentNodeWidth)(start, state, containerWidth);
46
- var maxSize = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? parentWidth ||
47
- // its safe to reference table width from node as this will not have changed
48
- originalTable.attrs.width || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {}) : parentWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
49
- if (originalTable.attrs.isNumberColumnEnabled) {
50
- maxSize -= _editorSharedStyles.akEditorTableNumberColumnWidth;
44
+ var maxSize;
45
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
46
+ var containerWidth = getEditorContainerWidth();
47
+ var parentWidth = (0, _nodeWidth.getParentNodeWidth)(start, state, containerWidth);
48
+ maxSize = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? parentWidth ||
49
+ // its safe to reference table width from node as this will not have changed
50
+ originalTable.attrs.width || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {}) : parentWidth || (0, _utils3.getLayoutSize)(dom.getAttribute('data-layout'), containerWidth.width, {});
51
+ if (originalTable.attrs.isNumberColumnEnabled) {
52
+ maxSize -= _editorSharedStyles.akEditorTableNumberColumnWidth;
53
+ }
54
+ } else {
55
+ maxSize = (0, _utils3.getTableMaxWidth)({
56
+ table: originalTable,
57
+ tableStart: start,
58
+ state: state,
59
+ layout: originalTable.attrs.layout,
60
+ getEditorContainerWidth: getEditorContainerWidth
61
+ });
51
62
  }
52
63
  var resizeState = (0, _utils3.getResizeState)({
53
64
  minWidth: _styles.tableCellMinWidth,
@@ -123,6 +123,12 @@ Object.defineProperty(exports, "getResizeState", {
123
123
  return _resizeState.getResizeState;
124
124
  }
125
125
  });
126
+ Object.defineProperty(exports, "getTableMaxWidth", {
127
+ enumerable: true,
128
+ get: function get() {
129
+ return _misc.getTableMaxWidth;
130
+ }
131
+ });
126
132
  Object.defineProperty(exports, "getTotalWidth", {
127
133
  enumerable: true,
128
134
  get: function get() {
package/dist/cjs/types.js CHANGED
@@ -105,6 +105,8 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
105
105
  DRAG_HANDLE_DISABLED: "".concat(_adfSchema.tablePrefixSelector, "-drag-handle-disabled"),
106
106
  /** minimised handle class */
107
107
  DRAG_HANDLE_MINIMISED: "".concat(_adfSchema.tablePrefixSelector, "-drag-handle-minimised"),
108
+ DRAG_SUBMENU: "".concat(_adfSchema.tablePrefixSelector, "-drag-submenu"),
109
+ DRAG_SUBMENU_ICON: "".concat(_adfSchema.tablePrefixSelector, "-drag-submenu-icon"),
108
110
  /** Other classes */
109
111
  NUMBERED_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-numbered-column"),
110
112
  NUMBERED_COLUMN_BUTTON: "".concat(_adfSchema.tablePrefixSelector, "-numbered-column__button"),
@@ -140,12 +142,17 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
140
142
  TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
141
143
  LAST_ITEM_IN_CELL: "".concat(_adfSchema.tablePrefixSelector, "-last-item-in-cell"),
142
144
  WITH_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-column-insert-line"),
145
+ WITH_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-column-insert-line__inactive"),
143
146
  WITH_FIRST_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-first-column-insert-line"),
147
+ WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-first-column-insert-line__inactive"),
144
148
  WITH_LAST_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-last-column-insert-line"),
149
+ WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-last-column-insert-line__inactive"),
145
150
  WITH_RESIZE_LINE: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line"),
146
151
  WITH_RESIZE_LINE_LAST_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line-last-column"),
147
152
  WITH_ROW_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-row-insert-line"),
148
- WITH_LAST_ROW_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-last-row-insert-line")
153
+ WITH_ROW_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-row-insert-line__inactive"),
154
+ WITH_LAST_ROW_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-last-row-insert-line"),
155
+ WITH_LAST_ROW_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-last-row-insert-line__inactive")
149
156
  });
150
157
  var ShadowEvent = exports.ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
151
158
  ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
@@ -123,7 +123,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
123
123
  style: {
124
124
  transform: direction === 'column' ? 'none' : 'rotate(90deg)'
125
125
  },
126
- "data-testid": "table-floating-column-controls-drag-handle",
126
+ "data-testid": "table-drag-handle-button",
127
127
  onMouseOver: onMouseOver,
128
128
  onMouseOut: onMouseOut,
129
129
  onMouseUp: function onMouseUp(e) {