@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/dist/esm/types.js CHANGED
@@ -99,6 +99,8 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
99
99
  DRAG_HANDLE_DISABLED: "".concat(tablePrefixSelector, "-drag-handle-disabled"),
100
100
  /** minimised handle class */
101
101
  DRAG_HANDLE_MINIMISED: "".concat(tablePrefixSelector, "-drag-handle-minimised"),
102
+ DRAG_SUBMENU: "".concat(tablePrefixSelector, "-drag-submenu"),
103
+ DRAG_SUBMENU_ICON: "".concat(tablePrefixSelector, "-drag-submenu-icon"),
102
104
  /** Other classes */
103
105
  NUMBERED_COLUMN: "".concat(tablePrefixSelector, "-numbered-column"),
104
106
  NUMBERED_COLUMN_BUTTON: "".concat(tablePrefixSelector, "-numbered-column__button"),
@@ -134,12 +136,17 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
134
136
  TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
135
137
  LAST_ITEM_IN_CELL: "".concat(tablePrefixSelector, "-last-item-in-cell"),
136
138
  WITH_COLUMN_INSERT_LINE: "".concat(tablePrefixSelector, "-column-insert-line"),
139
+ WITH_COLUMN_INSERT_LINE_INACTIVE: "".concat(tablePrefixSelector, "-column-insert-line__inactive"),
137
140
  WITH_FIRST_COLUMN_INSERT_LINE: "".concat(tablePrefixSelector, "-first-column-insert-line"),
141
+ WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: "".concat(tablePrefixSelector, "-first-column-insert-line__inactive"),
138
142
  WITH_LAST_COLUMN_INSERT_LINE: "".concat(tablePrefixSelector, "-last-column-insert-line"),
143
+ WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: "".concat(tablePrefixSelector, "-last-column-insert-line__inactive"),
139
144
  WITH_RESIZE_LINE: "".concat(tablePrefixSelector, "-column-resize-line"),
140
145
  WITH_RESIZE_LINE_LAST_COLUMN: "".concat(tablePrefixSelector, "-column-resize-line-last-column"),
141
146
  WITH_ROW_INSERT_LINE: "".concat(tablePrefixSelector, "-row-insert-line"),
142
- WITH_LAST_ROW_INSERT_LINE: "".concat(tablePrefixSelector, "-last-row-insert-line")
147
+ WITH_ROW_INSERT_LINE_INACTIVE: "".concat(tablePrefixSelector, "-row-insert-line__inactive"),
148
+ WITH_LAST_ROW_INSERT_LINE: "".concat(tablePrefixSelector, "-last-row-insert-line"),
149
+ WITH_LAST_ROW_INSERT_LINE_INACTIVE: "".concat(tablePrefixSelector, "-last-row-insert-line__inactive")
143
150
  });
144
151
  export var ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
145
152
  ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
@@ -113,7 +113,7 @@ export var DragHandle = function DragHandle(_ref) {
113
113
  style: {
114
114
  transform: direction === 'column' ? 'none' : 'rotate(90deg)'
115
115
  },
116
- "data-testid": "table-floating-column-controls-drag-handle",
116
+ "data-testid": "table-drag-handle-button",
117
117
  onMouseOver: onMouseOver,
118
118
  onMouseOut: onMouseOut,
119
119
  onMouseUp: function onMouseUp(e) {
@@ -1,16 +1,31 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
4
  /** @jsx jsx */
5
+ import { useState } from 'react';
3
6
  import { jsx } from '@emotion/react';
7
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
8
+ import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
9
+ import { backgroundPaletteTooltipMessages, cellBackgroundColorPalette, ColorPalette } from '@atlaskit/editor-common/ui-color';
4
10
  import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
11
+ import { closestElement } from '@atlaskit/editor-common/utils';
12
+ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
5
13
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
6
14
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
15
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
16
+ import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
17
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
18
+ import Toggle from '@atlaskit/toggle';
8
19
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
20
+ import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
9
21
  import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
10
22
  import { getPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
11
- import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
23
+ import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-factory';
24
+ import { TableCssClassName as ClassName } from '../../types';
25
+ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
12
26
  import { getDragMenuConfig } from '../../utils/drag-menu';
13
27
  import { dragMenuDropdownWidth } from '../consts';
28
+ import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
14
29
  var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down'], ['sort_column_asc', 'sort_column_desc']];
15
30
  var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig) {
16
31
  var menuItemsArr = _toConsumableArray(Array(groupedDragMenuConfig.length)).map(function () {
@@ -33,7 +48,6 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig) {
33
48
  isDisabled: item.disabled,
34
49
  elemBefore: item.icon ? jsx("div", {
35
50
  style: {
36
- marginRight: "var(--ds-space-negative-075, -6px)",
37
51
  display: 'flex'
38
52
  }
39
53
  }, jsx(item.icon, {
@@ -57,6 +71,7 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig) {
57
71
  };
58
72
  };
59
73
  export var DragMenu = function DragMenu(_ref) {
74
+ var _pluginConfig$allowBa;
60
75
  var _ref$direction = _ref.direction,
61
76
  direction = _ref$direction === void 0 ? 'row' : _ref$direction,
62
77
  index = _ref.index,
@@ -69,23 +84,136 @@ export var DragMenu = function DragMenu(_ref) {
69
84
  targetCellPosition = _ref.targetCellPosition,
70
85
  getEditorContainerWidth = _ref.getEditorContainerWidth,
71
86
  canDrag = _ref.canDrag,
72
- editorAnalyticsAPI = _ref.editorAnalyticsAPI;
73
- var tableMap = tableNode ? TableMap.get(tableNode) : undefined;
87
+ editorAnalyticsAPI = _ref.editorAnalyticsAPI,
88
+ pluginConfig = _ref.pluginConfig;
74
89
  var state = editorView.state,
75
90
  dispatch = editorView.dispatch;
76
91
  var selection = state.selection;
92
+ var tableMap = tableNode ? TableMap.get(tableNode) : undefined;
93
+ var _useState = useState(false),
94
+ _useState2 = _slicedToArray(_useState, 2),
95
+ isSubmenuOpen = _useState2[0],
96
+ setIsSubmenuOpen = _useState2[1];
77
97
  var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
78
98
  var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
79
99
  var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
80
100
  var hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
101
+ var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
81
102
  var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
82
103
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig),
83
104
  menuItems = _convertToDropdownIte.menuItems,
84
105
  menuCallback = _convertToDropdownIte.menuCallback;
106
+ var handleSubMenuRef = function handleSubMenuRef(ref) {
107
+ var parent = closestElement(editorView.dom, '.fabric-editor-popup-scroll-parent');
108
+ if (!(parent && ref)) {
109
+ return;
110
+ }
111
+ var boundariesRect = parent.getBoundingClientRect();
112
+ var rect = ref.getBoundingClientRect();
113
+ if (rect.left + rect.width > boundariesRect.width) {
114
+ ref.style.left = "-".concat(rect.width, "px");
115
+ }
116
+ };
117
+ var setColor = function setColor(color) {
118
+ var _getTablePluginState = getTablePluginState(editorView.state),
119
+ targetCellPosition = _getTablePluginState.targetCellPosition;
120
+ var state = editorView.state,
121
+ dispatch = editorView.dispatch;
122
+ setColorWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, color, targetCellPosition)(state, dispatch);
123
+ closeMenu();
124
+ setIsSubmenuOpen(false);
125
+ };
126
+ var createBackgroundColorMenuItem = function createBackgroundColorMenuItem() {
127
+ var _node$attrs;
128
+ var _getTablePluginState2 = getTablePluginState(editorView.state),
129
+ targetCellPosition = _getTablePluginState2.targetCellPosition;
130
+ var node = targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
131
+ var background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
132
+ return {
133
+ content: 'Background color',
134
+ value: {
135
+ name: 'background'
136
+ },
137
+ elemBefore: jsx(EditorBackgroundColorIcon, {
138
+ label: 'background color',
139
+ size: "medium"
140
+ }),
141
+ elemAfter: jsx("div", {
142
+ className: DropdownMenuSharedCssClassName.SUBMENU,
143
+ css: dragMenuBackgroundColorStyles
144
+ }, jsx("div", {
145
+ css: cellColourPreviewStyles(background),
146
+ className: ClassName.DRAG_SUBMENU_ICON
147
+ }), isSubmenuOpen && jsx("div", {
148
+ className: ClassName.DRAG_SUBMENU,
149
+ ref: handleSubMenuRef
150
+ }, jsx(ColorPalette, {
151
+ cols: 7,
152
+ onClick: setColor,
153
+ selectedColor: background,
154
+ paletteOptions: {
155
+ palette: cellBackgroundColorPalette,
156
+ paletteColorTooltipMessages: backgroundPaletteTooltipMessages,
157
+ hexToPaletteColor: hexToEditorBackgroundPaletteColor
158
+ }
159
+ })))
160
+ };
161
+ };
162
+ var toggleHeaderColumn = function toggleHeaderColumn() {
163
+ toggleHeaderColumnWithAnalytics(editorAnalyticsAPI)(state, dispatch);
164
+ };
165
+ var toggleHeaderRow = function toggleHeaderRow() {
166
+ toggleHeaderRowWithAnalytics(editorAnalyticsAPI)(state, dispatch);
167
+ };
168
+ var toggleRowNumbers = function toggleRowNumbers() {
169
+ toggleNumberColumnWithAnalytics(editorAnalyticsAPI)(state, dispatch);
170
+ };
171
+ var createhHeaderRowColumnMenuItem = function createhHeaderRowColumnMenuItem(direction) {
172
+ return direction === 'column' ? {
173
+ content: 'Header column',
174
+ value: {
175
+ name: 'header_column'
176
+ },
177
+ elemAfter: jsx("div", {
178
+ css: toggleStyles
179
+ }, jsx(Toggle, {
180
+ id: "toggle-header-column",
181
+ onChange: toggleHeaderColumn,
182
+ isChecked: checkIfHeaderColumnEnabled(selection)
183
+ }))
184
+ } : {
185
+ content: 'Header row',
186
+ value: {
187
+ name: 'header_row'
188
+ },
189
+ elemAfter: jsx("div", {
190
+ css: toggleStyles
191
+ }, jsx(Toggle, {
192
+ id: "toggle-header-row",
193
+ onChange: toggleHeaderRow,
194
+ isChecked: checkIfHeaderRowEnabled(selection)
195
+ }))
196
+ };
197
+ };
198
+ var createRowNumbersMenuItem = function createRowNumbersMenuItem() {
199
+ return {
200
+ content: 'Row numbers',
201
+ value: {
202
+ name: 'row_numbers'
203
+ },
204
+ elemAfter: jsx("div", {
205
+ css: toggleStyles
206
+ }, jsx(Toggle, {
207
+ id: "toggle-row-numbers",
208
+ onChange: toggleRowNumbers,
209
+ isChecked: checkIfNumberColumnEnabled(selection)
210
+ }))
211
+ };
212
+ };
85
213
 
86
214
  /**
87
215
  * This function is to check if the menu should be closed or not.
88
- * As when continously clicking on drag handle on different rows/columns,
216
+ * As when continously clicking on tyle handle on different rows/columns,
89
217
  * should open the menu corresponding to the position of the drag handle.
90
218
  * @returns true when the menu should be closed, false otherwise
91
219
  */
@@ -115,18 +243,42 @@ export var DragMenu = function DragMenu(_ref) {
115
243
  var _menuCallback$item$va;
116
244
  var item = _ref2.item;
117
245
  (_menuCallback$item$va = menuCallback[item.value.name]) === null || _menuCallback$item$va === void 0 || _menuCallback$item$va.call(menuCallback, state, dispatch);
118
- closeMenu();
246
+ switch (item.value.name) {
247
+ case 'header_column':
248
+ toggleHeaderColumn();
249
+ break;
250
+ case 'header_row':
251
+ toggleHeaderRow();
252
+ break;
253
+ case 'row_numbers':
254
+ toggleRowNumbers();
255
+ break;
256
+ default:
257
+ break;
258
+ }
259
+ if (['header_column', 'header_row', 'row_numbers', 'background'].indexOf(item.value.name) <= -1) {
260
+ closeMenu();
261
+ }
119
262
  };
120
263
  var handleItemMouseEnter = function handleItemMouseEnter(_ref3) {
121
264
  var _item$value$name;
122
265
  var item = _ref3.item;
123
- if (!selectionRect || !((_item$value$name = item.value.name) !== null && _item$value$name !== void 0 && _item$value$name.startsWith('delete'))) {
266
+ if (!selectionRect) {
267
+ return;
268
+ }
269
+ if (item.value.name === 'background' && !isSubmenuOpen) {
270
+ setIsSubmenuOpen(true);
271
+ }
272
+ if (!((_item$value$name = item.value.name) !== null && _item$value$name !== void 0 && _item$value$name.startsWith('delete'))) {
124
273
  return;
125
274
  }
126
275
  (item.value.name === 'delete_column' ? hoverColumns(getSelectedColumnIndexes(selectionRect), true) : hoverRows(getSelectedRowIndexes(selectionRect), true))(state, dispatch);
127
276
  };
128
277
  var handleItemMouseLeave = function handleItemMouseLeave(_ref4) {
129
278
  var item = _ref4.item;
279
+ if (item.value.name === 'background' && isSubmenuOpen) {
280
+ setIsSubmenuOpen(false);
281
+ }
130
282
  if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
131
283
  clearHoverSelection()(state, dispatch);
132
284
  }
@@ -134,6 +286,24 @@ export var DragMenu = function DragMenu(_ref) {
134
286
  if (!menuItems) {
135
287
  return null;
136
288
  }
289
+ if (allowBackgroundColor && getBooleanFF('platform.editor.table.new-cell-context-menu-styling')) {
290
+ menuItems[0].items.unshift(createBackgroundColorMenuItem());
291
+ }
292
+
293
+ // If first row, add toggle for Hearder row, default is true
294
+ // If first column, add toggle for Header column, default is false
295
+ if (getBooleanFF('platform.editor.table.new-cell-context-menu-styling') && index === 0) {
296
+ menuItems.push({
297
+ items: [createhHeaderRowColumnMenuItem(direction)]
298
+ });
299
+ }
300
+
301
+ // All rows, add toggle for numbered rows, default is false
302
+ if (getBooleanFF('platform.editor.table.new-cell-context-menu-styling') && direction === 'row') {
303
+ index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
304
+ items: [createRowNumbersMenuItem()]
305
+ });
306
+ }
137
307
  return jsx(DropdownMenu, {
138
308
  mountTo: mountPoint
139
309
  //This needs be removed when the a11y is completely handled
@@ -17,7 +17,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
17
17
  getEditorContainerWidth = _ref.getEditorContainerWidth,
18
18
  canDrag = _ref.canDrag,
19
19
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
20
- stickyHeaders = _ref.stickyHeaders;
20
+ stickyHeaders = _ref.stickyHeaders,
21
+ pluginConfig = _ref.pluginConfig;
21
22
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
22
23
  return null;
23
24
  }
@@ -55,7 +56,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
55
56
  targetCellPosition: targetCellPosition,
56
57
  getEditorContainerWidth: getEditorContainerWidth,
57
58
  canDrag: canDrag,
58
- editorAnalyticsAPI: editorAnalyticsAPI
59
+ editorAnalyticsAPI: editorAnalyticsAPI,
60
+ pluginConfig: pluginConfig
59
61
  }));
60
62
  };
61
63
  FloatingDragMenu.displayName = 'FloatingDragMenu';
@@ -0,0 +1,12 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { css } from '@emotion/react';
4
+ import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
5
+ import { N60A, N90 } from '@atlaskit/theme/colors';
6
+ import { TableCssClassName as ClassName } from '../../types';
7
+ import { dragMenuDropdownWidth } from '../consts';
8
+ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
9
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
10
+ };
11
+ export var dragMenuBackgroundColorStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
12
+ export var toggleStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n input[type='checkbox'] {\n width: 30px;\n height: 14px;\n pointer-events: initial;\n cursor: pointer;\n }\n > label {\n margin: 0px;\n pointer-events: none;\n > span {\n pointer-events: none;\n }\n }\n"])));
@@ -144,7 +144,7 @@ export var ColumnControls = function ColumnControls(_ref) {
144
144
 
145
145
  // this indexes are used to calculate the drag and drop source
146
146
  var indexes = isColumnsSelected ? isHover ? colIndexes : selectedColIndexes : colIndexes;
147
- return showCondition && /*#__PURE__*/React.createElement("div", {
147
+ return /*#__PURE__*/React.createElement("div", {
148
148
  key: type,
149
149
  style: {
150
150
  gridColumn: isSelecting ? selectedColumnPosition : gridColumnPosition,
@@ -156,7 +156,7 @@ export var ColumnControls = function ColumnControls(_ref) {
156
156
  zIndex: 99
157
157
  },
158
158
  "data-column-control-index": hoveredCell.colIndex,
159
- "data-testid": 'table-floating-column-control'
159
+ "data-testid": "table-floating-column-".concat(isSelecting ? selectedColIndexes[0] : colIndex, "-drag-handle")
160
160
  }, /*#__PURE__*/React.createElement(DragHandle, {
161
161
  isDragMenuTarget: !isHover,
162
162
  direction: "column",
@@ -130,7 +130,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
130
130
  var currentSelectionAppearance = isRowsSelected ? isInDanger ? 'danger' : 'selected' : hoveredAppearance;
131
131
  var isSelecting = isRowsSelected && !isHover;
132
132
  var indexes = isRowsSelected ? isHover ? rowIndexes : selectedRowIndexes : rowIndexes;
133
- return showCondition && /*#__PURE__*/React.createElement("div", {
133
+ return /*#__PURE__*/React.createElement("div", {
134
134
  key: type,
135
135
  style: {
136
136
  gridRow: isSelecting ? selectedRowPosition : gridRowPosition,
@@ -140,7 +140,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
140
140
  position: 'relative',
141
141
  right: '-0.5px'
142
142
  },
143
- "data-testid": 'table-floating-row-drag-handle'
143
+ "data-testid": "table-floating-row-".concat(isSelecting ? selectedRowIndexes[0] : rowIndex, "-drag-handle")
144
144
  }, /*#__PURE__*/React.createElement(DragHandle, {
145
145
  isDragMenuTarget: !isHover,
146
146
  direction: "row",
@@ -1,5 +1,6 @@
1
1
  import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
2
2
  import { akEditorTableBorder, akEditorTableBorderSelected, akEditorTableCellBlanketDeleted, akEditorTableCellBlanketSelected, akEditorTableHeaderCellBackground, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { B200, N0, N20, N200, N20A, N300, R300, R400, R75 } from '@atlaskit/theme/colors';
4
5
  import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
5
6
 
@@ -49,7 +50,7 @@ export var resizeHandlerAreaWidth = RESIZE_HANDLE_AREA_DECORATION_GAP / 3;
49
50
  export var resizeLineWidth = 2;
50
51
  export var resizeHandlerZIndex = columnControlsZIndex + akRichMediaResizeZIndex;
51
52
  export var contextualMenuTriggerSize = 16;
52
- export var contextualMenuDropdownWidth = 180;
53
+ export var contextualMenuDropdownWidth = getBooleanFF('platform.editor.table.drag-and-drop') ? 250 : 180;
53
54
  export var stickyRowZIndex = resizeHandlerZIndex + 2;
54
55
  export var stickyRowOffsetTop = 8;
55
56
  export var stickyHeaderBorderBottomWidth = 1;
@@ -1,8 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37;
3
3
  import { css } from '@emotion/react';
4
4
  import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
5
- import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
5
+ import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
  import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
8
8
  import { TableCssClassName as ClassName } from '../types';
@@ -112,6 +112,10 @@ export var resizeHandle = function resizeHandle() {
112
112
  };
113
113
 
114
114
  // Drag and Drop: drop target insert line
115
+ var tableCellColumnInsertLineStyles = css(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n content: ' ';\n position: absolute;\n height: calc(100% + ", "px);\n width: ", "px;\n z-index: ", ";\n"])), tableCellBorderWidth * 2, insertLineWidth, columnControlsZIndex * 2);
116
+ var tableCellRowInsertLineStyles = css(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n content: ' ';\n position: absolute;\n left: ", ";\n height: ", "px;\n width: calc(100% + ", "px);\n z-index: ", ";\n"])), "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, columnControlsZIndex * 2);
117
+ var insertLineActiveColor = css(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), tableBorderSelectedColor);
118
+ var insertLineInactiveColor = css(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"));
115
119
  export var insertLine = function insertLine() {
116
- return css(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n .", " {\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -1px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n bottom: 0;\n height: ", "px;\n width: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n bottom: 0;\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_LAST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_LAST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor, columnControlsZIndex * 2);
120
+ return css(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n .", " {\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineActiveColor, ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineInactiveColor, ClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor);
117
121
  };
@@ -453,7 +453,7 @@ export var createColumnLineResize = function createColumnLineResize(selection, c
453
453
  });
454
454
  }).filter(nonNullable);
455
455
  };
456
- export var createColumnInsertLine = function createColumnInsertLine(columnIndex, selection) {
456
+ export var createColumnInsertLine = function createColumnInsertLine(columnIndex, selection, hasMergedCells) {
457
457
  var table = findTable(selection);
458
458
  if (!table) {
459
459
  return [];
@@ -464,7 +464,12 @@ export var createColumnInsertLine = function createColumnInsertLine(columnIndex,
464
464
  if (isLastColumn) {
465
465
  columnIndex -= 1;
466
466
  }
467
- var decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
467
+ var decorationClassName;
468
+ if (hasMergedCells) {
469
+ decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE : ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE;
470
+ } else {
471
+ decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
472
+ }
468
473
  var cellPositions = makeArray(map.height).map(function (rowIndex) {
469
474
  return map.map[map.width * rowIndex + columnIndex];
470
475
  }).filter(function (cellPosition, rowIndex) {
@@ -493,7 +498,7 @@ export var createColumnInsertLine = function createColumnInsertLine(columnIndex,
493
498
  });
494
499
  }).filter(nonNullable);
495
500
  };
496
- export var createRowInsertLine = function createRowInsertLine(rowIndex, selection) {
501
+ export var createRowInsertLine = function createRowInsertLine(rowIndex, selection, hasMergedCells) {
497
502
  var table = findTable(selection);
498
503
  if (!table) {
499
504
  return [];
@@ -507,7 +512,12 @@ export var createRowInsertLine = function createRowInsertLine(rowIndex, selectio
507
512
  if (!cells) {
508
513
  return [];
509
514
  }
510
- var decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
515
+ var decorationClassName;
516
+ if (hasMergedCells) {
517
+ decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE : ClassName.WITH_ROW_INSERT_LINE_INACTIVE;
518
+ } else {
519
+ decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
520
+ }
511
521
  return cells.map(function (cell, index) {
512
522
  if (!cell || !cell.node) {
513
523
  return;
@@ -0,0 +1,5 @@
1
+ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
2
+ import type { Direction } from '@atlaskit/editor-tables/src/types';
3
+ export declare const initiateKeyboardColumnResizing: Command;
4
+ export declare const activateNextResizeArea: (direction: Direction) => Command;
5
+ export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
@@ -6,7 +6,7 @@ import { TableDecorations } from '../../types';
6
6
  import { DropTargetType } from './consts';
7
7
  export declare const getDecorations: (state: EditorState) => DecorationSet;
8
8
  export declare const updatePluginStateDecorations: (state: EditorState, decorations: Decoration[], key: TableDecorations) => DecorationSet;
9
- export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
9
+ export declare const setDropTarget: (type: DropTargetType, index: number, hasMergedCells: boolean, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
10
10
  export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
11
11
  export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
12
12
  export declare const toggleDragMenu: (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number) => import("@atlaskit/editor-common/types").Command;
@@ -4,7 +4,7 @@ export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateCol
4
4
  export type { ColumnState } from './column-state';
5
5
  export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
6
6
  export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
7
- export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, } from './misc';
7
+ export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, } from './misc';
8
8
  export { updateControls, isClickNear, getResizeCellPos } from './dom';
9
9
  export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
10
10
  export type { ScaleOptions } from './scale-table';
@@ -305,6 +305,8 @@ export declare const TableCssClassName: {
305
305
  DRAG_HANDLE_DISABLED: string;
306
306
  /** minimised handle class */
307
307
  DRAG_HANDLE_MINIMISED: string;
308
+ DRAG_SUBMENU: string;
309
+ DRAG_SUBMENU_ICON: string;
308
310
  /** Other classes */
309
311
  NUMBERED_COLUMN: string;
310
312
  NUMBERED_COLUMN_BUTTON: string;
@@ -338,12 +340,17 @@ export declare const TableCssClassName: {
338
340
  TOP_LEFT_CELL: string;
339
341
  LAST_ITEM_IN_CELL: string;
340
342
  WITH_COLUMN_INSERT_LINE: string;
343
+ WITH_COLUMN_INSERT_LINE_INACTIVE: string;
341
344
  WITH_FIRST_COLUMN_INSERT_LINE: string;
345
+ WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: string;
342
346
  WITH_LAST_COLUMN_INSERT_LINE: string;
347
+ WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: string;
343
348
  WITH_RESIZE_LINE: string;
344
349
  WITH_RESIZE_LINE_LAST_COLUMN: string;
345
350
  WITH_ROW_INSERT_LINE: string;
351
+ WITH_ROW_INSERT_LINE_INACTIVE: string;
346
352
  WITH_LAST_ROW_INSERT_LINE: string;
353
+ WITH_LAST_ROW_INSERT_LINE_INACTIVE: string;
347
354
  TABLE_CONTAINER: string;
348
355
  TABLE_NODE_WRAPPER: string;
349
356
  TABLE_LEFT_SHADOW: string;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import { jsx } from '@emotion/react';
3
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
3
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
@@ -21,5 +20,5 @@ type DragMenuProps = {
21
20
  canDrag?: boolean;
22
21
  editorAnalyticsAPI?: EditorAnalyticsAPI;
23
22
  };
24
- export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, }: DragMenuProps) => jsx.JSX.Element | null;
23
+ export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, }: DragMenuProps) => jsx.JSX.Element | null;
25
24
  export {};
@@ -4,7 +4,7 @@ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
7
- import type { TableDirection } from '../../types';
7
+ import type { PluginConfig, TableDirection } from '../../types';
8
8
  export interface Props {
9
9
  editorView: EditorView;
10
10
  isOpen: boolean;
@@ -20,9 +20,10 @@ export interface Props {
20
20
  canDrag?: boolean;
21
21
  editorAnalyticsAPI?: EditorAnalyticsAPI;
22
22
  stickyHeaders?: RowStickyState;
23
+ pluginConfig?: PluginConfig;
23
24
  }
24
25
  declare const FloatingDragMenu: {
25
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, }: Props): JSX.Element | null;
26
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
26
27
  displayName: string;
27
28
  };
28
29
  export default FloatingDragMenu;
@@ -0,0 +1,3 @@
1
+ export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
+ export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const toggleStyles: import("@emotion/react").SerializedStyles;
@@ -40,7 +40,7 @@ export declare const resizeHandlerAreaWidth: number;
40
40
  export declare const resizeLineWidth = 2;
41
41
  export declare const resizeHandlerZIndex: number;
42
42
  export declare const contextualMenuTriggerSize = 16;
43
- export declare const contextualMenuDropdownWidth = 180;
43
+ export declare const contextualMenuDropdownWidth: number;
44
44
  export declare const stickyRowZIndex: number;
45
45
  export declare const stickyRowOffsetTop = 8;
46
46
  export declare const stickyHeaderBorderBottomWidth = 1;
@@ -14,5 +14,5 @@ export declare const createColumnControlsDecoration: (selection: Selection) => D
14
14
  export declare const updateDecorations: (node: PmNode, decorationSet: DecorationSet, decorations: Decoration[], key: TableDecorations) => DecorationSet;
15
15
  export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'>, includeTooltip: boolean | undefined, getIntl: () => IntlShape) => [Decoration[], Decoration[]];
16
16
  export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, 'left'>) => Decoration[];
17
- export declare const createColumnInsertLine: (columnIndex: number, selection: Selection) => Decoration[];
18
- export declare const createRowInsertLine: (rowIndex: number, selection: Selection) => Decoration[];
17
+ export declare const createColumnInsertLine: (columnIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
18
+ export declare const createRowInsertLine: (rowIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
@@ -0,0 +1,5 @@
1
+ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
2
+ import type { Direction } from '@atlaskit/editor-tables/src/types';
3
+ export declare const initiateKeyboardColumnResizing: Command;
4
+ export declare const activateNextResizeArea: (direction: Direction) => Command;
5
+ export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
@@ -6,7 +6,7 @@ import { TableDecorations } from '../../types';
6
6
  import { DropTargetType } from './consts';
7
7
  export declare const getDecorations: (state: EditorState) => DecorationSet;
8
8
  export declare const updatePluginStateDecorations: (state: EditorState, decorations: Decoration[], key: TableDecorations) => DecorationSet;
9
- export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
9
+ export declare const setDropTarget: (type: DropTargetType, index: number, hasMergedCells: boolean, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
10
10
  export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
11
11
  export declare const moveSource: (sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
12
12
  export declare const toggleDragMenu: (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number) => import("@atlaskit/editor-common/types").Command;
@@ -4,7 +4,7 @@ export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateCol
4
4
  export type { ColumnState } from './column-state';
5
5
  export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
6
6
  export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
7
- export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, } from './misc';
7
+ export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, } from './misc';
8
8
  export { updateControls, isClickNear, getResizeCellPos } from './dom';
9
9
  export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
10
10
  export type { ScaleOptions } from './scale-table';