@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.
- package/CHANGELOG.md +13 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/commands/column-resize.js +115 -45
- package/dist/cjs/commands/go-to-next-cell.js +7 -11
- package/dist/cjs/commands/misc.js +7 -4
- package/dist/cjs/commands/selection.js +7 -5
- package/dist/cjs/event-handlers.js +38 -25
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -1
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +33 -1
- package/dist/cjs/pm-plugins/drag-and-drop/reducer.js +2 -1
- package/dist/cjs/pm-plugins/keymap.js +1 -0
- package/dist/cjs/pm-plugins/main.js +43 -9
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
- package/dist/cjs/pm-plugins/table-selection-keymap.js +2 -2
- package/dist/cjs/reducer.js +5 -2
- package/dist/cjs/ui/DragHandle/HandleIconComponent.js +1 -3
- package/dist/cjs/ui/DragHandle/index.js +22 -10
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +75 -33
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +123 -0
- package/dist/cjs/ui/FloatingDragMenu/index.js +2 -2
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/ui/consts.js +3 -2
- package/dist/es2019/commands/column-resize.js +100 -35
- package/dist/es2019/commands/go-to-next-cell.js +7 -9
- package/dist/es2019/commands/misc.js +7 -6
- package/dist/es2019/commands/selection.js +9 -9
- package/dist/es2019/event-handlers.js +17 -3
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +34 -1
- package/dist/es2019/pm-plugins/drag-and-drop/reducer.js +2 -1
- package/dist/es2019/pm-plugins/keymap.js +3 -2
- package/dist/es2019/pm-plugins/main.js +41 -5
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
- package/dist/es2019/pm-plugins/table-selection-keymap.js +2 -2
- package/dist/es2019/reducer.js +5 -2
- package/dist/es2019/ui/DragHandle/HandleIconComponent.js +1 -3
- package/dist/es2019/ui/DragHandle/index.js +25 -10
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +72 -32
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +109 -0
- package/dist/es2019/ui/FloatingDragMenu/index.js +2 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
- package/dist/es2019/ui/common-styles.js +11 -1
- package/dist/es2019/ui/consts.js +2 -1
- package/dist/esm/commands/column-resize.js +105 -35
- package/dist/esm/commands/go-to-next-cell.js +7 -11
- package/dist/esm/commands/misc.js +7 -4
- package/dist/esm/commands/selection.js +9 -7
- package/dist/esm/event-handlers.js +38 -25
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -2
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +33 -1
- package/dist/esm/pm-plugins/drag-and-drop/reducer.js +2 -1
- package/dist/esm/pm-plugins/keymap.js +3 -2
- package/dist/esm/pm-plugins/main.js +38 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
- package/dist/esm/pm-plugins/table-selection-keymap.js +2 -2
- package/dist/esm/reducer.js +5 -2
- package/dist/esm/ui/DragHandle/HandleIconComponent.js +1 -3
- package/dist/esm/ui/DragHandle/index.js +21 -9
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +74 -35
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +116 -0
- package/dist/esm/ui/FloatingDragMenu/index.js +2 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +24 -35
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -2
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +4 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +26 -33
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/ui/consts.js +2 -1
- package/dist/types/commands/column-resize.d.ts +2 -0
- package/dist/types/commands/misc.d.ts +3 -3
- package/dist/types/commands/selection.d.ts +2 -2
- package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +2 -1
- package/dist/types/pm-plugins/drag-and-drop/types.d.ts +2 -0
- package/dist/types/types.d.ts +16 -0
- package/dist/types/ui/DragHandle/HandleIconComponent.d.ts +1 -2
- package/dist/types/ui/DragHandle/index.d.ts +3 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +7 -8
- package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +30 -0
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
- package/dist/types-ts4.5/commands/misc.d.ts +3 -3
- package/dist/types-ts4.5/commands/selection.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/types.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +16 -0
- package/dist/types-ts4.5/ui/DragHandle/HandleIconComponent.d.ts +1 -2
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +7 -8
- package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +30 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/package.json +4 -3
- package/src/commands/column-resize.ts +155 -40
- package/src/commands/go-to-next-cell.ts +6 -15
- package/src/commands/misc.ts +19 -4
- package/src/commands/selection.ts +17 -9
- package/src/event-handlers.ts +21 -4
- package/src/pm-plugins/drag-and-drop/actions.ts +1 -0
- package/src/pm-plugins/drag-and-drop/commands.ts +3 -0
- package/src/pm-plugins/drag-and-drop/plugin.ts +47 -0
- package/src/pm-plugins/drag-and-drop/reducer.ts +1 -0
- package/src/pm-plugins/drag-and-drop/types.ts +3 -0
- package/src/pm-plugins/keymap.ts +3 -0
- package/src/pm-plugins/main.ts +47 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
- package/src/pm-plugins/table-resizing/plugin.ts +18 -1
- package/src/pm-plugins/table-selection-keymap.ts +2 -2
- package/src/reducer.ts +5 -2
- package/src/types.ts +16 -0
- package/src/ui/DragHandle/HandleIconComponent.tsx +2 -9
- package/src/ui/DragHandle/index.tsx +37 -16
- package/src/ui/FloatingDragMenu/DragMenu.tsx +362 -310
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +150 -0
- package/src/ui/FloatingDragMenu/index.tsx +3 -3
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +72 -91
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -2
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +89 -104
- package/src/ui/common-styles.ts +11 -1
- package/src/ui/consts.ts +1 -0
- package/tsconfig.app.json +3 -0
|
@@ -7,7 +7,11 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
7
7
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
+
import { TableMap } from '@atlaskit/editor-tables';
|
|
11
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
13
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
14
|
+
import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
11
15
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
12
16
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
13
17
|
import { createTableView } from '../nodeviews/table';
|
|
@@ -99,7 +103,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
99
103
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
100
104
|
editorViewRef = editorView;
|
|
101
105
|
return {
|
|
102
|
-
update: function update(view) {
|
|
106
|
+
update: function update(view, prevState) {
|
|
103
107
|
var state = view.state,
|
|
104
108
|
dispatch = view.dispatch;
|
|
105
109
|
var selection = state.selection;
|
|
@@ -110,6 +114,28 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
110
114
|
if (parent) {
|
|
111
115
|
tableRef = parent.querySelector('table') || undefined;
|
|
112
116
|
}
|
|
117
|
+
var tableNode = findTable(state.selection);
|
|
118
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
119
|
+
// when cursor leaves the table we need to stop column resizing
|
|
120
|
+
var pluginPrevState = getPluginState(prevState);
|
|
121
|
+
var isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
122
|
+
if (isStopKeyboardColumResizing) {
|
|
123
|
+
var isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
|
|
124
|
+
if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
|
|
125
|
+
var oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
|
|
126
|
+
var newRowsNumber = TableMap.get(tableNode.node).height;
|
|
127
|
+
if (oldRowsNumber !== newRowsNumber ||
|
|
128
|
+
// Add/delete row
|
|
129
|
+
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
|
|
130
|
+
// Jump to another table
|
|
131
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
132
|
+
}
|
|
133
|
+
} else if (!tableNode) {
|
|
134
|
+
// selection outside of table
|
|
135
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
113
139
|
}
|
|
114
140
|
if (pluginState.tableRef !== tableRef) {
|
|
115
141
|
setTableRef(tableRef)(state, dispatch);
|
|
@@ -206,9 +232,17 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
206
232
|
var maybeTr = closestElement(domRef, 'tr');
|
|
207
233
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
208
234
|
},
|
|
209
|
-
handleTextInput: function handleTextInput(
|
|
210
|
-
var state =
|
|
211
|
-
dispatch =
|
|
235
|
+
handleTextInput: function handleTextInput(view, _from, _to, text) {
|
|
236
|
+
var state = view.state,
|
|
237
|
+
dispatch = view.dispatch;
|
|
238
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
239
|
+
var _getPluginState = getPluginState(state),
|
|
240
|
+
isKeyboardResize = _getPluginState.isKeyboardResize;
|
|
241
|
+
if (isKeyboardResize) {
|
|
242
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
212
246
|
var tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
|
|
213
247
|
if (tr.selectionSet) {
|
|
214
248
|
dispatch(tr);
|
|
@@ -5,9 +5,11 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
|
5
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { stopKeyboardColumnResizing } from '../../commands/column-resize';
|
|
8
9
|
import { updateResizeHandleDecorations } from '../../commands/misc';
|
|
9
10
|
import { updateColumnWidths } from '../../transforms';
|
|
10
11
|
import { getSelectedColumnIndexes } from '../../utils';
|
|
12
|
+
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
11
13
|
import { META_KEYS } from '../table-analytics';
|
|
12
14
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
15
|
import { getPluginState } from './plugin-factory';
|
|
@@ -20,6 +22,8 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
20
22
|
if (editorDisabled || localResizeHandlePos === null || !pointsAtCell(state.doc.resolve(localResizeHandlePos))) {
|
|
21
23
|
return false;
|
|
22
24
|
}
|
|
25
|
+
var _getTablePluginState = getTablePluginState(state),
|
|
26
|
+
isKeyboardResize = _getTablePluginState.isKeyboardResize;
|
|
23
27
|
event.preventDefault();
|
|
24
28
|
var tr = view.state.tr;
|
|
25
29
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
@@ -89,6 +93,8 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
89
93
|
var _getPluginState = getPluginState(state),
|
|
90
94
|
dragging = _getPluginState.dragging,
|
|
91
95
|
resizeHandlePos = _getPluginState.resizeHandlePos;
|
|
96
|
+
var _getTablePluginState2 = getTablePluginState(state),
|
|
97
|
+
isTableHovered = _getTablePluginState2.isTableHovered;
|
|
92
98
|
if (resizeHandlePos === null) {
|
|
93
99
|
return stopResizing()(state, dispatch);
|
|
94
100
|
}
|
|
@@ -101,9 +107,20 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
101
107
|
var start = $cell.start(-1);
|
|
102
108
|
var table = $cell.node(-1);
|
|
103
109
|
|
|
104
|
-
// If we let go in the same place we started,
|
|
110
|
+
// If we let go in the same place we started, don't need to do anything.
|
|
105
111
|
if (dragging && clientX === dragging.startX) {
|
|
106
|
-
|
|
112
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
113
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
114
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
115
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
116
|
+
*/
|
|
117
|
+
return stopKeyboardColumnResizing()(state, dispatch, view);
|
|
118
|
+
} else {
|
|
119
|
+
return stopResizing()(state, dispatch);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
return stopResizing()(state, dispatch);
|
|
123
|
+
}
|
|
107
124
|
}
|
|
108
125
|
var tr = state.tr;
|
|
109
126
|
if (dragging) {
|
|
@@ -137,7 +154,18 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
137
154
|
})(tr);
|
|
138
155
|
}
|
|
139
156
|
}
|
|
140
|
-
|
|
157
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
158
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
159
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
160
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
161
|
+
*/
|
|
162
|
+
return stopKeyboardColumnResizing(tr)(state, dispatch, view);
|
|
163
|
+
} else {
|
|
164
|
+
return stopResizing(tr)(state, dispatch);
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
return stopResizing(tr)(state, dispatch);
|
|
168
|
+
}
|
|
141
169
|
}
|
|
142
170
|
}
|
|
143
171
|
function move(event) {
|
|
@@ -147,7 +175,9 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
147
175
|
var _getPluginState2 = getPluginState(state),
|
|
148
176
|
dragging = _getPluginState2.dragging,
|
|
149
177
|
resizeHandlePos = _getPluginState2.resizeHandlePos;
|
|
150
|
-
|
|
178
|
+
var _getTablePluginState3 = getTablePluginState(state),
|
|
179
|
+
isTableHovered = _getTablePluginState3.isTableHovered;
|
|
180
|
+
if (!which || !dragging || resizeHandlePos === null || !pointsAtCell(state.doc.resolve(resizeHandlePos)) || !isTableHovered && getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
151
181
|
return finish(event);
|
|
152
182
|
}
|
|
153
183
|
var $cell = state.doc.resolve(resizeHandlePos);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
6
|
+
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
5
7
|
import { setResizeHandlePos } from './commands';
|
|
6
8
|
import { handleMouseDown } from './event-handlers';
|
|
7
9
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
@@ -34,7 +36,19 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
34
36
|
getPluginState(state).resizeHandlePos || getResizeCellPos(view, event);
|
|
35
37
|
var _getPluginState = getPluginState(state),
|
|
36
38
|
dragging = _getPluginState.dragging;
|
|
37
|
-
|
|
39
|
+
var isColumnKeyboardResizeStarted = false;
|
|
40
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
41
|
+
/*
|
|
42
|
+
We need to start listening mouse events if column resize started from keyboard.
|
|
43
|
+
This will allow continue resizing via mouse
|
|
44
|
+
*/
|
|
45
|
+
var _getTablePluginState = getTablePluginState(state),
|
|
46
|
+
isKeyboardResize = _getTablePluginState.isKeyboardResize;
|
|
47
|
+
if (isKeyboardResize) {
|
|
48
|
+
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
38
52
|
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI)) {
|
|
39
53
|
var _state = view.state,
|
|
40
54
|
_dispatch = view.dispatch;
|
|
@@ -7,8 +7,8 @@ export function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
|
7
7
|
bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
|
|
8
8
|
bindKeymapWithCommand(moveLeft.common, arrowLeftFromTable(editorSelectionAPI)(), list);
|
|
9
9
|
if (getBooleanFF('platform.editor.a11y.table-selection_9uv33')) {
|
|
10
|
-
bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI)(), list);
|
|
11
|
-
bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI)(), list);
|
|
10
|
+
bindKeymapArrayWithCommand(selectColumn, selectColumns(editorSelectionAPI)(true), list);
|
|
11
|
+
bindKeymapArrayWithCommand(selectRow, selectRows(editorSelectionAPI)(true), list);
|
|
12
12
|
}
|
|
13
13
|
if (getBooleanFF('platform.editor.table.shift-arrowup-fix')) {
|
|
14
14
|
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
package/dist/esm/reducer.js
CHANGED
|
@@ -57,8 +57,9 @@ export default (function (pluginState, action) {
|
|
|
57
57
|
resizeHandleColumnIndex: undefined,
|
|
58
58
|
resizeHandleRowIndex: undefined
|
|
59
59
|
});
|
|
60
|
+
case 'START_KEYBOARD_COLUMN_RESIZE':
|
|
60
61
|
case 'ADD_RESIZE_HANDLE_DECORATIONS':
|
|
61
|
-
if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip) {
|
|
62
|
+
if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip && action.data.isKeyboardResize === pluginState.isKeyboardResize) {
|
|
62
63
|
return pluginState;
|
|
63
64
|
}
|
|
64
65
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
@@ -77,6 +78,7 @@ export default (function (pluginState, action) {
|
|
|
77
78
|
resizeHandleRowIndex: resizeHandleRowIndex !== null && resizeHandleRowIndex !== void 0 ? resizeHandleRowIndex : pluginState.resizeHandleRowIndex,
|
|
78
79
|
resizeHandleIncludeTooltip: resizeHandleIncludeTooltip !== null && resizeHandleIncludeTooltip !== void 0 ? resizeHandleIncludeTooltip : pluginState.resizeHandleIncludeTooltip
|
|
79
80
|
});
|
|
81
|
+
case 'STOP_KEYBOARD_COLUMN_RESIZE':
|
|
80
82
|
case 'REMOVE_RESIZE_HANDLE_DECORATIONS':
|
|
81
83
|
if (!pluginState.isResizeHandleWidgetAdded) {
|
|
82
84
|
return pluginState;
|
|
@@ -84,7 +86,8 @@ export default (function (pluginState, action) {
|
|
|
84
86
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
85
87
|
resizeHandleColumnIndex: undefined,
|
|
86
88
|
resizeHandleRowIndex: undefined,
|
|
87
|
-
isResizeHandleWidgetAdded: false
|
|
89
|
+
isResizeHandleWidgetAdded: false,
|
|
90
|
+
isKeyboardResize: undefined
|
|
88
91
|
});
|
|
89
92
|
case 'SET_TABLE_REF':
|
|
90
93
|
case 'HOVER_ROWS':
|
|
@@ -2,10 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { DragHandleDisabledIcon, DragHandleIcon, MinimisedHandleIcon } from '../icons';
|
|
3
3
|
export var HandleIconComponent = function HandleIconComponent(props) {
|
|
4
4
|
var forceDefaultHandle = props.forceDefaultHandle,
|
|
5
|
-
|
|
6
|
-
isColumnHandleHovered = props.isColumnHandleHovered,
|
|
5
|
+
isHandleHovered = props.isHandleHovered,
|
|
7
6
|
hasMergedCells = props.hasMergedCells;
|
|
8
|
-
var isHandleHovered = isRowHandleHovered || isColumnHandleHovered;
|
|
9
7
|
if (isHandleHovered || forceDefaultHandle) {
|
|
10
8
|
return hasMergedCells ? /*#__PURE__*/React.createElement(DragHandleDisabledIcon, null) : /*#__PURE__*/React.createElement(DragHandleIcon, null);
|
|
11
9
|
}
|
|
@@ -8,6 +8,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
8
8
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
10
10
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
11
|
+
import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
|
|
11
12
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
12
13
|
import { TableCssClassName as ClassName } from '../../types';
|
|
13
14
|
import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
@@ -28,7 +29,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
28
29
|
previewHeight = _ref.previewHeight,
|
|
29
30
|
onMouseOver = _ref.onMouseOver,
|
|
30
31
|
onMouseOut = _ref.onMouseOut,
|
|
31
|
-
|
|
32
|
+
toggleDragMenu = _ref.toggleDragMenu,
|
|
32
33
|
onClick = _ref.onClick,
|
|
33
34
|
editorView = _ref.editorView,
|
|
34
35
|
formatMessage = _ref.intl.formatMessage;
|
|
@@ -37,10 +38,13 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
37
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
39
|
previewContainer = _useState2[0],
|
|
39
40
|
setPreviewContainer = _useState2[1];
|
|
40
|
-
var
|
|
41
|
+
var state = editorView.state,
|
|
42
|
+
selection = editorView.state.selection;
|
|
43
|
+
var _getPluginState = getPluginState(state),
|
|
41
44
|
hoveredColumns = _getPluginState.hoveredColumns,
|
|
42
45
|
hoveredRows = _getPluginState.hoveredRows;
|
|
43
|
-
var
|
|
46
|
+
var _getDnDPluginState = getDnDPluginState(state),
|
|
47
|
+
isDragMenuOpen = _getDnDPluginState.isDragMenuOpen;
|
|
44
48
|
var isRow = direction === 'row';
|
|
45
49
|
var isColumn = direction === 'column';
|
|
46
50
|
var isRowHandleHovered = isRow && hoveredRows.length > 0;
|
|
@@ -50,8 +54,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
50
54
|
}, [indexes, isRow, selection]);
|
|
51
55
|
var handleIconProps = {
|
|
52
56
|
forceDefaultHandle: forceDefaultHandle,
|
|
53
|
-
|
|
54
|
-
isRowHandleHovered: isRowHandleHovered,
|
|
57
|
+
isHandleHovered: isColumnHandleHovered || isRowHandleHovered,
|
|
55
58
|
hasMergedCells: hasMergedCells
|
|
56
59
|
};
|
|
57
60
|
useEffect(function () {
|
|
@@ -134,20 +137,29 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
134
137
|
},
|
|
135
138
|
"data-testid": "table-drag-handle-button",
|
|
136
139
|
"aria-label": formatMessage(isRow ? messages.rowDragHandle : messages.columnDragHandle),
|
|
140
|
+
"aria-expanded": isDragMenuOpen && isDragMenuTarget ? 'true' : 'false',
|
|
141
|
+
"aria-haspopup": "menu",
|
|
137
142
|
onMouseOver: onMouseOver,
|
|
138
143
|
onMouseOut: onMouseOut,
|
|
139
144
|
onMouseUp: function onMouseUp(e) {
|
|
140
145
|
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
141
146
|
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
142
147
|
editorView.focus();
|
|
143
|
-
|
|
148
|
+
toggleDragMenu && toggleDragMenu('mouse', e);
|
|
144
149
|
},
|
|
145
|
-
onClick: onClick
|
|
146
|
-
|
|
150
|
+
onClick: onClick,
|
|
151
|
+
onKeyDown: function onKeyDown(e) {
|
|
152
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
153
|
+
toggleDragMenu && toggleDragMenu('keyboard');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, appearance !== 'placeholder' ?
|
|
157
|
+
// cannot block pointer events in Firefox as it breaks Dragging functionality
|
|
158
|
+
browser.gecko ? /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps) : /*#__PURE__*/React.createElement("span", {
|
|
147
159
|
style: {
|
|
148
160
|
pointerEvents: 'none'
|
|
149
161
|
}
|
|
150
|
-
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps))), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
162
|
+
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps)) : null), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
151
163
|
direction: direction,
|
|
152
164
|
width: previewWidth,
|
|
153
165
|
height: previewHeight
|
|
@@ -2,14 +2,16 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
|
|
5
|
+
/** @jsxFrag */
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
6
7
|
import { jsx } from '@emotion/react';
|
|
7
8
|
import { injectIntl } from 'react-intl-next';
|
|
8
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
10
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
11
|
import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { backgroundPaletteTooltipMessages, cellBackgroundColorPalette, ColorPalette, getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
|
|
14
|
+
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
13
15
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
14
16
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
15
17
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
@@ -26,7 +28,8 @@ import { getPluginState as getTablePluginState } from '../../pm-plugins/plugin-f
|
|
|
26
28
|
import { TableCssClassName as ClassName } from '../../types';
|
|
27
29
|
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
28
30
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
29
|
-
import {
|
|
31
|
+
import { colorPalletteColumns } from '../consts';
|
|
32
|
+
import { DropdownMenu } from './DropdownMenu';
|
|
30
33
|
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, elementBeforeIconStyles, toggleStyles } from './styles';
|
|
31
34
|
var MapDragMenuOptionIdToMessage = {
|
|
32
35
|
add_row_above: {
|
|
@@ -157,17 +160,16 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
|
|
|
157
160
|
menuCallback: menuCallback
|
|
158
161
|
};
|
|
159
162
|
};
|
|
160
|
-
|
|
163
|
+
var ColorPaletteWithListeners = withOuterListeners(ColorPalette);
|
|
164
|
+
export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
161
165
|
var _pluginConfig$allowBa;
|
|
162
166
|
var _ref$direction = _ref.direction,
|
|
163
167
|
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
|
164
168
|
index = _ref.index,
|
|
169
|
+
target = _ref.target,
|
|
165
170
|
isOpen = _ref.isOpen,
|
|
166
171
|
editorView = _ref.editorView,
|
|
167
172
|
tableNode = _ref.tableNode,
|
|
168
|
-
mountPoint = _ref.mountPoint,
|
|
169
|
-
boundariesElement = _ref.boundariesElement,
|
|
170
|
-
scrollableElement = _ref.scrollableElement,
|
|
171
173
|
targetCellPosition = _ref.targetCellPosition,
|
|
172
174
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
173
175
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
@@ -181,6 +183,8 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
181
183
|
_useState2 = _slicedToArray(_useState, 2),
|
|
182
184
|
isSubmenuOpen = _useState2[0],
|
|
183
185
|
setIsSubmenuOpen = _useState2[1];
|
|
186
|
+
var _getPluginState = getPluginState(state),
|
|
187
|
+
isKeyboardModeActive = _getPluginState.isKeyboardModeActive;
|
|
184
188
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
185
189
|
var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
186
190
|
var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
@@ -216,7 +220,11 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
216
220
|
targetCellPosition = _getTablePluginState2.targetCellPosition;
|
|
217
221
|
var node = targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
218
222
|
var background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
223
|
+
var _getSelectedRowAndCol = getSelectedRowAndColumnFromPalette(cellBackgroundColorPalette, background, colorPalletteColumns),
|
|
224
|
+
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
225
|
+
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
219
226
|
return {
|
|
227
|
+
key: 'background',
|
|
220
228
|
content: formatMessage(messages.backgroundColor),
|
|
221
229
|
value: {
|
|
222
230
|
name: 'background'
|
|
@@ -236,16 +244,33 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
236
244
|
}), isSubmenuOpen && jsx("div", {
|
|
237
245
|
className: ClassName.DRAG_SUBMENU,
|
|
238
246
|
ref: handleSubMenuRef
|
|
239
|
-
}, jsx(
|
|
240
|
-
|
|
241
|
-
|
|
247
|
+
}, jsx(ArrowKeyNavigationProvider, {
|
|
248
|
+
type: ArrowKeyNavigationType.COLOR,
|
|
249
|
+
selectedRowIndex: selectedRowIndex,
|
|
250
|
+
selectedColumnIndex: selectedColumnIndex,
|
|
251
|
+
handleClose: function handleClose() {
|
|
252
|
+
var keyboardEvent = new KeyboardEvent('keydown', {
|
|
253
|
+
key: 'ArrowDown',
|
|
254
|
+
bubbles: true
|
|
255
|
+
});
|
|
256
|
+
setIsSubmenuOpen(false);
|
|
257
|
+
target === null || target === void 0 || target.focus();
|
|
258
|
+
target === null || target === void 0 || target.dispatchEvent(keyboardEvent);
|
|
259
|
+
},
|
|
260
|
+
isPopupPositioned: true,
|
|
261
|
+
isOpenedByKeyboard: isKeyboardModeActive
|
|
262
|
+
}, jsx(ColorPaletteWithListeners, {
|
|
263
|
+
cols: colorPalletteColumns,
|
|
264
|
+
onClick: function onClick(color) {
|
|
265
|
+
setColor(color);
|
|
266
|
+
},
|
|
242
267
|
selectedColor: background,
|
|
243
268
|
paletteOptions: {
|
|
244
269
|
palette: cellBackgroundColorPalette,
|
|
245
270
|
paletteColorTooltipMessages: backgroundPaletteTooltipMessages,
|
|
246
271
|
hexToPaletteColor: hexToEditorBackgroundPaletteColor
|
|
247
272
|
}
|
|
248
|
-
})))
|
|
273
|
+
}))))
|
|
249
274
|
};
|
|
250
275
|
};
|
|
251
276
|
var toggleHeaderColumn = function toggleHeaderColumn() {
|
|
@@ -257,8 +282,9 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
257
282
|
var toggleRowNumbers = function toggleRowNumbers() {
|
|
258
283
|
toggleNumberColumnWithAnalytics(editorAnalyticsAPI)(state, dispatch);
|
|
259
284
|
};
|
|
260
|
-
var
|
|
285
|
+
var createHeaderRowColumnMenuItem = function createHeaderRowColumnMenuItem(direction) {
|
|
261
286
|
return direction === 'column' ? {
|
|
287
|
+
key: 'header_column',
|
|
262
288
|
content: formatMessage(messages.headerColumn),
|
|
263
289
|
value: {
|
|
264
290
|
name: 'header_column'
|
|
@@ -271,6 +297,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
271
297
|
isChecked: checkIfHeaderColumnEnabled(selection)
|
|
272
298
|
}))
|
|
273
299
|
} : {
|
|
300
|
+
key: 'header_row',
|
|
274
301
|
content: formatMessage(messages.headerRow),
|
|
275
302
|
value: {
|
|
276
303
|
name: 'header_row'
|
|
@@ -286,6 +313,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
286
313
|
};
|
|
287
314
|
var createRowNumbersMenuItem = function createRowNumbersMenuItem() {
|
|
288
315
|
return {
|
|
316
|
+
key: 'row_numbers',
|
|
289
317
|
content: formatMessage(messages.rowNumbers),
|
|
290
318
|
value: {
|
|
291
319
|
name: 'row_numbers'
|
|
@@ -307,10 +335,10 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
307
335
|
* @returns true when the menu should be closed, false otherwise
|
|
308
336
|
*/
|
|
309
337
|
var shouldCloseMenu = function shouldCloseMenu(state) {
|
|
310
|
-
var
|
|
311
|
-
previousOpenState =
|
|
312
|
-
previousDragMenuDirection =
|
|
313
|
-
previousDragMenuIndex =
|
|
338
|
+
var _getPluginState2 = getPluginState(state),
|
|
339
|
+
previousOpenState = _getPluginState2.isDragMenuOpen,
|
|
340
|
+
previousDragMenuDirection = _getPluginState2.dragMenuDirection,
|
|
341
|
+
previousDragMenuIndex = _getPluginState2.dragMenuIndex;
|
|
314
342
|
|
|
315
343
|
// menu open but menu direction changed, means user clicked on drag handle of different row/column
|
|
316
344
|
// menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
|
|
@@ -322,9 +350,15 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
322
350
|
}
|
|
323
351
|
};
|
|
324
352
|
var closeMenu = function closeMenu() {
|
|
353
|
+
var focusTarget = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'handle';
|
|
325
354
|
var state = editorView.state,
|
|
326
355
|
dispatch = editorView.dispatch;
|
|
327
356
|
if (shouldCloseMenu(state)) {
|
|
357
|
+
if (target && focusTarget === 'handle') {
|
|
358
|
+
target === null || target === void 0 || target.focus();
|
|
359
|
+
} else {
|
|
360
|
+
editorView.dom.focus();
|
|
361
|
+
}
|
|
328
362
|
toggleDragMenu(false, direction, index)(state, dispatch);
|
|
329
363
|
}
|
|
330
364
|
};
|
|
@@ -333,6 +367,9 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
333
367
|
var item = _ref2.item;
|
|
334
368
|
(_menuCallback$item$va = menuCallback[item.value.name]) === null || _menuCallback$item$va === void 0 || _menuCallback$item$va.call(menuCallback, state, dispatch);
|
|
335
369
|
switch (item.value.name) {
|
|
370
|
+
case 'background':
|
|
371
|
+
setIsSubmenuOpen(!isSubmenuOpen);
|
|
372
|
+
break;
|
|
336
373
|
case 'header_column':
|
|
337
374
|
toggleHeaderColumn();
|
|
338
375
|
break;
|
|
@@ -346,7 +383,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
346
383
|
break;
|
|
347
384
|
}
|
|
348
385
|
if (['header_column', 'header_row', 'row_numbers', 'background'].indexOf(item.value.name) <= -1) {
|
|
349
|
-
closeMenu();
|
|
386
|
+
closeMenu('editor');
|
|
350
387
|
}
|
|
351
388
|
};
|
|
352
389
|
var handleItemMouseEnter = function handleItemMouseEnter(_ref3) {
|
|
@@ -372,6 +409,17 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
372
409
|
clearHoverSelection()(state, dispatch);
|
|
373
410
|
}
|
|
374
411
|
};
|
|
412
|
+
useEffect(function () {
|
|
413
|
+
// focus on first menu item automatically when menu renders
|
|
414
|
+
// and user is using keyboard
|
|
415
|
+
if (isOpen && target && isKeyboardModeActive) {
|
|
416
|
+
var keyboardEvent = new KeyboardEvent('keydown', {
|
|
417
|
+
key: 'ArrowDown',
|
|
418
|
+
bubbles: true
|
|
419
|
+
});
|
|
420
|
+
target.dispatchEvent(keyboardEvent);
|
|
421
|
+
}
|
|
422
|
+
}, [isOpen, target, isKeyboardModeActive]);
|
|
375
423
|
if (!menuItems) {
|
|
376
424
|
return null;
|
|
377
425
|
}
|
|
@@ -379,11 +427,11 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
379
427
|
menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
380
428
|
}
|
|
381
429
|
|
|
382
|
-
// If first row, add toggle for
|
|
430
|
+
// If first row, add toggle for Header row, default is true
|
|
383
431
|
// If first column, add toggle for Header column, default is false
|
|
384
432
|
if (getBooleanFF('platform.editor.table.new-cell-context-menu-styling') && index === 0) {
|
|
385
433
|
menuItems.push({
|
|
386
|
-
items: [
|
|
434
|
+
items: [createHeaderRowColumnMenuItem(direction)]
|
|
387
435
|
});
|
|
388
436
|
}
|
|
389
437
|
|
|
@@ -394,25 +442,16 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
394
442
|
});
|
|
395
443
|
}
|
|
396
444
|
return jsx(DropdownMenu, {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
,
|
|
401
|
-
arrowKeyNavigationProviderOptions: {
|
|
402
|
-
type: ArrowKeyNavigationType.MENU,
|
|
403
|
-
disableArrowKeyNavigation: true
|
|
445
|
+
disableKeyboardHandling: isSubmenuOpen,
|
|
446
|
+
section: {
|
|
447
|
+
hasSeparator: true
|
|
404
448
|
},
|
|
449
|
+
target: target,
|
|
405
450
|
items: menuItems,
|
|
406
|
-
isOpen: isOpen,
|
|
407
|
-
onOpenChange: closeMenu,
|
|
408
451
|
onItemActivated: handleMenuItemActivated,
|
|
409
452
|
onMouseEnter: handleItemMouseEnter,
|
|
410
453
|
onMouseLeave: handleItemMouseLeave,
|
|
411
|
-
|
|
412
|
-
boundariesElement: boundariesElement,
|
|
413
|
-
section: {
|
|
414
|
-
hasSeparator: true
|
|
415
|
-
}
|
|
454
|
+
handleClose: closeMenu
|
|
416
455
|
});
|
|
417
|
-
};
|
|
456
|
+
});
|
|
418
457
|
export default injectIntl(DragMenu);
|