@atlaskit/editor-plugin-table 5.3.33 → 5.3.35
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/plugins/table/event-handlers.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +10 -4
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +5 -2
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +4 -2
- package/dist/cjs/plugins/table/types.js +2 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +20 -14
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +2 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +3 -1
- package/dist/cjs/plugins/table/utils/drag-menu.js +3 -1
- package/dist/cjs/plugins/table/utils/transforms.js +11 -0
- package/dist/es2019/plugins/table/event-handlers.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +8 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +5 -2
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +4 -2
- package/dist/es2019/plugins/table/types.js +2 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +21 -14
- package/dist/es2019/plugins/table/ui/common-styles.js +0 -5
- package/dist/es2019/plugins/table/ui/consts.js +1 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +15 -3
- package/dist/es2019/plugins/table/utils/drag-menu.js +3 -1
- package/dist/es2019/plugins/table/utils/transforms.js +5 -0
- package/dist/esm/plugins/table/event-handlers.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +10 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +5 -2
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +4 -2
- package/dist/esm/plugins/table/types.js +2 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +20 -14
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +1 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +4 -2
- package/dist/esm/plugins/table/utils/drag-menu.js +3 -1
- package/dist/esm/plugins/table/utils/transforms.js +5 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +1 -0
- package/dist/types/plugins/table/types.d.ts +2 -0
- package/dist/types/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types/plugins/table/utils/transforms.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/transforms.d.ts +2 -0
- package/package.json +2 -2
- package/src/plugins/table/event-handlers.ts +4 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +26 -4
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +9 -5
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +2 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +1 -0
- package/src/plugins/table/types.ts +2 -0
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +35 -17
- package/src/plugins/table/ui/common-styles.ts +0 -5
- package/src/plugins/table/ui/consts.ts +1 -0
- package/src/plugins/table/ui/ui-styles.ts +14 -2
- package/src/plugins/table/utils/drag-menu.ts +7 -5
- package/src/plugins/table/utils/transforms.ts +10 -0
|
@@ -53,4 +53,5 @@ export declare const TABLE_HIGHLIGHT_GAP = 10;
|
|
|
53
53
|
export declare const TABLE_HIGHLIGHT_TOLERANCE = 2;
|
|
54
54
|
export declare const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
|
|
55
55
|
export declare const dragMenuDropdownWidth = 240;
|
|
56
|
+
export declare const dragTableInsertColumnButtonSize = 16;
|
|
56
57
|
export declare const dropTargetExtendedWidth = 150;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.35",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/pragmatic-drag-and-drop": "^0.24.0",
|
|
45
45
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^0.7.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
|
|
47
|
-
"@atlaskit/primitives": "^1.
|
|
47
|
+
"@atlaskit/primitives": "^1.11.0",
|
|
48
48
|
"@atlaskit/theme": "^12.6.0",
|
|
49
49
|
"@atlaskit/tokens": "^1.28.0",
|
|
50
50
|
"@atlaskit/tooltip": "^18.0.0",
|
|
@@ -587,7 +587,10 @@ export const withCellTracking =
|
|
|
587
587
|
elementContentRects?: ElementContentRects,
|
|
588
588
|
) =>
|
|
589
589
|
(view: EditorView, mouseEvent: Event): boolean => {
|
|
590
|
-
if (
|
|
590
|
+
if (
|
|
591
|
+
getPluginState(view.state).isDragAndDropEnabled &&
|
|
592
|
+
!getDragDropPluginState(view.state).isDragging
|
|
593
|
+
) {
|
|
591
594
|
trackCellLocation(view, mouseEvent);
|
|
592
595
|
}
|
|
593
596
|
return eventHandler(view, mouseEvent, elementContentRects);
|
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
EditorState,
|
|
3
3
|
Transaction,
|
|
4
4
|
} from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import {
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
createRowInsertLine,
|
|
19
20
|
updateDecorations,
|
|
20
21
|
} from '../../utils';
|
|
22
|
+
import { combineTransforms } from '../../utils/transforms';
|
|
21
23
|
|
|
22
24
|
import { DragAndDropActionType } from './actions';
|
|
23
25
|
import { DropTargetType } from './consts';
|
|
@@ -114,11 +116,31 @@ export const moveSource = (
|
|
|
114
116
|
return tr.setMeta('addToHistory', false);
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
const anchor = tr.selection.anchor;
|
|
120
|
+
const selectStartOfTable = (newTr: Transaction) =>
|
|
121
|
+
newTr.setSelection(TextSelection.create(newTr.doc, anchor));
|
|
122
|
+
|
|
117
123
|
const isTableRow = sourceType === 'table-row';
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
|
|
125
|
+
if (isTableRow) {
|
|
126
|
+
return combineTransforms(
|
|
127
|
+
[
|
|
128
|
+
moveRow(sourceIndex, targetIndex),
|
|
129
|
+
selectStartOfTable,
|
|
130
|
+
selectRow(targetIndex),
|
|
131
|
+
],
|
|
132
|
+
tr,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return combineTransforms(
|
|
137
|
+
[
|
|
138
|
+
moveColumn(sourceIndex, targetIndex),
|
|
139
|
+
selectStartOfTable,
|
|
140
|
+
selectColumn(targetIndex),
|
|
141
|
+
],
|
|
142
|
+
tr,
|
|
143
|
+
);
|
|
122
144
|
},
|
|
123
145
|
);
|
|
124
146
|
|
|
@@ -39,6 +39,7 @@ export const createPlugin = (
|
|
|
39
39
|
dropTargetIndex: 0,
|
|
40
40
|
isDragMenuOpen: false,
|
|
41
41
|
dragMenuIndex: 0,
|
|
42
|
+
isDragging: false,
|
|
42
43
|
})),
|
|
43
44
|
key: pluginKey,
|
|
44
45
|
appendTransaction: (transactions, oldState, newState) => {
|
|
@@ -160,11 +161,14 @@ export const createPlugin = (
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
const [sourceIndex] = sourceIndexes;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
|
|
165
|
+
requestAnimationFrame(() => {
|
|
166
|
+
moveSource(
|
|
167
|
+
sourceType,
|
|
168
|
+
sourceIndex,
|
|
169
|
+
targetAdjustedIndex + (direction === -1 ? 0 : -1),
|
|
170
|
+
)(editorView.state, editorView.dispatch);
|
|
171
|
+
});
|
|
168
172
|
},
|
|
169
173
|
}),
|
|
170
174
|
};
|
|
@@ -14,6 +14,7 @@ export default (
|
|
|
14
14
|
decorationSet: action.data.decorationSet,
|
|
15
15
|
dropTargetType: action.data.type,
|
|
16
16
|
dropTargetIndex: action.data.index,
|
|
17
|
+
isDragging: true,
|
|
17
18
|
};
|
|
18
19
|
case DragAndDropActionType.CLEAR_DROP_TARGET:
|
|
19
20
|
return {
|
|
@@ -21,6 +22,7 @@ export default (
|
|
|
21
22
|
decorationSet: action.data.decorationSet,
|
|
22
23
|
dropTargetType: DropTargetType.NONE,
|
|
23
24
|
dropTargetIndex: 0,
|
|
25
|
+
isDragging: false,
|
|
24
26
|
};
|
|
25
27
|
case DragAndDropActionType.TOGGLE_DRAG_MENU:
|
|
26
28
|
return {
|
|
@@ -291,6 +291,8 @@ export const TableCssClassName = {
|
|
|
291
291
|
|
|
292
292
|
DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
|
|
293
293
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
|
|
294
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
|
|
295
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: `${tablePrefixSelector}-controls__drag-insert-button-inner-row`,
|
|
294
296
|
DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
|
|
295
297
|
|
|
296
298
|
CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
+
import classnames from 'classnames';
|
|
5
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
6
7
|
import { injectIntl } from 'react-intl-next';
|
|
7
8
|
|
|
@@ -14,6 +15,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
14
15
|
import { tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
15
16
|
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
16
17
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
18
|
+
import { token } from '@atlaskit/tokens';
|
|
17
19
|
import Tooltip from '@atlaskit/tooltip';
|
|
18
20
|
|
|
19
21
|
import type { TableDirection } from '../../types';
|
|
@@ -61,16 +63,19 @@ const getInsertLineWidth = (
|
|
|
61
63
|
// but since we have an overflow on the left,
|
|
62
64
|
// we should add an offset to make up for it.
|
|
63
65
|
const LINE_OFFSET = 4;
|
|
66
|
+
const DRAG_LINE_OFFSET = 6;
|
|
64
67
|
const { parentElement, offsetWidth } = tableRef;
|
|
65
68
|
const parentOffsetWidth = parentElement!.offsetWidth;
|
|
66
69
|
const { scrollLeft } = parentElement!;
|
|
67
70
|
const diff = offsetWidth - parentOffsetWidth;
|
|
68
71
|
const toolbarSize = isDragAndDropEnabled ? 0 : getToolbarSize(tableRef);
|
|
72
|
+
const lineOffset = isDragAndDropEnabled ? DRAG_LINE_OFFSET : LINE_OFFSET;
|
|
73
|
+
|
|
69
74
|
return (
|
|
70
75
|
Math.min(
|
|
71
76
|
offsetWidth + toolbarSize,
|
|
72
77
|
parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0),
|
|
73
|
-
) +
|
|
78
|
+
) + lineOffset
|
|
74
79
|
);
|
|
75
80
|
};
|
|
76
81
|
|
|
@@ -85,34 +90,42 @@ export const InsertButtonForDragAndDrop = ({
|
|
|
85
90
|
intl: { formatMessage },
|
|
86
91
|
hasStickyHeaders,
|
|
87
92
|
}: ButtonProps & WrappedComponentProps) => {
|
|
93
|
+
const isRow = type === 'row';
|
|
94
|
+
|
|
88
95
|
const content = (
|
|
89
96
|
<Tooltip
|
|
90
97
|
content={
|
|
91
98
|
<ToolTipContent
|
|
92
|
-
description={formatMessage(
|
|
93
|
-
|
|
99
|
+
description={formatMessage(
|
|
100
|
+
isRow ? messages.insertRowDrag : messages.insertColumnDrag,
|
|
101
|
+
)}
|
|
102
|
+
keymap={isRow ? addRowAfter : addColumnAfter}
|
|
94
103
|
/>
|
|
95
104
|
}
|
|
96
105
|
position="top"
|
|
97
106
|
>
|
|
98
107
|
<>
|
|
99
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
className={classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, {
|
|
110
|
+
[ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW]: isRow,
|
|
111
|
+
[ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN]: !isRow,
|
|
112
|
+
})}
|
|
113
|
+
>
|
|
100
114
|
<button
|
|
101
115
|
type="button"
|
|
102
116
|
className={ClassName.DRAG_CONTROLS_INSERT_BUTTON}
|
|
103
117
|
onMouseDown={onMouseDown}
|
|
104
118
|
>
|
|
105
119
|
<svg
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
className={ClassName.CONTROLS_BUTTON_ICON}
|
|
121
|
+
width="16"
|
|
122
|
+
height="16"
|
|
123
|
+
viewBox="0 0 16 16"
|
|
109
124
|
fill="none"
|
|
110
125
|
xmlns="http://www.w3.org/2000/svg"
|
|
111
126
|
>
|
|
112
127
|
<path
|
|
113
|
-
|
|
114
|
-
clipRule="evenodd"
|
|
115
|
-
d="M5.41667 4.58333V2.91667C5.41667 2.80616 5.37277 2.70018 5.29463 2.62204C5.21649 2.5439 5.11051 2.5 5 2.5C4.88949 2.5 4.78351 2.5439 4.70537 2.62204C4.62723 2.70018 4.58333 2.80616 4.58333 2.91667V4.58333H2.91667C2.80616 4.58333 2.70018 4.62723 2.62204 4.70537C2.5439 4.78351 2.5 4.88949 2.5 5C2.5 5.11051 2.5439 5.21649 2.62204 5.29463C2.70018 5.37277 2.80616 5.41667 2.91667 5.41667H4.58333V7.08333C4.58333 7.19384 4.62723 7.29982 4.70537 7.37796C4.78351 7.4561 4.88949 7.5 5 7.5C5.11051 7.5 5.21649 7.4561 5.29463 7.37796C5.37277 7.29982 5.41667 7.19384 5.41667 7.08333V5.41667H7.08333C7.19384 5.41667 7.29982 5.37277 7.37796 5.29463C7.4561 5.21649 7.5 5.11051 7.5 5C7.5 4.88949 7.4561 4.78351 7.37796 4.70537C7.29982 4.62723 7.19384 4.58333 7.08333 4.58333H5.41667Z"
|
|
128
|
+
d="M8.66667 7.33333V4.66667C8.66667 4.48986 8.59643 4.32029 8.47141 4.19526C8.34638 4.07024 8.17682 4 8 4C7.82318 4 7.65362 4.07024 7.52859 4.19526C7.40357 4.32029 7.33333 4.48986 7.33333 4.66667V7.33333H4.66667C4.48986 7.33333 4.32029 7.40357 4.19526 7.52859C4.07024 7.65362 4 7.82318 4 8C4 8.17682 4.07024 8.34638 4.19526 8.47141C4.32029 8.59643 4.48986 8.66667 4.66667 8.66667H7.33333V11.3333C7.33333 11.5101 7.40357 11.6797 7.52859 11.8047C7.65362 11.9298 7.82318 12 8 12C8.17682 12 8.34638 11.9298 8.47141 11.8047C8.59643 11.6797 8.66667 11.5101 8.66667 11.3333V8.66667H11.3333C11.5101 8.66667 11.6797 8.59643 11.8047 8.47141C11.9298 8.34638 12 8.17682 12 8C12 7.82318 11.9298 7.65362 11.8047 7.52859C11.6797 7.40357 11.5101 7.33333 11.3333 7.33333H8.66667Z"
|
|
116
129
|
fill="currentColor"
|
|
117
130
|
/>
|
|
118
131
|
</svg>
|
|
@@ -122,23 +135,28 @@ export const InsertButtonForDragAndDrop = ({
|
|
|
122
135
|
className={ClassName.CONTROLS_INSERT_LINE}
|
|
123
136
|
style={
|
|
124
137
|
type === 'row'
|
|
125
|
-
? {
|
|
126
|
-
|
|
138
|
+
? {
|
|
139
|
+
width: getInsertLineWidth(tableRef, true),
|
|
140
|
+
left: token('space.150', '12px'),
|
|
141
|
+
}
|
|
142
|
+
: {
|
|
143
|
+
height: getInsertLineHeight(tableRef, hasStickyHeaders) - 8,
|
|
144
|
+
top: '-3px',
|
|
145
|
+
}
|
|
127
146
|
}
|
|
128
147
|
/>
|
|
129
148
|
</>
|
|
130
149
|
</Tooltip>
|
|
131
150
|
);
|
|
132
151
|
|
|
133
|
-
const floatingButtonClassName =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
: ClassName.CONTROLS_FLOATING_BUTTON_ROW;
|
|
152
|
+
const floatingButtonClassName = isRow
|
|
153
|
+
? ClassName.CONTROLS_FLOATING_BUTTON_ROW
|
|
154
|
+
: ClassName.CONTROLS_FLOATING_BUTTON_COLUMN;
|
|
137
155
|
|
|
138
156
|
return (
|
|
139
157
|
<div className={floatingButtonClassName}>
|
|
140
158
|
<div
|
|
141
|
-
className={`${ClassName.
|
|
159
|
+
className={`${ClassName.DRAG_CONTROLS_INSERT_BUTTON_WRAP} ${ClassName.CONTROLS_INSERT_ROW}`}
|
|
142
160
|
>
|
|
143
161
|
{content}
|
|
144
162
|
</div>
|
|
@@ -764,11 +764,6 @@ export const tableStyles = (
|
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
|
|
767
|
-
.${ClassName.CONTROLS_FLOATING_BUTTON_ROW}
|
|
768
|
-
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER} {
|
|
769
|
-
bottom: -1px;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
767
|
.${ClassName.DRAG_HANDLE_BUTTON_CONTAINER} {
|
|
773
768
|
cursor: grab;
|
|
774
769
|
padding: 0;
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
columnControlsDecorationHeight,
|
|
23
23
|
columnControlsSelectedZIndex,
|
|
24
24
|
columnControlsZIndex,
|
|
25
|
+
dragTableInsertColumnButtonSize,
|
|
25
26
|
insertLineWidth,
|
|
26
27
|
lineMarkerSize,
|
|
27
28
|
resizeHandlerAreaWidth,
|
|
@@ -185,8 +186,16 @@ export const dragInsertButtonWrapper = (props: ThemeProps) => css`
|
|
|
185
186
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER} {
|
|
186
187
|
position: absolute;
|
|
187
188
|
z-index: ${akEditorUnitZIndex + 10};
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN} {
|
|
192
|
+
bottom: -3px;
|
|
193
|
+
left: 2px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW} {
|
|
197
|
+
left: -3px;
|
|
198
|
+
bottom: -2px;
|
|
190
199
|
}
|
|
191
200
|
|
|
192
201
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
|
|
@@ -198,6 +207,8 @@ export const dragInsertButtonWrapper = (props: ThemeProps) => css`
|
|
|
198
207
|
'#C1C7D0',
|
|
199
208
|
)};
|
|
200
209
|
border-radius: 50%;
|
|
210
|
+
height: ${dragTableInsertColumnButtonSize}px;
|
|
211
|
+
width: ${dragTableInsertColumnButtonSize}px;
|
|
201
212
|
`)}
|
|
202
213
|
}
|
|
203
214
|
|
|
@@ -872,6 +883,7 @@ export const resizeHandle = (props: ThemeProps) => css`
|
|
|
872
883
|
}
|
|
873
884
|
`;
|
|
874
885
|
|
|
886
|
+
// Drag and Drop: drop target insert line
|
|
875
887
|
export const insertLine = (props: ThemeProps) => css`
|
|
876
888
|
.${ClassName.TABLE_CONTAINER} {
|
|
877
889
|
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
@@ -194,11 +194,13 @@ export const getDragMenuConfig = (
|
|
|
194
194
|
icon,
|
|
195
195
|
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
196
196
|
if (canMove(index)) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
requestAnimationFrame(() => {
|
|
198
|
+
moveSource(
|
|
199
|
+
`table-${direction}`,
|
|
200
|
+
index!,
|
|
201
|
+
index! + offset,
|
|
202
|
+
)(state, dispatch);
|
|
203
|
+
});
|
|
202
204
|
return true;
|
|
203
205
|
}
|
|
204
206
|
return false;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
|
|
3
|
+
export const combineTransforms = (
|
|
4
|
+
transforms: Array<(tr: Transaction) => Transaction>,
|
|
5
|
+
tr: Transaction,
|
|
6
|
+
) => {
|
|
7
|
+
return transforms.reduce((prev, curr) => {
|
|
8
|
+
return curr(prev);
|
|
9
|
+
}, tr);
|
|
10
|
+
};
|