@atlaskit/editor-plugin-table 5.7.5 → 5.7.7
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/dist/cjs/commands-with-analytics.js +29 -5
- package/dist/cjs/plugin.js +54 -52
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +49 -4
- package/dist/cjs/pm-plugins/keymap.js +13 -1
- package/dist/cjs/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/utils/drag-menu.js +14 -7
- package/dist/es2019/commands-with-analytics.js +26 -1
- package/dist/es2019/plugin.js +6 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +46 -2
- package/dist/es2019/pm-plugins/keymap.js +15 -3
- package/dist/es2019/ui/FloatingInsertButton/index.js +2 -2
- package/dist/es2019/ui/common-styles.js +3 -2
- package/dist/es2019/utils/drag-menu.js +15 -8
- package/dist/esm/commands-with-analytics.js +29 -5
- package/dist/esm/plugin.js +54 -52
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +47 -2
- package/dist/esm/pm-plugins/keymap.js +15 -3
- package/dist/esm/ui/FloatingInsertButton/index.js +2 -2
- package/dist/esm/ui/common-styles.js +2 -2
- package/dist/esm/utils/drag-menu.js +15 -8
- package/dist/types/commands-with-analytics.d.ts +3 -2
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +7 -5
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +7 -5
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/package.json +6 -6
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +6 -6
- package/src/commands-with-analytics.ts +39 -2
- package/src/plugin.tsx +10 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +85 -7
- package/src/pm-plugins/keymap.ts +52 -0
- package/src/ui/FloatingInsertButton/index.tsx +2 -4
- package/src/ui/common-styles.ts +2 -2
- package/src/utils/drag-menu.ts +13 -1
|
@@ -6,7 +6,7 @@ import { clearMultipleCells } from './commands/clear';
|
|
|
6
6
|
import { wrapTableInExpand } from './commands/collapse';
|
|
7
7
|
import { deleteColumnsCommand } from './commands/delete';
|
|
8
8
|
import { insertColumn, insertRow } from './commands/insert';
|
|
9
|
-
import { deleteTable, deleteTableIfSelected, setMultipleCellAttrs } from './commands/misc';
|
|
9
|
+
import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs } from './commands/misc';
|
|
10
10
|
import { sortByColumn } from './commands/sort';
|
|
11
11
|
import { splitCell } from './commands/split-cell';
|
|
12
12
|
import { getNextLayout, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './commands/toggle';
|
|
@@ -232,6 +232,31 @@ export const deleteColumnsWithAnalytics = editorAnalyticsAPI => (inputMethod, re
|
|
|
232
232
|
eventType: EVENT_TYPE.TRACK
|
|
233
233
|
};
|
|
234
234
|
})(editorAnalyticsAPI)(deleteColumnsCommand(rect));
|
|
235
|
+
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = editorAnalyticsAPI => (state, dispatch) => {
|
|
236
|
+
const {
|
|
237
|
+
selection
|
|
238
|
+
} = state;
|
|
239
|
+
const isCellSelection = selection instanceof CellSelection;
|
|
240
|
+
if (!isCellSelection) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
const rect = getSelectionRect(selection);
|
|
244
|
+
if (!rect) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
const selectionType = getTableSelectionType(selection);
|
|
248
|
+
if (selectionType === 'row') {
|
|
249
|
+
const {
|
|
250
|
+
pluginConfig
|
|
251
|
+
} = getPluginState(state);
|
|
252
|
+
const isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
|
|
253
|
+
return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
|
|
254
|
+
} else if (selectionType === 'column') {
|
|
255
|
+
return deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
|
|
256
|
+
} else {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
235
260
|
const getTableDeletedAnalytics = (selection, inputMethod) => {
|
|
236
261
|
const {
|
|
237
262
|
totalRowCount,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -140,7 +140,12 @@ const tablesPlugin = ({
|
|
|
140
140
|
// plugin as it is currently swallowing backspace events inside tables
|
|
141
141
|
{
|
|
142
142
|
name: 'tableKeymap',
|
|
143
|
-
plugin: () =>
|
|
143
|
+
plugin: () => {
|
|
144
|
+
const {
|
|
145
|
+
dragAndDropEnabled
|
|
146
|
+
} = options || {};
|
|
147
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled);
|
|
148
|
+
}
|
|
144
149
|
}, {
|
|
145
150
|
name: 'tableSelectionKeymap',
|
|
146
151
|
plugin: () => tableSelectionKeymapPlugin(api === null || api === void 0 ? void 0 : api.selection)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import {
|
|
1
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
+
import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
3
5
|
import { withEditorAnalyticsAPI } from '../../utils/analytics';
|
|
4
6
|
import { clearDropTarget, moveSource } from './commands';
|
|
5
7
|
export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, status, tr) => {
|
|
@@ -63,4 +65,46 @@ export const moveSourceWithAnalytics = editorAnalyticsAPI => (inputMethod, sourc
|
|
|
63
65
|
}
|
|
64
66
|
return true;
|
|
65
67
|
});
|
|
68
|
+
};
|
|
69
|
+
export const moveSourceWithAnalyticsViaShortcut = editorAnalyticsAPI => (sourceType, direction) => (state, dispatch) => {
|
|
70
|
+
const {
|
|
71
|
+
selection
|
|
72
|
+
} = state;
|
|
73
|
+
const isCellSelection = selection instanceof CellSelection;
|
|
74
|
+
const selectionRect = isCellSelection ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
75
|
+
if (!selectionRect) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const isRow = sourceType === 'table-row';
|
|
79
|
+
const selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
|
|
80
|
+
|
|
81
|
+
// We can move if only one row/column selected
|
|
82
|
+
if (selectedIndexes.length === 0 || selectedIndexes.length > 1) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const sourceIndex = selectedIndexes[0];
|
|
86
|
+
// we can move only by one row/column
|
|
87
|
+
// 'direction' can only be 1 (for right or down) or -1 (for left or up)
|
|
88
|
+
const targetIndex = sourceIndex + direction;
|
|
89
|
+
|
|
90
|
+
// We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
|
|
91
|
+
const {
|
|
92
|
+
totalRowCount,
|
|
93
|
+
totalColumnCount
|
|
94
|
+
} = getSelectedTableInfo(selection);
|
|
95
|
+
const isValidTargetIndex = targetIndex < 0 ? false : isRow ? targetIndex <= totalRowCount - 1 : targetIndex <= totalColumnCount - 1;
|
|
96
|
+
if (!isValidTargetIndex) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// We can move only if there are no merged cells in the source or target row/column
|
|
101
|
+
const hasMergedCellsInSource = isRow ? hasMergedCellsInRow(sourceIndex)(selection) : hasMergedCellsInColumn(sourceIndex)(selection);
|
|
102
|
+
if (hasMergedCellsInSource) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const hasMergedCellsInTarget = isRow ? hasMergedCellsInRow(targetIndex)(selection) : hasMergedCellsInColumn(targetIndex)(selection);
|
|
106
|
+
if (hasMergedCellsInTarget) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, sourceIndex, targetIndex)(state, dispatch);
|
|
66
110
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
|
|
6
|
-
import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
6
|
+
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
7
7
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
8
|
+
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
8
9
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
9
10
|
const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
|
|
10
11
|
action: ACTION.INSERTED,
|
|
@@ -15,7 +16,7 @@ const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
|
|
|
15
16
|
},
|
|
16
17
|
eventType: EVENT_TYPE.TRACK
|
|
17
18
|
})(editorAnalyticsAPI)(createTable());
|
|
18
|
-
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
19
|
+
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
19
20
|
const list = {};
|
|
20
21
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
|
|
21
22
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
|
|
@@ -28,6 +29,17 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
|
28
29
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
29
30
|
bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
|
|
30
31
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
|
|
32
|
+
if (dragAndDropEnabled) {
|
|
33
|
+
// Move row/column shortcuts
|
|
34
|
+
bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1), list);
|
|
35
|
+
bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1), list);
|
|
36
|
+
bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1), list);
|
|
37
|
+
bindKeymapWithCommand(moveColumnRight.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', 1), list);
|
|
38
|
+
|
|
39
|
+
// Delete row/column shortcuts
|
|
40
|
+
bindKeymapWithCommand(deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
41
|
+
bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
42
|
+
}
|
|
31
43
|
return keymap(list);
|
|
32
44
|
}
|
|
33
45
|
export default keymapPlugin;
|
|
@@ -6,7 +6,7 @@ import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } f
|
|
|
6
6
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
11
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -106,7 +106,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
106
106
|
// By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
|
|
107
107
|
// Only when inserting a column, otherwise set to undefined
|
|
108
108
|
// Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
|
|
109
|
-
const zIndex = type === 'column' ?
|
|
109
|
+
const zIndex = type === 'column' ? akEditorTableCellOnStickyHeaderZIndex : undefined;
|
|
110
110
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
111
111
|
target: targetCellRef,
|
|
112
112
|
mountTo: tableContainerWrapper || mountPoint,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
@@ -943,7 +943,8 @@ export const tableStyles = props => css`
|
|
|
943
943
|
|
|
944
944
|
.${ClassName.TABLE_STICKY} .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
945
945
|
position: fixed;
|
|
946
|
-
|
|
946
|
+
/* higher zIndex than sticky header which is akEditorTableCellOnStickyHeaderZIndex - 5 */
|
|
947
|
+
z-index: ${akEditorTableCellOnStickyHeaderZIndex - 4};
|
|
947
948
|
}
|
|
948
949
|
|
|
949
950
|
${tableWrapperStyles()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
3
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
5
5
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
6
6
|
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
@@ -55,7 +55,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
55
55
|
label: 'up',
|
|
56
56
|
offset: -1,
|
|
57
57
|
canMove: index => canDrag && canDecrease(index),
|
|
58
|
-
icon: ArrowUpIcon
|
|
58
|
+
icon: ArrowUpIcon,
|
|
59
|
+
keymap: moveRowUp
|
|
59
60
|
}, {
|
|
60
61
|
label: 'down',
|
|
61
62
|
offset: 1,
|
|
@@ -63,12 +64,14 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
63
64
|
var _tableMap$height;
|
|
64
65
|
return canDrag && canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
65
66
|
},
|
|
66
|
-
icon: ArrowDownIcon
|
|
67
|
+
icon: ArrowDownIcon,
|
|
68
|
+
keymap: moveRowDown
|
|
67
69
|
}] : [{
|
|
68
70
|
label: 'left',
|
|
69
71
|
offset: -1,
|
|
70
72
|
canMove: index => canDrag && canDecrease(index),
|
|
71
|
-
icon: ArrowLeftIcon
|
|
73
|
+
icon: ArrowLeftIcon,
|
|
74
|
+
keymap: moveColumnLeft
|
|
72
75
|
}, {
|
|
73
76
|
label: 'right',
|
|
74
77
|
offset: 1,
|
|
@@ -76,7 +79,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
76
79
|
var _tableMap$width;
|
|
77
80
|
return canDrag && canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
78
81
|
},
|
|
79
|
-
icon: ArrowRightIcon
|
|
82
|
+
icon: ArrowRightIcon,
|
|
83
|
+
keymap: moveColumnRight
|
|
80
84
|
}];
|
|
81
85
|
const sortOptions = direction === 'column' ? [{
|
|
82
86
|
label: 'increasing',
|
|
@@ -146,12 +150,14 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
146
150
|
}
|
|
147
151
|
return true;
|
|
148
152
|
},
|
|
149
|
-
icon: RemoveIcon
|
|
153
|
+
icon: RemoveIcon,
|
|
154
|
+
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
150
155
|
}, ...moveOptions.map(({
|
|
151
156
|
label,
|
|
152
157
|
offset,
|
|
153
158
|
canMove,
|
|
154
|
-
icon
|
|
159
|
+
icon,
|
|
160
|
+
keymap
|
|
155
161
|
}) => ({
|
|
156
162
|
id: `move_${direction}_${label}`,
|
|
157
163
|
title: `Move ${direction} ${label}`,
|
|
@@ -165,7 +171,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
165
171
|
return true;
|
|
166
172
|
}
|
|
167
173
|
return false;
|
|
168
|
-
}
|
|
174
|
+
},
|
|
175
|
+
keymap: keymap && tooltip(keymap)
|
|
169
176
|
})), ...sortOptions.map(({
|
|
170
177
|
label,
|
|
171
178
|
order,
|
|
@@ -9,7 +9,7 @@ import { clearMultipleCells } from './commands/clear';
|
|
|
9
9
|
import { wrapTableInExpand } from './commands/collapse';
|
|
10
10
|
import { deleteColumnsCommand } from './commands/delete';
|
|
11
11
|
import { insertColumn, insertRow } from './commands/insert';
|
|
12
|
-
import { deleteTable, deleteTableIfSelected, setMultipleCellAttrs } from './commands/misc';
|
|
12
|
+
import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs } from './commands/misc';
|
|
13
13
|
import { sortByColumn } from './commands/sort';
|
|
14
14
|
import { splitCell } from './commands/split-cell';
|
|
15
15
|
import { getNextLayout, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './commands/toggle';
|
|
@@ -254,6 +254,30 @@ export var deleteColumnsWithAnalytics = function deleteColumnsWithAnalytics(edit
|
|
|
254
254
|
})(editorAnalyticsAPI)(deleteColumnsCommand(rect));
|
|
255
255
|
};
|
|
256
256
|
};
|
|
257
|
+
export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI) {
|
|
258
|
+
return function (state, dispatch) {
|
|
259
|
+
var selection = state.selection;
|
|
260
|
+
var isCellSelection = selection instanceof CellSelection;
|
|
261
|
+
if (!isCellSelection) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
var rect = getSelectionRect(selection);
|
|
265
|
+
if (!rect) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
var selectionType = getTableSelectionType(selection);
|
|
269
|
+
if (selectionType === 'row') {
|
|
270
|
+
var _getPluginState = getPluginState(state),
|
|
271
|
+
pluginConfig = _getPluginState.pluginConfig;
|
|
272
|
+
var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
|
|
273
|
+
return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch);
|
|
274
|
+
} else if (selectionType === 'column') {
|
|
275
|
+
return deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
|
|
276
|
+
} else {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
};
|
|
257
281
|
var getTableDeletedAnalytics = function getTableDeletedAnalytics(selection, inputMethod) {
|
|
258
282
|
var _getSelectedTableInfo5 = getSelectedTableInfo(selection),
|
|
259
283
|
totalRowCount = _getSelectedTableInfo5.totalRowCount,
|
|
@@ -288,8 +312,8 @@ export var toggleHeaderRowWithAnalytics = function toggleHeaderRowWithAnalytics(
|
|
|
288
312
|
var _getSelectedTableInfo6 = getSelectedTableInfo(state.selection),
|
|
289
313
|
totalRowCount = _getSelectedTableInfo6.totalRowCount,
|
|
290
314
|
totalColumnCount = _getSelectedTableInfo6.totalColumnCount;
|
|
291
|
-
var
|
|
292
|
-
isHeaderRowEnabled =
|
|
315
|
+
var _getPluginState2 = getPluginState(state),
|
|
316
|
+
isHeaderRowEnabled = _getPluginState2.isHeaderRowEnabled;
|
|
293
317
|
return {
|
|
294
318
|
action: TABLE_ACTION.TOGGLED_HEADER_ROW,
|
|
295
319
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -308,8 +332,8 @@ export var toggleHeaderColumnWithAnalytics = function toggleHeaderColumnWithAnal
|
|
|
308
332
|
var _getSelectedTableInfo7 = getSelectedTableInfo(state.selection),
|
|
309
333
|
totalRowCount = _getSelectedTableInfo7.totalRowCount,
|
|
310
334
|
totalColumnCount = _getSelectedTableInfo7.totalColumnCount;
|
|
311
|
-
var
|
|
312
|
-
isHeaderColumnEnabled =
|
|
335
|
+
var _getPluginState3 = getPluginState(state),
|
|
336
|
+
isHeaderColumnEnabled = _getPluginState3.isHeaderColumnEnabled;
|
|
313
337
|
return {
|
|
314
338
|
action: TABLE_ACTION.TOGGLED_HEADER_COLUMN,
|
|
315
339
|
actionSubject: ACTION_SUBJECT.TABLE,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -141,7 +141,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
141
141
|
{
|
|
142
142
|
name: 'tableKeymap',
|
|
143
143
|
plugin: function plugin() {
|
|
144
|
-
|
|
144
|
+
var _ref6 = options || {},
|
|
145
|
+
dragAndDropEnabled = _ref6.dragAndDropEnabled;
|
|
146
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled);
|
|
145
147
|
}
|
|
146
148
|
}, {
|
|
147
149
|
name: 'tableSelectionKeymap',
|
|
@@ -151,12 +153,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
151
153
|
}, {
|
|
152
154
|
name: 'tableEditing',
|
|
153
155
|
plugin: function plugin() {
|
|
154
|
-
var
|
|
155
|
-
dragAndDropEnabled =
|
|
156
|
+
var _ref7 = options || {},
|
|
157
|
+
dragAndDropEnabled = _ref7.dragAndDropEnabled;
|
|
156
158
|
return tableEditing({
|
|
157
|
-
reportFixedTable: function reportFixedTable(
|
|
158
|
-
var tr =
|
|
159
|
-
reason =
|
|
159
|
+
reportFixedTable: function reportFixedTable(_ref8) {
|
|
160
|
+
var tr = _ref8.tr,
|
|
161
|
+
reason = _ref8.reason;
|
|
160
162
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
161
163
|
action: TABLE_ACTION.FIXED,
|
|
162
164
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -172,50 +174,50 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
172
174
|
}
|
|
173
175
|
}, {
|
|
174
176
|
name: 'tableStickyHeaders',
|
|
175
|
-
plugin: function plugin(
|
|
176
|
-
var dispatch =
|
|
177
|
-
eventDispatcher =
|
|
177
|
+
plugin: function plugin(_ref9) {
|
|
178
|
+
var dispatch = _ref9.dispatch,
|
|
179
|
+
eventDispatcher = _ref9.eventDispatcher;
|
|
178
180
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, function () {
|
|
179
181
|
return [];
|
|
180
182
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
181
183
|
}
|
|
182
184
|
}, {
|
|
183
185
|
name: 'tableDragAndDrop',
|
|
184
|
-
plugin: function plugin(
|
|
185
|
-
var dispatch =
|
|
186
|
-
eventDispatcher =
|
|
187
|
-
dispatchAnalyticsEvent =
|
|
186
|
+
plugin: function plugin(_ref10) {
|
|
187
|
+
var dispatch = _ref10.dispatch,
|
|
188
|
+
eventDispatcher = _ref10.eventDispatcher,
|
|
189
|
+
dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
|
|
188
190
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher, editorAnalyticsAPI) : undefined;
|
|
189
191
|
}
|
|
190
192
|
}, {
|
|
191
193
|
name: 'tableLocalId',
|
|
192
|
-
plugin: function plugin(
|
|
193
|
-
var dispatch =
|
|
194
|
+
plugin: function plugin(_ref11) {
|
|
195
|
+
var dispatch = _ref11.dispatch;
|
|
194
196
|
return createTableLocalIdPlugin(dispatch);
|
|
195
197
|
}
|
|
196
198
|
}, {
|
|
197
199
|
name: 'tableWidth',
|
|
198
|
-
plugin: function plugin(
|
|
200
|
+
plugin: function plugin(_ref12) {
|
|
199
201
|
var _options$fullWidthEna;
|
|
200
|
-
var dispatchAnalyticsEvent =
|
|
201
|
-
dispatch =
|
|
202
|
+
var dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent,
|
|
203
|
+
dispatch = _ref12.dispatch;
|
|
202
204
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
203
205
|
}
|
|
204
206
|
},
|
|
205
207
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
206
208
|
{
|
|
207
209
|
name: 'tableOverflowAnalyticsPlugin',
|
|
208
|
-
plugin: function plugin(
|
|
210
|
+
plugin: function plugin(_ref13) {
|
|
209
211
|
var _options$tableResizin;
|
|
210
|
-
var dispatch =
|
|
211
|
-
dispatchAnalyticsEvent =
|
|
212
|
+
var dispatch = _ref13.dispatch,
|
|
213
|
+
dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent;
|
|
212
214
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
213
215
|
}
|
|
214
216
|
}, {
|
|
215
217
|
name: 'tableAnalyticsPlugin',
|
|
216
|
-
plugin: function plugin(
|
|
217
|
-
var dispatch =
|
|
218
|
-
dispatchAnalyticsEvent =
|
|
218
|
+
plugin: function plugin(_ref14) {
|
|
219
|
+
var dispatch = _ref14.dispatch,
|
|
220
|
+
dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
|
|
219
221
|
return getBooleanFF('platform.editor.table.analytics-plugin-moved-event') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent) : undefined;
|
|
220
222
|
}
|
|
221
223
|
}, {
|
|
@@ -246,12 +248,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
246
248
|
}
|
|
247
249
|
return plugins;
|
|
248
250
|
},
|
|
249
|
-
contentComponent: function contentComponent(
|
|
250
|
-
var editorView =
|
|
251
|
-
popupsMountPoint =
|
|
252
|
-
popupsBoundariesElement =
|
|
253
|
-
popupsScrollableElement =
|
|
254
|
-
dispatchAnalyticsEvent =
|
|
251
|
+
contentComponent: function contentComponent(_ref15) {
|
|
252
|
+
var editorView = _ref15.editorView,
|
|
253
|
+
popupsMountPoint = _ref15.popupsMountPoint,
|
|
254
|
+
popupsBoundariesElement = _ref15.popupsBoundariesElement,
|
|
255
|
+
popupsScrollableElement = _ref15.popupsScrollableElement,
|
|
256
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
255
257
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
256
258
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
257
259
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -265,30 +267,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
265
267
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
266
268
|
dragAndDropState: dragAndDropPluginKey
|
|
267
269
|
},
|
|
268
|
-
render: function render(
|
|
269
|
-
var resizingPluginState =
|
|
270
|
-
stickyHeadersState =
|
|
271
|
-
tablePluginState =
|
|
272
|
-
tableWidthPluginState =
|
|
273
|
-
dragAndDropState =
|
|
270
|
+
render: function render(_ref16) {
|
|
271
|
+
var resizingPluginState = _ref16.tableResizingPluginState,
|
|
272
|
+
stickyHeadersState = _ref16.stickyHeadersState,
|
|
273
|
+
tablePluginState = _ref16.tablePluginState,
|
|
274
|
+
tableWidthPluginState = _ref16.tableWidthPluginState,
|
|
275
|
+
dragAndDropState = _ref16.dragAndDropState;
|
|
274
276
|
var state = editorView.state;
|
|
275
277
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
276
278
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
277
279
|
var isResizing = isColumnResizing || isTableResizing;
|
|
278
|
-
var
|
|
279
|
-
tableNode =
|
|
280
|
-
tablePos =
|
|
281
|
-
targetCellPosition =
|
|
282
|
-
isContextualMenuOpen =
|
|
283
|
-
layout =
|
|
284
|
-
tableRef =
|
|
285
|
-
pluginConfig =
|
|
286
|
-
insertColumnButtonIndex =
|
|
287
|
-
insertRowButtonIndex =
|
|
288
|
-
isHeaderColumnEnabled =
|
|
289
|
-
isHeaderRowEnabled =
|
|
290
|
-
isDragAndDropEnabled =
|
|
291
|
-
tableWrapperTarget =
|
|
280
|
+
var _ref17 = tablePluginState,
|
|
281
|
+
tableNode = _ref17.tableNode,
|
|
282
|
+
tablePos = _ref17.tablePos,
|
|
283
|
+
targetCellPosition = _ref17.targetCellPosition,
|
|
284
|
+
isContextualMenuOpen = _ref17.isContextualMenuOpen,
|
|
285
|
+
layout = _ref17.layout,
|
|
286
|
+
tableRef = _ref17.tableRef,
|
|
287
|
+
pluginConfig = _ref17.pluginConfig,
|
|
288
|
+
insertColumnButtonIndex = _ref17.insertColumnButtonIndex,
|
|
289
|
+
insertRowButtonIndex = _ref17.insertRowButtonIndex,
|
|
290
|
+
isHeaderColumnEnabled = _ref17.isHeaderColumnEnabled,
|
|
291
|
+
isHeaderRowEnabled = _ref17.isHeaderRowEnabled,
|
|
292
|
+
isDragAndDropEnabled = _ref17.isDragAndDropEnabled,
|
|
293
|
+
tableWrapperTarget = _ref17.tableWrapperTarget;
|
|
292
294
|
var allowControls = pluginConfig.allowControls;
|
|
293
295
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
294
296
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -369,8 +371,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
369
371
|
}));
|
|
370
372
|
},
|
|
371
373
|
pluginsOptions: {
|
|
372
|
-
quickInsert: function quickInsert(
|
|
373
|
-
var formatMessage =
|
|
374
|
+
quickInsert: function quickInsert(_ref18) {
|
|
375
|
+
var formatMessage = _ref18.formatMessage;
|
|
374
376
|
return [{
|
|
375
377
|
id: 'table',
|
|
376
378
|
title: formatMessage(messages.table),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import {
|
|
1
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
+
import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { getSelectedColumnIndexes, getSelectedRowIndexes, getSelectedTableInfo, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
3
5
|
import { withEditorAnalyticsAPI } from '../../utils/analytics';
|
|
4
6
|
import { clearDropTarget, moveSource } from './commands';
|
|
5
7
|
export var clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
|
|
@@ -63,4 +65,47 @@ export var moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnal
|
|
|
63
65
|
return true;
|
|
64
66
|
});
|
|
65
67
|
};
|
|
68
|
+
};
|
|
69
|
+
export var moveSourceWithAnalyticsViaShortcut = function moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI) {
|
|
70
|
+
return function (sourceType, direction) {
|
|
71
|
+
return function (state, dispatch) {
|
|
72
|
+
var selection = state.selection;
|
|
73
|
+
var isCellSelection = selection instanceof CellSelection;
|
|
74
|
+
var selectionRect = isCellSelection ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
75
|
+
if (!selectionRect) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
var isRow = sourceType === 'table-row';
|
|
79
|
+
var selectedIndexes = isRow ? getSelectedRowIndexes(selectionRect) : getSelectedColumnIndexes(selectionRect);
|
|
80
|
+
|
|
81
|
+
// We can move if only one row/column selected
|
|
82
|
+
if (selectedIndexes.length === 0 || selectedIndexes.length > 1) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
var sourceIndex = selectedIndexes[0];
|
|
86
|
+
// we can move only by one row/column
|
|
87
|
+
// 'direction' can only be 1 (for right or down) or -1 (for left or up)
|
|
88
|
+
var targetIndex = sourceIndex + direction;
|
|
89
|
+
|
|
90
|
+
// We can move only if targetIndex is a positive number and is not higher than the total number of rows/columns.
|
|
91
|
+
var _getSelectedTableInfo3 = getSelectedTableInfo(selection),
|
|
92
|
+
totalRowCount = _getSelectedTableInfo3.totalRowCount,
|
|
93
|
+
totalColumnCount = _getSelectedTableInfo3.totalColumnCount;
|
|
94
|
+
var isValidTargetIndex = targetIndex < 0 ? false : isRow ? targetIndex <= totalRowCount - 1 : targetIndex <= totalColumnCount - 1;
|
|
95
|
+
if (!isValidTargetIndex) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// We can move only if there are no merged cells in the source or target row/column
|
|
100
|
+
var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(sourceIndex)(selection) : hasMergedCellsInColumn(sourceIndex)(selection);
|
|
101
|
+
if (hasMergedCellsInSource) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
var hasMergedCellsInTarget = isRow ? hasMergedCellsInRow(targetIndex)(selection) : hasMergedCellsInColumn(targetIndex)(selection);
|
|
105
|
+
if (hasMergedCellsInTarget) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, sourceType, sourceIndex, targetIndex)(state, dispatch);
|
|
109
|
+
};
|
|
110
|
+
};
|
|
66
111
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
|
|
6
|
-
import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
6
|
+
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
7
7
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
8
|
+
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
8
9
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
9
10
|
var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
|
|
10
11
|
return withEditorAnalyticsAPI({
|
|
@@ -17,7 +18,7 @@ var createTableWithAnalytics = function createTableWithAnalytics(editorAnalytics
|
|
|
17
18
|
eventType: EVENT_TYPE.TRACK
|
|
18
19
|
})(editorAnalyticsAPI)(createTable());
|
|
19
20
|
};
|
|
20
|
-
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
21
|
+
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
21
22
|
var list = {};
|
|
22
23
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
|
|
23
24
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
|
|
@@ -30,6 +31,17 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
|
30
31
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
31
32
|
bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
|
|
32
33
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
|
|
34
|
+
if (dragAndDropEnabled) {
|
|
35
|
+
// Move row/column shortcuts
|
|
36
|
+
bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1), list);
|
|
37
|
+
bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1), list);
|
|
38
|
+
bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1), list);
|
|
39
|
+
bindKeymapWithCommand(moveColumnRight.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', 1), list);
|
|
40
|
+
|
|
41
|
+
// Delete row/column shortcuts
|
|
42
|
+
bindKeymapWithCommand(deleteColumn.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
43
|
+
bindKeymapWithCommand(deleteRow.common, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI), list);
|
|
44
|
+
}
|
|
33
45
|
return keymap(list);
|
|
34
46
|
}
|
|
35
47
|
export default keymapPlugin;
|
|
@@ -14,7 +14,7 @@ import { ACTION, ACTION_SUBJECT, CONTENT_COMPONENT, EVENT_TYPE, INPUT_METHOD } f
|
|
|
14
14
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
15
15
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
16
16
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
17
|
-
import {
|
|
17
|
+
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
18
18
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
20
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -116,7 +116,7 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
116
116
|
// By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
|
|
117
117
|
// Only when inserting a column, otherwise set to undefined
|
|
118
118
|
// Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
|
|
119
|
-
var zIndex = type === 'column' ?
|
|
119
|
+
var zIndex = type === 'column' ? akEditorTableCellOnStickyHeaderZIndex : undefined;
|
|
120
120
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
121
121
|
target: targetCellRef,
|
|
122
122
|
mountTo: tableContainerWrapper || mountPoint,
|