@atlaskit/editor-plugin-table 7.28.8 → 7.28.10
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 +16 -0
- package/dist/cjs/nodeviews/TableComponent.js +4 -9
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +9 -8
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -1
- package/dist/cjs/ui/FloatingContextualButton/styles.js +9 -4
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +76 -45
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -10
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +19 -12
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -7
- package/dist/cjs/ui/icons/SortingIconWrapper.js +18 -0
- package/dist/cjs/utils/drag-menu.js +47 -14
- package/dist/es2019/nodeviews/TableComponent.js +4 -10
- package/dist/es2019/plugin.js +1 -1
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +9 -8
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -1
- package/dist/es2019/ui/FloatingContextualButton/styles.js +6 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +0 -9
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +20 -13
- package/dist/es2019/ui/FloatingDragMenu/styles.js +0 -6
- package/dist/es2019/ui/icons/SortingIconWrapper.js +12 -0
- package/dist/es2019/utils/drag-menu.js +50 -17
- package/dist/esm/nodeviews/TableComponent.js +4 -9
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/pm-plugins/view-mode-sort/index.js +9 -8
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -1
- package/dist/esm/ui/FloatingContextualButton/styles.js +8 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
- package/dist/esm/ui/FloatingContextualMenu/styles.js +0 -9
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +20 -13
- package/dist/esm/ui/FloatingDragMenu/styles.js +0 -6
- package/dist/esm/ui/icons/SortingIconWrapper.js +11 -0
- package/dist/esm/utils/drag-menu.js +47 -14
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +1 -1
- package/dist/types/ui/FloatingContextualMenu/styles.d.ts +0 -1
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +0 -1
- package/dist/types/ui/icons/SortingIconWrapper.d.ts +10 -0
- package/dist/types/utils/drag-menu.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +0 -1
- package/dist/types-ts4.5/ui/icons/SortingIconWrapper.d.ts +10 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -2
- package/package.json +5 -2
- package/src/nodeviews/TableComponent.tsx +1 -5
- package/src/plugin.tsx +1 -1
- package/src/pm-plugins/view-mode-sort/index.ts +6 -8
- package/src/ui/FloatingContextualButton/index.tsx +2 -2
- package/src/ui/FloatingContextualButton/styles.ts +5 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +75 -36
- package/src/ui/FloatingContextualMenu/styles.ts +0 -8
- package/src/ui/FloatingDragMenu/DragMenu.tsx +20 -15
- package/src/ui/FloatingDragMenu/styles.ts +0 -6
- package/src/ui/icons/SortingIconWrapper.tsx +20 -0
- package/src/utils/drag-menu.ts +73 -43
|
@@ -16,14 +16,6 @@ export const cellColourPreviewStyles = (selectedColor: string) =>
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
20
|
-
export const elementBeforeIconStyles = css({
|
|
21
|
-
marginRight: token('space.negative.075', '-6px'),
|
|
22
|
-
display: 'flex',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
26
|
-
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
27
19
|
export const tablePopupStyles = (
|
|
28
20
|
isDragAndDropEnabled: boolean | undefined,
|
|
29
21
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
@@ -42,7 +42,9 @@ import {
|
|
|
42
42
|
getSelectionRect,
|
|
43
43
|
isSelectionType,
|
|
44
44
|
} from '@atlaskit/editor-tables/utils';
|
|
45
|
-
import EditorBackgroundColorIcon from '@atlaskit/icon/
|
|
45
|
+
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
46
|
+
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
47
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
46
48
|
import Toggle from '@atlaskit/toggle';
|
|
47
49
|
|
|
48
50
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
@@ -69,12 +71,7 @@ import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
|
69
71
|
import { colorPalletteColumns } from '../consts';
|
|
70
72
|
|
|
71
73
|
import { DropdownMenu } from './DropdownMenu';
|
|
72
|
-
import {
|
|
73
|
-
cellColourPreviewStyles,
|
|
74
|
-
dragMenuBackgroundColorStyles,
|
|
75
|
-
elementBeforeIconStyles,
|
|
76
|
-
toggleStyles,
|
|
77
|
-
} from './styles';
|
|
74
|
+
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
|
|
78
75
|
|
|
79
76
|
type DragMenuProps = {
|
|
80
77
|
direction?: TableDirection;
|
|
@@ -192,6 +189,11 @@ const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
|
|
|
192
189
|
return groupedDragMenuConfig;
|
|
193
190
|
};
|
|
194
191
|
|
|
192
|
+
const elementBeforeIconStyles = xcss({
|
|
193
|
+
marginRight: 'space.negative.075',
|
|
194
|
+
display: 'flex',
|
|
195
|
+
});
|
|
196
|
+
|
|
195
197
|
const convertToDropdownItems = (
|
|
196
198
|
dragMenuConfig: DragMenuConfig[],
|
|
197
199
|
formatMessage: IntlShape['formatMessage'],
|
|
@@ -237,12 +239,14 @@ const convertToDropdownItems = (
|
|
|
237
239
|
value: { name: item.id },
|
|
238
240
|
isDisabled: item.disabled,
|
|
239
241
|
elemBefore: item.icon ? (
|
|
240
|
-
|
|
241
|
-
<span css={elementBeforeIconStyles}>
|
|
242
|
+
<Box xcss={elementBeforeIconStyles}>
|
|
242
243
|
<item.icon
|
|
244
|
+
color="currentColor"
|
|
245
|
+
spacing="spacious"
|
|
243
246
|
label={formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)}
|
|
247
|
+
LEGACY_fallbackIcon={item.iconFallback ? item.iconFallback : undefined}
|
|
244
248
|
/>
|
|
245
|
-
</
|
|
249
|
+
</Box>
|
|
246
250
|
) : undefined,
|
|
247
251
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
248
252
|
elemAfter: item.keymap ? <div css={shortcutStyle}>{item.keymap}</div> : undefined,
|
|
@@ -368,13 +372,14 @@ const DragMenu = React.memo(
|
|
|
368
372
|
content: formatMessage(messages.backgroundColor),
|
|
369
373
|
value: { name: 'background' },
|
|
370
374
|
elemBefore: (
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
375
|
+
<Box xcss={elementBeforeIconStyles}>
|
|
376
|
+
<PaintBucketIcon
|
|
377
|
+
color="currentColor"
|
|
378
|
+
spacing="spacious"
|
|
374
379
|
label={formatMessage(messages.backgroundColor)}
|
|
375
|
-
|
|
380
|
+
LEGACY_fallbackIcon={EditorBackgroundColorIcon}
|
|
376
381
|
/>
|
|
377
|
-
</
|
|
382
|
+
</Box>
|
|
378
383
|
),
|
|
379
384
|
elemAfter: (
|
|
380
385
|
<div
|
|
@@ -21,12 +21,6 @@ export const cellColourPreviewStyles = (selectedColor: string) =>
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
25
|
-
export const elementBeforeIconStyles = css({
|
|
26
|
-
marginRight: token('space.negative.075', '-6px'),
|
|
27
|
-
display: 'flex',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
24
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
31
25
|
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder: boolean = false) => css`
|
|
32
26
|
.${ClassName.DRAG_SUBMENU} {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { SortingIcon } from '@atlaskit/editor-common/table';
|
|
5
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
|
|
7
|
+
import type { TablePlugin } from '../../plugin';
|
|
8
|
+
|
|
9
|
+
type SortingIconProps = React.ComponentProps<typeof SortingIcon>;
|
|
10
|
+
type SortingIconWrapperProps = SortingIconProps & {
|
|
11
|
+
api: ExtractInjectionAPI<TablePlugin>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const SortingIconWrapper = (props: SortingIconWrapperProps) => {
|
|
15
|
+
const { editorViewModeState } = useSharedPluginState(props.api, ['editorViewMode']);
|
|
16
|
+
if (editorViewModeState?.mode === 'edit') {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return <SortingIcon {...props} />;
|
|
20
|
+
};
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -20,12 +20,25 @@ import type {
|
|
|
20
20
|
CommandDispatch,
|
|
21
21
|
DropdownOptionT,
|
|
22
22
|
GetEditorContainerWidth,
|
|
23
|
-
IconProps,
|
|
24
23
|
} from '@atlaskit/editor-common/types';
|
|
25
24
|
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
26
25
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
27
26
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
28
27
|
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
28
|
+
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
29
|
+
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
30
|
+
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
31
|
+
import TableColumnAddLeftIcon from '@atlaskit/icon/core/table-column-add-left';
|
|
32
|
+
import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
|
|
33
|
+
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
34
|
+
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
35
|
+
import TableColumnMoveRightIcon from '@atlaskit/icon/core/table-column-move-right';
|
|
36
|
+
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
37
|
+
import TableRowAddAboveIcon from '@atlaskit/icon/core/table-row-add-above';
|
|
38
|
+
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
39
|
+
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
40
|
+
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
41
|
+
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
29
42
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
30
43
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
31
44
|
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
@@ -35,6 +48,7 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
|
|
|
35
48
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
36
49
|
import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
|
|
37
50
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
51
|
+
import type { UNSAFE_NewIconProps } from '@atlaskit/icon/types';
|
|
38
52
|
|
|
39
53
|
import {
|
|
40
54
|
deleteColumnsWithAnalytics,
|
|
@@ -128,7 +142,8 @@ export type DragMenuOptionIdType =
|
|
|
128
142
|
|
|
129
143
|
export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
130
144
|
id: DragMenuOptionIdType;
|
|
131
|
-
icon?: React.ComponentType<React.PropsWithChildren<
|
|
145
|
+
icon?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
146
|
+
iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
132
147
|
keymap?: string;
|
|
133
148
|
}
|
|
134
149
|
|
|
@@ -165,13 +180,15 @@ export const getDragMenuConfig = (
|
|
|
165
180
|
{
|
|
166
181
|
label: 'above',
|
|
167
182
|
offset: 0,
|
|
168
|
-
icon:
|
|
183
|
+
icon: TableRowAddAboveIcon,
|
|
184
|
+
iconFallback: AddRowAboveIcon,
|
|
169
185
|
keymap: addRowBefore,
|
|
170
186
|
},
|
|
171
187
|
{
|
|
172
188
|
label: 'below',
|
|
173
189
|
offset: 1,
|
|
174
|
-
icon:
|
|
190
|
+
icon: TableRowAddBelowIcon,
|
|
191
|
+
iconFallback: AddRowBelowIcon,
|
|
175
192
|
keymap: addRowAfter,
|
|
176
193
|
},
|
|
177
194
|
]
|
|
@@ -179,13 +196,15 @@ export const getDragMenuConfig = (
|
|
|
179
196
|
{
|
|
180
197
|
label: 'left',
|
|
181
198
|
offset: 0,
|
|
182
|
-
icon:
|
|
199
|
+
icon: TableColumnAddLeftIcon,
|
|
200
|
+
iconFallback: AddColLeftIcon,
|
|
183
201
|
keymap: addColumnBefore,
|
|
184
202
|
},
|
|
185
203
|
{
|
|
186
204
|
label: 'right',
|
|
187
205
|
offset: 1,
|
|
188
|
-
icon:
|
|
206
|
+
icon: TableColumnAddRightIcon,
|
|
207
|
+
iconFallback: AddColRightIcon,
|
|
189
208
|
keymap: addColumnAfter,
|
|
190
209
|
},
|
|
191
210
|
];
|
|
@@ -194,7 +213,8 @@ export const getDragMenuConfig = (
|
|
|
194
213
|
? [
|
|
195
214
|
{
|
|
196
215
|
label: 'up',
|
|
197
|
-
icon:
|
|
216
|
+
icon: TableRowMoveUpIcon,
|
|
217
|
+
iconFallback: ArrowUpIcon,
|
|
198
218
|
keymap: moveRowUp,
|
|
199
219
|
canMove: canMove('table-row', -1, tableMap?.height ?? 0, selection, selectionRect),
|
|
200
220
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -202,7 +222,8 @@ export const getDragMenuConfig = (
|
|
|
202
222
|
},
|
|
203
223
|
{
|
|
204
224
|
label: 'down',
|
|
205
|
-
icon:
|
|
225
|
+
icon: TableRowMoveDownIcon,
|
|
226
|
+
iconFallback: ArrowDownIcon,
|
|
206
227
|
keymap: moveRowDown,
|
|
207
228
|
canMove: canMove('table-row', 1, tableMap?.height ?? 0, selection, selectionRect),
|
|
208
229
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -212,7 +233,8 @@ export const getDragMenuConfig = (
|
|
|
212
233
|
: [
|
|
213
234
|
{
|
|
214
235
|
label: 'left',
|
|
215
|
-
icon:
|
|
236
|
+
icon: TableColumnMoveLeftIcon,
|
|
237
|
+
iconFallback: ArrowLeftIcon,
|
|
216
238
|
keymap: moveColumnLeft,
|
|
217
239
|
canMove: canMove('table-column', -1, tableMap?.width ?? 0, selection, selectionRect),
|
|
218
240
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -220,36 +242,38 @@ export const getDragMenuConfig = (
|
|
|
220
242
|
},
|
|
221
243
|
{
|
|
222
244
|
label: 'right',
|
|
223
|
-
icon:
|
|
245
|
+
icon: TableColumnMoveRightIcon,
|
|
246
|
+
iconFallback: ArrowRightIcon,
|
|
224
247
|
keymap: moveColumnRight,
|
|
225
248
|
canMove: canMove('table-column', 1, tableMap?.width ?? 0, selection, selectionRect),
|
|
226
249
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
227
250
|
getTargetIndex: (selectionRect: Rect) => selectionRect.right,
|
|
228
251
|
},
|
|
229
252
|
];
|
|
230
|
-
|
|
231
253
|
const sortOptions =
|
|
232
254
|
direction === 'column'
|
|
233
255
|
? [
|
|
234
256
|
{
|
|
235
257
|
label: 'increasing',
|
|
236
258
|
order: SortOrder.ASC,
|
|
237
|
-
icon:
|
|
259
|
+
icon: SortAscendingIcon,
|
|
260
|
+
iconFallback: HipchatChevronDoubleUpIcon,
|
|
238
261
|
},
|
|
239
262
|
{
|
|
240
263
|
label: 'decreasing',
|
|
241
264
|
order: SortOrder.DESC,
|
|
242
|
-
icon:
|
|
265
|
+
icon: SortDescendingIcon,
|
|
266
|
+
iconFallback: HipchatChevronDoubleDownIcon,
|
|
243
267
|
},
|
|
244
268
|
]
|
|
245
269
|
: [];
|
|
246
|
-
|
|
247
270
|
const sortConfigs = [
|
|
248
|
-
...sortOptions.map(({ label, order, icon }) => ({
|
|
271
|
+
...sortOptions.map(({ label, order, icon, iconFallback }) => ({
|
|
249
272
|
id: `sort_column_${order}`,
|
|
250
273
|
title: `Sort ${label}`,
|
|
251
274
|
disabled: hasMergedCellsInTable,
|
|
252
|
-
icon,
|
|
275
|
+
icon: icon,
|
|
276
|
+
iconFallback: iconFallback,
|
|
253
277
|
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
254
278
|
sortColumnWithAnalytics(editorAnalyticsAPI)(
|
|
255
279
|
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
@@ -260,12 +284,12 @@ export const getDragMenuConfig = (
|
|
|
260
284
|
},
|
|
261
285
|
})),
|
|
262
286
|
];
|
|
263
|
-
|
|
264
287
|
const restConfigs = [
|
|
265
|
-
...addOptions.map(({ label, offset, icon, keymap }) => ({
|
|
288
|
+
...addOptions.map(({ label, offset, icon, iconFallback, keymap }) => ({
|
|
266
289
|
id: `add_${direction}_${label}`,
|
|
267
290
|
title: `Add ${direction} ${label}`,
|
|
268
|
-
icon,
|
|
291
|
+
icon: icon,
|
|
292
|
+
iconFallback: iconFallback,
|
|
269
293
|
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
270
294
|
if (direction === 'row') {
|
|
271
295
|
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(
|
|
@@ -318,7 +342,8 @@ export const getDragMenuConfig = (
|
|
|
318
342
|
}
|
|
319
343
|
return false;
|
|
320
344
|
},
|
|
321
|
-
icon:
|
|
345
|
+
icon: TableColumnsDistributeIcon,
|
|
346
|
+
iconFallback: EditorLayoutThreeEqualIcon,
|
|
322
347
|
}
|
|
323
348
|
: undefined,
|
|
324
349
|
{
|
|
@@ -331,7 +356,8 @@ export const getDragMenuConfig = (
|
|
|
331
356
|
)(state, dispatch);
|
|
332
357
|
return true;
|
|
333
358
|
},
|
|
334
|
-
icon:
|
|
359
|
+
icon: TableCellClearIcon,
|
|
360
|
+
iconFallback: CrossCircleIcon,
|
|
335
361
|
keymap: tooltip(backspace),
|
|
336
362
|
},
|
|
337
363
|
{
|
|
@@ -360,30 +386,34 @@ export const getDragMenuConfig = (
|
|
|
360
386
|
}
|
|
361
387
|
return true;
|
|
362
388
|
},
|
|
363
|
-
icon:
|
|
389
|
+
icon: direction === 'row' ? TableRowDeleteIcon : TableColumnDeleteIcon,
|
|
390
|
+
iconFallback: RemoveIcon,
|
|
364
391
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn),
|
|
365
392
|
},
|
|
366
|
-
...moveOptions.map(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
393
|
+
...moveOptions.map(
|
|
394
|
+
({ label, canMove, icon, iconFallback, keymap, getOriginIndexes, getTargetIndex }) => ({
|
|
395
|
+
id: `move_${direction}_${label}`,
|
|
396
|
+
title: `Move ${direction} ${label}`,
|
|
397
|
+
disabled: !canMove,
|
|
398
|
+
icon: icon,
|
|
399
|
+
iconFallback: iconFallback,
|
|
400
|
+
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
401
|
+
if (canMove) {
|
|
402
|
+
requestAnimationFrame(() => {
|
|
403
|
+
moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(
|
|
404
|
+
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
405
|
+
`table-${direction}`,
|
|
406
|
+
getOriginIndexes(selectionRect!),
|
|
407
|
+
getTargetIndex(selectionRect!),
|
|
408
|
+
)(editorView.state, editorView.dispatch);
|
|
409
|
+
});
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
},
|
|
414
|
+
keymap: keymap && tooltip(keymap),
|
|
415
|
+
}),
|
|
416
|
+
),
|
|
387
417
|
];
|
|
388
418
|
|
|
389
419
|
let allConfigs = [...restConfigs];
|