@atlaskit/editor-plugin-table 7.3.8 → 7.3.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 +13 -0
- package/afm-cc/tsconfig.json +9 -0
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -2
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +24 -5
- package/dist/cjs/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
- package/dist/cjs/pm-plugins/keymap.js +7 -0
- package/dist/cjs/ui/DragHandle/index.js +3 -3
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -3
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +3 -3
- package/dist/es2019/nodeviews/ExternalDropTargets.js +1 -1
- package/dist/es2019/nodeviews/TableComponent.js +1 -1
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +28 -4
- package/dist/es2019/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
- package/dist/es2019/pm-plugins/keymap.js +7 -0
- package/dist/es2019/ui/DragHandle/index.js +2 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
- package/dist/es2019/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
- package/dist/esm/nodeviews/ExternalDropTargets.js +1 -1
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +23 -4
- package/dist/esm/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +7 -0
- package/dist/esm/ui/DragHandle/index.js +2 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
- package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
- package/dist/types/pm-plugins/drag-and-drop/utils/monitor.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/monitor.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +8 -8
- package/src/nodeviews/ExternalDropTargets.tsx +1 -1
- package/src/nodeviews/TableComponent.tsx +1 -1
- package/src/pm-plugins/drag-and-drop/plugin.ts +43 -8
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +3 -3
- package/src/pm-plugins/keymap.ts +7 -0
- package/src/types.ts +1 -1
- package/src/ui/DragHandle/index.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -1
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +2 -2
- package/tsconfig.json +894 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.10",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.5.1",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.13",
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
33
|
+
"@atlaskit/editor-common": "^78.4.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^1.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-guideline": "^1.0.0",
|
|
38
|
-
"@atlaskit/editor-plugin-selection": "^1.
|
|
38
|
+
"@atlaskit/editor-plugin-selection": "^1.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-width": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.5.0",
|
|
43
|
-
"@atlaskit/icon": "^22.
|
|
43
|
+
"@atlaskit/icon": "^22.1.0",
|
|
44
44
|
"@atlaskit/menu": "^2.1.5",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
46
|
-
"@atlaskit/pragmatic-drag-and-drop": "^0.
|
|
47
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^0.
|
|
48
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.
|
|
49
|
-
"@atlaskit/primitives": "^2.
|
|
46
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.0.0",
|
|
47
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.0.0",
|
|
48
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
49
|
+
"@atlaskit/primitives": "^2.1.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
51
|
"@atlaskit/toggle": "^13.0.0",
|
|
52
52
|
"@atlaskit/tokens": "^1.38.0",
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import { tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
6
|
+
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
7
7
|
|
|
8
8
|
import type { DraggableSourceData } from '../types';
|
|
9
9
|
import { dropTargetExtendedWidth, dropTargetsZIndex } from '../ui/consts';
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
} from '@atlaskit/editor-shared-styles';
|
|
32
32
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
33
33
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
34
|
+
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
34
35
|
import type { CleanupFn } from '@atlaskit/pragmatic-drag-and-drop/types';
|
|
35
|
-
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
36
36
|
|
|
37
37
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
38
38
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -8,10 +8,13 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getCellsInRow,
|
|
13
|
+
getSelectedCellInfo,
|
|
14
|
+
} from '@atlaskit/editor-tables/utils';
|
|
12
15
|
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
16
|
+
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
17
|
+
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
18
|
|
|
16
19
|
import type { DraggableSourceData } from '../../types';
|
|
17
20
|
import {
|
|
@@ -313,17 +316,49 @@ export const createPlugin = (
|
|
|
313
316
|
return decorationSet;
|
|
314
317
|
},
|
|
315
318
|
handleKeyDown: (view, event) => {
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
const keysToTrap = ['Enter', ' '];
|
|
319
|
+
const {
|
|
320
|
+
state: { tr },
|
|
321
|
+
} = view;
|
|
322
|
+
|
|
321
323
|
const keysToTrapWhen = [
|
|
322
324
|
'ArrowUp',
|
|
323
325
|
'ArrowDown',
|
|
324
326
|
'ArrowLeft',
|
|
325
327
|
'ArrowRight',
|
|
326
328
|
];
|
|
329
|
+
|
|
330
|
+
/** fix for NCS spam update where the user is holding down the move column / row keyboard shortcut
|
|
331
|
+
* if the user is holding down shortcut (ctrl + shift + alt + arrowKey), we want to move the selection only once
|
|
332
|
+
* See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
// Do early check for the keys we want to trap here so we can abort early
|
|
336
|
+
if (event.ctrlKey && event.shiftKey && event.altKey) {
|
|
337
|
+
const {
|
|
338
|
+
verticalCells,
|
|
339
|
+
horizontalCells,
|
|
340
|
+
totalRowCount,
|
|
341
|
+
totalColumnCount,
|
|
342
|
+
} = getSelectedCellInfo(tr.selection);
|
|
343
|
+
|
|
344
|
+
const isRowOrColumnSelected =
|
|
345
|
+
horizontalCells === totalColumnCount ||
|
|
346
|
+
verticalCells === totalRowCount;
|
|
347
|
+
if (
|
|
348
|
+
isRowOrColumnSelected &&
|
|
349
|
+
keysToTrapWhen.includes(event.key) &&
|
|
350
|
+
event.repeat
|
|
351
|
+
) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const isDragHandleFocused = [
|
|
357
|
+
'drag-handle-button-row',
|
|
358
|
+
'drag-handle-button-column',
|
|
359
|
+
].includes(((event.target as HTMLElement) || null)?.id);
|
|
360
|
+
const keysToTrap = ['Enter', ' '];
|
|
361
|
+
|
|
327
362
|
const { isDragMenuOpen } = getPluginState(view.state);
|
|
328
363
|
|
|
329
364
|
// drag handle is focused, and user presses any key return them back to editing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/
|
|
2
|
-
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/
|
|
3
|
-
import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
1
|
+
import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
2
|
+
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
3
|
+
import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
DraggableData,
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -129,6 +129,13 @@ export function keymapPlugin(
|
|
|
129
129
|
|
|
130
130
|
if (dragAndDropEnabled) {
|
|
131
131
|
// Move row/column shortcuts
|
|
132
|
+
/**
|
|
133
|
+
* NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
|
|
134
|
+
* in packages/editor/editor-plugin-table/src/pm-plugins/drag-and-drop/plugin.ts
|
|
135
|
+
* to make sure the logic for holding the shortcut keys is valid
|
|
136
|
+
* See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
|
|
137
|
+
*/
|
|
138
|
+
|
|
132
139
|
bindKeymapWithCommand(
|
|
133
140
|
moveRowDown.common!,
|
|
134
141
|
moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1),
|
package/src/types.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
14
14
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
15
15
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
16
16
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
17
|
-
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/
|
|
17
|
+
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
18
18
|
|
|
19
19
|
import type tablePlugin from './plugin';
|
|
20
20
|
|
|
@@ -9,8 +9,8 @@ import { injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
12
|
-
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
13
|
-
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/
|
|
12
|
+
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
|
+
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
14
14
|
import { token } from '@atlaskit/tokens';
|
|
15
15
|
|
|
16
16
|
import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/
|
|
4
|
-
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
3
|
+
import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
4
|
+
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
5
|
|
|
6
6
|
import type { DraggableSourceData } from '../../../types';
|
|
7
7
|
|
|
@@ -5,7 +5,7 @@ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
8
|
+
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
9
|
|
|
10
10
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
11
11
|
import type { CellHoverMeta, DraggableSourceData } from '../../types';
|
|
@@ -16,7 +16,7 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
16
16
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
17
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
18
18
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
19
|
-
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
19
|
+
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
20
20
|
import { token } from '@atlaskit/tokens';
|
|
21
21
|
|
|
22
22
|
import { clearHoverSelection } from '../../../commands';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/
|
|
4
|
-
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter
|
|
3
|
+
import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
4
|
+
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
5
5
|
|
|
6
6
|
import type { DraggableSourceData } from '../../../types';
|
|
7
7
|
|