@atlaskit/editor-plugin-table 5.7.6 → 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 +6 -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/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/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/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 +1 -1
- 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/utils/drag-menu.ts +13 -1
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
6
6
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
7
7
|
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
@@ -64,7 +64,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
64
64
|
canMove: function canMove(index) {
|
|
65
65
|
return canDrag && canDecrease(index);
|
|
66
66
|
},
|
|
67
|
-
icon: ArrowUpIcon
|
|
67
|
+
icon: ArrowUpIcon,
|
|
68
|
+
keymap: moveRowUp
|
|
68
69
|
}, {
|
|
69
70
|
label: 'down',
|
|
70
71
|
offset: 1,
|
|
@@ -72,14 +73,16 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
72
73
|
var _tableMap$height;
|
|
73
74
|
return canDrag && canIncrease(index, ((_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0) - 1);
|
|
74
75
|
},
|
|
75
|
-
icon: ArrowDownIcon
|
|
76
|
+
icon: ArrowDownIcon,
|
|
77
|
+
keymap: moveRowDown
|
|
76
78
|
}] : [{
|
|
77
79
|
label: 'left',
|
|
78
80
|
offset: -1,
|
|
79
81
|
canMove: function canMove(index) {
|
|
80
82
|
return canDrag && canDecrease(index);
|
|
81
83
|
},
|
|
82
|
-
icon: ArrowLeftIcon
|
|
84
|
+
icon: ArrowLeftIcon,
|
|
85
|
+
keymap: moveColumnLeft
|
|
83
86
|
}, {
|
|
84
87
|
label: 'right',
|
|
85
88
|
offset: 1,
|
|
@@ -87,7 +90,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
87
90
|
var _tableMap$width;
|
|
88
91
|
return canDrag && canIncrease(index, ((_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0) - 1);
|
|
89
92
|
},
|
|
90
|
-
icon: ArrowRightIcon
|
|
93
|
+
icon: ArrowRightIcon,
|
|
94
|
+
keymap: moveColumnRight
|
|
91
95
|
}];
|
|
92
96
|
var sortOptions = direction === 'column' ? [{
|
|
93
97
|
label: 'increasing',
|
|
@@ -156,12 +160,14 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
156
160
|
}
|
|
157
161
|
return true;
|
|
158
162
|
},
|
|
159
|
-
icon: RemoveIcon
|
|
163
|
+
icon: RemoveIcon,
|
|
164
|
+
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
160
165
|
}], _toConsumableArray(moveOptions.map(function (_ref2) {
|
|
161
166
|
var label = _ref2.label,
|
|
162
167
|
offset = _ref2.offset,
|
|
163
168
|
canMove = _ref2.canMove,
|
|
164
|
-
icon = _ref2.icon
|
|
169
|
+
icon = _ref2.icon,
|
|
170
|
+
keymap = _ref2.keymap;
|
|
165
171
|
return {
|
|
166
172
|
id: "move_".concat(direction, "_").concat(label),
|
|
167
173
|
title: "Move ".concat(direction, " ").concat(label),
|
|
@@ -175,7 +181,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
175
181
|
return true;
|
|
176
182
|
}
|
|
177
183
|
return false;
|
|
178
|
-
}
|
|
184
|
+
},
|
|
185
|
+
keymap: keymap && tooltip(keymap)
|
|
179
186
|
};
|
|
180
187
|
})), _toConsumableArray(sortOptions.map(function (_ref3) {
|
|
181
188
|
var label = _ref3.label,
|
|
@@ -12,8 +12,9 @@ export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalytics
|
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
14
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, position: number) => Command;
|
|
15
|
-
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
|
-
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB, rect: Rect) => Command;
|
|
15
|
+
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
|
+
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT, rect: Rect) => Command;
|
|
17
|
+
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
17
18
|
export declare const deleteTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
18
19
|
export declare const deleteTableIfSelectedWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) => Command;
|
|
19
20
|
export declare const toggleHeaderRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { EditorAnalyticsAPI
|
|
1
|
+
import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { DraggableType } from '../../types';
|
|
5
|
-
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) =>
|
|
6
|
-
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) =>
|
|
5
|
+
import type { DraggableData, DraggableType } from '../../types';
|
|
6
|
+
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
|
|
7
|
+
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => Command;
|
|
8
|
+
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): SafePlugin;
|
|
4
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean): SafePlugin;
|
|
5
5
|
export default keymapPlugin;
|
|
@@ -12,8 +12,9 @@ export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalytics
|
|
|
12
12
|
export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
|
|
13
13
|
export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
|
|
14
14
|
export declare const insertColumnWithAnalytics: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB, position: number) => Command;
|
|
15
|
-
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
|
-
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB, rect: Rect) => Command;
|
|
15
|
+
export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT, rect: Rect, isHeaderRowRequired: boolean) => Command;
|
|
16
|
+
export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT, rect: Rect) => Command;
|
|
17
|
+
export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
17
18
|
export declare const deleteTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
18
19
|
export declare const deleteTableIfSelectedWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) => Command;
|
|
19
20
|
export declare const toggleHeaderRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { EditorAnalyticsAPI
|
|
1
|
+
import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { DraggableType } from '../../types';
|
|
5
|
-
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) =>
|
|
6
|
-
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) =>
|
|
5
|
+
import type { DraggableData, DraggableType } from '../../types';
|
|
6
|
+
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
|
|
7
|
+
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndex: number, targetIndex: number, tr?: Transaction) => Command;
|
|
8
|
+
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): SafePlugin;
|
|
4
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean): SafePlugin;
|
|
5
5
|
export default keymapPlugin;
|
package/package.json
CHANGED
|
@@ -144,9 +144,9 @@ describe('FloatingDragMenu', () => {
|
|
|
144
144
|
"Add row aboveCtrl+Alt+↑",
|
|
145
145
|
"Add row belowCtrl+Alt+↓",
|
|
146
146
|
"Clear cells⌫",
|
|
147
|
-
"Delete
|
|
148
|
-
"Move row
|
|
149
|
-
"Move row
|
|
147
|
+
"Delete rowCtrl+⌫",
|
|
148
|
+
"Move row upCtrl+Alt+Shift+↑",
|
|
149
|
+
"Move row downCtrl+Alt+Shift+↓",
|
|
150
150
|
]
|
|
151
151
|
`);
|
|
152
152
|
});
|
|
@@ -180,9 +180,9 @@ describe('FloatingDragMenu', () => {
|
|
|
180
180
|
"Add column rightCtrl+Alt+→",
|
|
181
181
|
"Distribute columns",
|
|
182
182
|
"Clear cells⌫",
|
|
183
|
-
"Delete
|
|
184
|
-
"Move column
|
|
185
|
-
"Move column
|
|
183
|
+
"Delete columnCtrl+⌫",
|
|
184
|
+
"Move column leftCtrl+Alt+Shift+←",
|
|
185
|
+
"Move column rightCtrl+Alt+Shift+→",
|
|
186
186
|
"Sort increasing",
|
|
187
187
|
"Sort decreasing",
|
|
188
188
|
]
|