@atlaskit/editor-plugin-table 7.6.3 → 7.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/commands/column-resize.js +62 -16
- package/dist/cjs/commands/go-to-next-cell.js +5 -2
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands-with-analytics.js +8 -2
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/cjs/nodeviews/TableComponent.js +8 -6
- package/dist/cjs/nodeviews/TableContainer.js +32 -20
- package/dist/cjs/nodeviews/TableResizer.js +40 -28
- package/dist/cjs/plugin.js +60 -58
- package/dist/cjs/pm-plugins/keymap.js +26 -8
- package/dist/cjs/pm-plugins/main.js +15 -4
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/cjs/toolbar.js +5 -4
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/DragPreview/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/cjs/ui/LayoutButton/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/cjs/ui/common-styles.js +4 -0
- package/dist/cjs/ui/ui-styles.js +93 -37
- package/dist/cjs/utils/guidelines.js +1 -1
- package/dist/es2019/commands/column-resize.js +53 -4
- package/dist/es2019/commands/go-to-next-cell.js +5 -2
- package/dist/es2019/commands/misc.js +6 -2
- package/dist/es2019/commands-with-analytics.js +8 -2
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/es2019/nodeviews/TableComponent.js +9 -7
- package/dist/es2019/nodeviews/TableContainer.js +17 -3
- package/dist/es2019/nodeviews/TableResizer.js +27 -17
- package/dist/es2019/plugin.js +6 -3
- package/dist/es2019/pm-plugins/keymap.js +25 -9
- package/dist/es2019/pm-plugins/main.js +15 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/es2019/toolbar.js +5 -4
- package/dist/es2019/ui/DragHandle/index.js +2 -2
- package/dist/es2019/ui/DragPreview/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/es2019/ui/LayoutButton/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/es2019/ui/common-styles.js +4 -0
- package/dist/es2019/ui/ui-styles.js +66 -70
- package/dist/es2019/utils/guidelines.js +1 -1
- package/dist/esm/commands/column-resize.js +62 -16
- package/dist/esm/commands/go-to-next-cell.js +5 -2
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands-with-analytics.js +8 -2
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/esm/nodeviews/TableComponent.js +9 -7
- package/dist/esm/nodeviews/TableContainer.js +32 -20
- package/dist/esm/nodeviews/TableResizer.js +41 -29
- package/dist/esm/plugin.js +60 -58
- package/dist/esm/pm-plugins/keymap.js +26 -8
- package/dist/esm/pm-plugins/main.js +15 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/esm/toolbar.js +5 -4
- package/dist/esm/ui/DragHandle/index.js +2 -2
- package/dist/esm/ui/DragPreview/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/esm/ui/LayoutButton/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/esm/ui/common-styles.js +4 -0
- package/dist/esm/ui/ui-styles.js +93 -37
- package/dist/esm/utils/guidelines.js +1 -1
- package/dist/types/commands/column-resize.d.ts +23 -4
- package/dist/types/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types/commands/misc.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +2 -1
- package/dist/types/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/types.d.ts +13 -3
- package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
- package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types-ts4.5/commands/misc.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/types.d.ts +13 -3
- package/package.json +3 -6
- package/src/commands/column-resize.ts +105 -29
- package/src/commands/go-to-next-cell.ts +10 -2
- package/src/commands/misc.ts +6 -3
- package/src/commands-with-analytics.ts +11 -5
- package/src/nodeviews/ExternalDropTargets.tsx +2 -0
- package/src/nodeviews/TableComponent.tsx +14 -16
- package/src/nodeviews/TableContainer.tsx +18 -3
- package/src/nodeviews/TableResizer.tsx +35 -21
- package/src/plugin.tsx +4 -1
- package/src/pm-plugins/keymap.ts +44 -6
- package/src/pm-plugins/main.ts +18 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
- package/src/toolbar.tsx +20 -19
- package/src/types.ts +14 -2
- package/src/ui/DragHandle/index.tsx +2 -2
- package/src/ui/DragPreview/index.tsx +2 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
- package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
- package/src/ui/LayoutButton/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
- package/src/ui/common-styles.ts +2 -0
- package/src/ui/ui-styles.ts +90 -79
- package/src/utils/guidelines.ts +5 -4
|
@@ -25,7 +25,9 @@ export const DragPreview = ({
|
|
|
25
25
|
}, /*#__PURE__*/React.createElement(DragInMotionIcon, {
|
|
26
26
|
style: {
|
|
27
27
|
position: 'absolute',
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
28
29
|
marginLeft: `${marginLeft}px`,
|
|
30
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
29
31
|
marginTop: `${marginTop}px`,
|
|
30
32
|
transform: transform
|
|
31
33
|
}
|
|
@@ -94,25 +94,29 @@ export const FixedButton = ({
|
|
|
94
94
|
ref: observerTargetRef,
|
|
95
95
|
style: {
|
|
96
96
|
position: 'absolute',
|
|
97
|
-
top:
|
|
98
|
-
left:
|
|
99
|
-
width:
|
|
100
|
-
|
|
97
|
+
top: "var(--ds-space-0, 0px)",
|
|
98
|
+
left: "var(--ds-space-0, 0px)",
|
|
99
|
+
width: "var(--ds-space-250, 20px)",
|
|
100
|
+
// BUTTON_WIDTH
|
|
101
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
101
102
|
}
|
|
102
103
|
}, /*#__PURE__*/React.createElement("div", {
|
|
103
104
|
ref: fixedButtonRef,
|
|
104
105
|
style: {
|
|
105
106
|
position: 'fixed',
|
|
107
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
106
108
|
top: stickyHeader.top + stickyHeader.padding + offset * 2,
|
|
107
109
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
110
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
108
111
|
left: calcLeftPos({
|
|
109
112
|
buttonWidth: BUTTON_WIDTH,
|
|
110
113
|
cellRectLeft: targetCellRect.left,
|
|
111
114
|
cellRefWidth: targetCellRef.clientWidth,
|
|
112
115
|
offset
|
|
113
116
|
}),
|
|
114
|
-
width:
|
|
115
|
-
|
|
117
|
+
width: "var(--ds-space-250, 20px)",
|
|
118
|
+
// BUTTON_WIDTH
|
|
119
|
+
height: "var(--ds-space-250, 20px)" // BUTTON_WIDTH
|
|
116
120
|
},
|
|
117
121
|
className: ClassName.CONTEXTUAL_MENU_BUTTON_FIXED
|
|
118
122
|
}, children)), mountTo);
|
|
@@ -70,11 +70,11 @@ export class ContextualMenu extends Component {
|
|
|
70
70
|
const node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
71
71
|
const background = hexToEditorBackgroundPaletteColor((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
72
72
|
return {
|
|
73
|
-
content: isDragAndDropEnabled
|
|
73
|
+
content: isDragAndDropEnabled ? formatMessage(messages.backgroundColor) : formatMessage(messages.cellBackground),
|
|
74
74
|
value: {
|
|
75
75
|
name: 'background'
|
|
76
76
|
},
|
|
77
|
-
elemBefore: isDragAndDropEnabled
|
|
77
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
78
78
|
css: elementBeforeIconStyles
|
|
79
79
|
}, jsx(EditorBackgroundColorIcon, {
|
|
80
80
|
label: formatMessage(messages.backgroundColor),
|
|
@@ -84,7 +84,7 @@ export class ContextualMenu extends Component {
|
|
|
84
84
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
85
85
|
}, jsx("div", {
|
|
86
86
|
css: cellColourPreviewStyles(background),
|
|
87
|
-
className: isDragAndDropEnabled
|
|
87
|
+
className: isDragAndDropEnabled ? ClassName.CONTEXTUAL_MENU_ICON_SMALL : ClassName.CONTEXTUAL_MENU_ICON
|
|
88
88
|
}), isSubmenuOpen && jsx("div", {
|
|
89
89
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
90
90
|
ref: this.handleSubMenuRef
|
|
@@ -122,7 +122,7 @@ export class ContextualMenu extends Component {
|
|
|
122
122
|
name: 'merge'
|
|
123
123
|
},
|
|
124
124
|
isDisabled: !canMergeCells(state.tr),
|
|
125
|
-
elemBefore: isDragAndDropEnabled
|
|
125
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
126
126
|
css: elementBeforeIconStyles
|
|
127
127
|
}, jsx(MergeCellsIcon, null)) : undefined
|
|
128
128
|
}, {
|
|
@@ -131,7 +131,7 @@ export class ContextualMenu extends Component {
|
|
|
131
131
|
name: 'split'
|
|
132
132
|
},
|
|
133
133
|
isDisabled: !splitCell(state),
|
|
134
|
-
elemBefore: isDragAndDropEnabled
|
|
134
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
135
135
|
css: elementBeforeIconStyles
|
|
136
136
|
}, jsx(SplitCellIcon, null)) : undefined
|
|
137
137
|
}];
|
|
@@ -149,14 +149,14 @@ export class ContextualMenu extends Component {
|
|
|
149
149
|
isDragAndDropEnabled
|
|
150
150
|
} = getPluginState(editorView.state);
|
|
151
151
|
return {
|
|
152
|
-
content: formatMessage(isDragAndDropEnabled
|
|
152
|
+
content: formatMessage(isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn),
|
|
153
153
|
value: {
|
|
154
154
|
name: 'insert_column'
|
|
155
155
|
},
|
|
156
156
|
elemAfter: jsx("div", {
|
|
157
157
|
css: shortcutStyle
|
|
158
158
|
}, tooltip(addColumnAfter)),
|
|
159
|
-
elemBefore: isDragAndDropEnabled
|
|
159
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
160
160
|
css: elementBeforeIconStyles
|
|
161
161
|
}, jsx(AddColRightIcon, null)) : undefined
|
|
162
162
|
};
|
|
@@ -172,14 +172,14 @@ export class ContextualMenu extends Component {
|
|
|
172
172
|
isDragAndDropEnabled
|
|
173
173
|
} = getPluginState(editorView.state);
|
|
174
174
|
return {
|
|
175
|
-
content: formatMessage(isDragAndDropEnabled
|
|
175
|
+
content: formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow),
|
|
176
176
|
value: {
|
|
177
177
|
name: 'insert_row'
|
|
178
178
|
},
|
|
179
179
|
elemAfter: jsx("div", {
|
|
180
180
|
css: shortcutStyle
|
|
181
181
|
}, tooltip(addRowAfter)),
|
|
182
|
-
elemBefore: isDragAndDropEnabled
|
|
182
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
183
183
|
css: elementBeforeIconStyles
|
|
184
184
|
}, jsx(AddRowBelowIcon, null)) : undefined
|
|
185
185
|
};
|
|
@@ -213,7 +213,7 @@ export class ContextualMenu extends Component {
|
|
|
213
213
|
elemAfter: jsx("div", {
|
|
214
214
|
css: shortcutStyle
|
|
215
215
|
}, tooltip(backspace)),
|
|
216
|
-
elemBefore: isDragAndDropEnabled
|
|
216
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
217
217
|
css: elementBeforeIconStyles
|
|
218
218
|
}, jsx(CrossCircleIcon, {
|
|
219
219
|
label: formatMessage(messages.clearCells, {
|
|
@@ -245,7 +245,7 @@ export class ContextualMenu extends Component {
|
|
|
245
245
|
value: {
|
|
246
246
|
name: 'delete_column'
|
|
247
247
|
},
|
|
248
|
-
elemBefore: isDragAndDropEnabled
|
|
248
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
249
249
|
css: elementBeforeIconStyles
|
|
250
250
|
}, jsx(RemoveIcon, {
|
|
251
251
|
label: formatMessage(messages.removeColumns, {
|
|
@@ -277,7 +277,7 @@ export class ContextualMenu extends Component {
|
|
|
277
277
|
value: {
|
|
278
278
|
name: 'delete_row'
|
|
279
279
|
},
|
|
280
|
-
elemBefore: isDragAndDropEnabled
|
|
280
|
+
elemBefore: isDragAndDropEnabled ? jsx("span", {
|
|
281
281
|
css: elementBeforeIconStyles
|
|
282
282
|
}, jsx(RemoveIcon, {
|
|
283
283
|
label: formatMessage(messages.removeRows, {
|
|
@@ -301,7 +301,7 @@ export class ContextualMenu extends Component {
|
|
|
301
301
|
allowDistributeColumns
|
|
302
302
|
}
|
|
303
303
|
} = getPluginState(editorView.state);
|
|
304
|
-
if (allowDistributeColumns &&
|
|
304
|
+
if (allowDistributeColumns && !isDragAndDropEnabled) {
|
|
305
305
|
var _newResizeState$chang;
|
|
306
306
|
const {
|
|
307
307
|
isTableScalingEnabled = false
|
|
@@ -329,7 +329,7 @@ export class ContextualMenu extends Component {
|
|
|
329
329
|
const {
|
|
330
330
|
isDragAndDropEnabled
|
|
331
331
|
} = getPluginState(editorView.state);
|
|
332
|
-
if (allowColumnSorting &&
|
|
332
|
+
if (allowColumnSorting && !isDragAndDropEnabled) {
|
|
333
333
|
const hasMergedCellsInTable = getMergedCellsPositions(editorView.state.tr).length > 0;
|
|
334
334
|
const warning = hasMergedCellsInTable ? {
|
|
335
335
|
tooltipDescription: formatMessage(messages.canNotSortTable),
|
|
@@ -568,7 +568,7 @@ export class ContextualMenu extends Component {
|
|
|
568
568
|
const {
|
|
569
569
|
isDragAndDropEnabled
|
|
570
570
|
} = getPluginState(editorView.state);
|
|
571
|
-
const items = isDragAndDropEnabled
|
|
571
|
+
const items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
572
572
|
return jsx("div", {
|
|
573
573
|
"data-testid": "table-cell-contextual-menu",
|
|
574
574
|
onMouseLeave: this.closeSubmenu
|
|
@@ -591,7 +591,7 @@ export class ContextualMenu extends Component {
|
|
|
591
591
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
|
|
592
592
|
boundariesElement: boundariesElement,
|
|
593
593
|
offset: offset,
|
|
594
|
-
section: isDragAndDropEnabled && getBooleanFF('platform.editor.
|
|
594
|
+
section: isDragAndDropEnabled && getBooleanFF('platform.editor.menu.group-items') ? {
|
|
595
595
|
hasSeparator: true
|
|
596
596
|
} : undefined
|
|
597
597
|
}));
|
|
@@ -251,8 +251,10 @@ class FloatingDeleteButton extends Component {
|
|
|
251
251
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
252
252
|
style: {
|
|
253
253
|
position: 'fixed',
|
|
254
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
254
255
|
top: pos.top,
|
|
255
256
|
zIndex: stickyRowZIndex,
|
|
257
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
256
258
|
left: rect.left + (pos.left || 0) - (this.state.selectionType === 'column' ? this.state.scrollLeft : 0) - (this.props.isNumberColumnEnabled ? akEditorTableNumberColumnWidth : 0)
|
|
257
259
|
}
|
|
258
260
|
}, button), mountTo);
|
|
@@ -448,20 +448,20 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
448
448
|
if (!menuItems) {
|
|
449
449
|
return null;
|
|
450
450
|
}
|
|
451
|
-
if (allowBackgroundColor
|
|
451
|
+
if (allowBackgroundColor) {
|
|
452
452
|
menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
// If first row, add toggle for Header row, default is true
|
|
456
456
|
// If first column, add toggle for Header column, default is false
|
|
457
|
-
if (
|
|
457
|
+
if (index === 0) {
|
|
458
458
|
menuItems.push({
|
|
459
459
|
items: [createHeaderRowColumnMenuItem(direction)]
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
// All rows, add toggle for numbered rows, default is false
|
|
464
|
-
if (
|
|
464
|
+
if (direction === 'row') {
|
|
465
465
|
index === 0 ? menuItems[menuItems.length - 1].items.push(createRowNumbersMenuItem()) : menuItems.push({
|
|
466
466
|
items: [createRowNumbersMenuItem()]
|
|
467
467
|
});
|
|
@@ -5,7 +5,6 @@ import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem }
|
|
|
5
5
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
6
6
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { dragMenuDropdownWidth } from '../consts';
|
|
10
9
|
const DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
|
|
11
10
|
export const DropdownMenu = ({
|
|
@@ -106,37 +105,31 @@ export const DropdownMenu = ({
|
|
|
106
105
|
// The logic below normalises the index value based on the number
|
|
107
106
|
// of menu items with 2 focusable elements, and adjusts the index to ensure
|
|
108
107
|
// the correct menu item is sent in onItemActivated callback
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
const keys = ['row_numbers', 'header_row', 'header_column'];
|
|
109
|
+
let doubleItemCount = 0;
|
|
110
|
+
const firstIndex = results.findIndex(value => keys.includes(value.key));
|
|
111
|
+
if (firstIndex === -1 || index <= firstIndex) {
|
|
112
|
+
onItemActivated && onItemActivated({
|
|
113
|
+
item: results[index]
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
for (let i = firstIndex; i < results.length; i += 1) {
|
|
118
|
+
if (keys.includes(results[i].key)) {
|
|
119
|
+
doubleItemCount += 1;
|
|
120
|
+
}
|
|
121
|
+
if (firstIndex % 2 === 0 && index - doubleItemCount === i) {
|
|
114
122
|
onItemActivated && onItemActivated({
|
|
115
|
-
item: results[
|
|
123
|
+
item: results[i]
|
|
116
124
|
});
|
|
117
125
|
return;
|
|
118
126
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
onItemActivated && onItemActivated({
|
|
125
|
-
item: results[i]
|
|
126
|
-
});
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
|
|
130
|
-
onItemActivated && onItemActivated({
|
|
131
|
-
item: results[i]
|
|
132
|
-
});
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
127
|
+
if (firstIndex % 2 === 1 && index - doubleItemCount === i) {
|
|
128
|
+
onItemActivated && onItemActivated({
|
|
129
|
+
item: results[i]
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
135
132
|
}
|
|
136
|
-
} else {
|
|
137
|
-
onItemActivated && onItemActivated({
|
|
138
|
-
item: results[index]
|
|
139
|
-
});
|
|
140
133
|
}
|
|
141
134
|
}
|
|
142
135
|
}, innerMenu())));
|
|
@@ -90,6 +90,7 @@ export const InsertButtonForDragAndDrop = ({
|
|
|
90
90
|
left: "var(--ds-space-150, 12px)"
|
|
91
91
|
} : {
|
|
92
92
|
height: getInsertLineHeight(tableRef, hasStickyHeaders, true) - 8,
|
|
93
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
93
94
|
top: '-3px'
|
|
94
95
|
}
|
|
95
96
|
})));
|
|
@@ -97,7 +97,9 @@ class LayoutButton extends React.Component {
|
|
|
97
97
|
"aria-label": title,
|
|
98
98
|
style: {
|
|
99
99
|
position: 'fixed',
|
|
100
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
100
101
|
top: pos.top + 22,
|
|
102
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
101
103
|
left: tablePos.right
|
|
102
104
|
}
|
|
103
105
|
}, button);
|
|
@@ -187,7 +187,9 @@ export const ColumnControls = ({
|
|
|
187
187
|
"data-testid": "table-floating-column-controls",
|
|
188
188
|
style: {
|
|
189
189
|
gridTemplateColumns: widths,
|
|
190
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
190
191
|
marginTop,
|
|
192
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
191
193
|
width: stickyTop ? containerWidth : undefined,
|
|
192
194
|
overflowX: stickyTop ? 'hidden' : 'visible',
|
|
193
195
|
pointerEvents: isDragging ? 'none' : undefined
|
|
@@ -74,8 +74,11 @@ export const ColumnDropTarget = ({
|
|
|
74
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
75
75
|
ref: dropTargetRef,
|
|
76
76
|
style: {
|
|
77
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
77
78
|
width: width && `${width - 1}px`,
|
|
79
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
78
80
|
height: height && `${height}px`,
|
|
81
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
79
82
|
marginTop: marginTop && `${marginTop}px`,
|
|
80
83
|
pointerEvents: 'auto',
|
|
81
84
|
flexShrink: 0
|
|
@@ -67,6 +67,7 @@ class CornerControlComponent extends Component {
|
|
|
67
67
|
sticky: this.props.stickyTop !== undefined
|
|
68
68
|
}),
|
|
69
69
|
style: {
|
|
70
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
70
71
|
top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
|
|
71
72
|
},
|
|
72
73
|
contentEditable: false
|
|
@@ -93,6 +93,7 @@ export default class NumberColumn extends Component {
|
|
|
93
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
94
94
|
className: ClassName.NUMBERED_COLUMN,
|
|
95
95
|
style: {
|
|
96
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
96
97
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
97
98
|
borderLeft: isDragAndDropEnabled && tableActive ? `1px solid ${tableBorderColor}` : undefined
|
|
98
99
|
},
|
|
@@ -58,9 +58,13 @@ class RowControlsComponent extends Component {
|
|
|
58
58
|
className: `${ClassName.ROW_CONTROLS_BUTTON_WRAP} ${getRowClassNames(startIndex, selectionState || selection, hoveredRows, isInDanger, isResizing)} ${thisRowSticky ? 'sticky' : ''}`,
|
|
59
59
|
key: startIndex,
|
|
60
60
|
style: {
|
|
61
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
61
62
|
height: height,
|
|
63
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
62
64
|
marginTop: `${marginTop}px`,
|
|
65
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
63
66
|
top: thisRowSticky ? `${this.props.stickyTop + 3}px` : undefined,
|
|
67
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
64
68
|
paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
|
|
65
69
|
}
|
|
66
70
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -127,6 +127,7 @@ const DragControlsComponent = ({
|
|
|
127
127
|
width: '9px',
|
|
128
128
|
height: '100%',
|
|
129
129
|
position: 'relative',
|
|
130
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
130
131
|
right: '-0.5px'
|
|
131
132
|
},
|
|
132
133
|
"data-testid": `table-floating-row-${isHover ? rowIndex : selectedRowIndexes[0]}-drag-handle`
|
|
@@ -171,7 +172,8 @@ const DragControlsComponent = ({
|
|
|
171
172
|
style: {
|
|
172
173
|
gridTemplateRows: heights,
|
|
173
174
|
gridTemplateColumns: isDragging ? `${dropTargetExtendedWidth}px 14px ${tableWidth}px` : '0px 14px 0px',
|
|
174
|
-
|
|
175
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
176
|
+
left: isDragging ? `-${dropTargetExtendedWidth + 2}px` : "var(--ds-space-negative-025, -2px)"
|
|
175
177
|
},
|
|
176
178
|
onMouseMove: handleMouseMove,
|
|
177
179
|
contentEditable: false
|
|
@@ -130,6 +130,8 @@ const tableBorderStyles = () => {
|
|
|
130
130
|
return `border: 1px solid ${tableBorderDeleteColor}`;
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
133
135
|
const tableStickyHeaderColumnControlsDecorationsStyle = () => {
|
|
134
136
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
135
137
|
return css`
|
|
@@ -1012,6 +1014,8 @@ export const tableStyles = props => css`
|
|
|
1012
1014
|
|
|
1013
1015
|
${shadowSentinelStyles}
|
|
1014
1016
|
`;
|
|
1017
|
+
|
|
1018
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
1015
1019
|
export const tableFullPageEditorStyles = css`
|
|
1016
1020
|
.ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
1017
1021
|
margin-left: 0;
|
|
@@ -14,14 +14,14 @@ const InsertLine = cssString => css`
|
|
|
14
14
|
${cssString}
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
|
-
const Marker = () => css
|
|
18
|
-
|
|
19
|
-
position: absolute
|
|
20
|
-
height:
|
|
21
|
-
width:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const Marker = () => css({
|
|
18
|
+
backgroundColor: tableBorderColor,
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
height: `${lineMarkerSize}px`,
|
|
21
|
+
width: `${lineMarkerSize}px`,
|
|
22
|
+
borderRadius: '50%',
|
|
23
|
+
pointerEvents: 'none'
|
|
24
|
+
});
|
|
25
25
|
export const InsertMarker = cssString => css`
|
|
26
26
|
.${ClassName.CONTROLS_INSERT_MARKER} {
|
|
27
27
|
${Marker()};
|
|
@@ -49,6 +49,9 @@ const Button = cssString => css`
|
|
|
49
49
|
}
|
|
50
50
|
${cssString}
|
|
51
51
|
`;
|
|
52
|
+
|
|
53
|
+
// Explicit pixel values required here to ensure classic row controls align correctly
|
|
54
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
52
55
|
export const HeaderButton = cssString => css`
|
|
53
56
|
.${ClassName.CONTROLS_BUTTON} {
|
|
54
57
|
background: ${tableHeaderCellBackgroundColor};
|
|
@@ -214,23 +217,15 @@ export const dragCornerControlButton = () => css`
|
|
|
214
217
|
position: relative;
|
|
215
218
|
}
|
|
216
219
|
`;
|
|
217
|
-
export const insertColumnButtonWrapper = () => css`
|
|
218
|
-
${InsertButton()}
|
|
219
|
-
${InsertButtonHover()}
|
|
220
|
-
${InsertLine(`
|
|
220
|
+
export const insertColumnButtonWrapper = () => css(InsertButton(), InsertButtonHover(), InsertLine(`
|
|
221
221
|
width: 2px;
|
|
222
222
|
left: 9px;
|
|
223
|
-
`)
|
|
224
|
-
|
|
225
|
-
export const insertRowButtonWrapper = () => css`
|
|
226
|
-
${InsertButton()}
|
|
227
|
-
${InsertButtonHover()}
|
|
228
|
-
${InsertLine(`
|
|
223
|
+
`));
|
|
224
|
+
export const insertRowButtonWrapper = () => css(InsertButton(), InsertButtonHover(), InsertLine(`
|
|
229
225
|
height: 2px;
|
|
230
226
|
top: -11px;
|
|
231
227
|
left: ${tableInsertColumnButtonSize - 1}px;
|
|
232
|
-
`)
|
|
233
|
-
`;
|
|
228
|
+
`));
|
|
234
229
|
export const columnControlsLineMarker = () => css`
|
|
235
230
|
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}
|
|
236
231
|
table
|
|
@@ -324,40 +319,34 @@ const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
|
|
|
324
319
|
};
|
|
325
320
|
const columnHeaderButton = cssString => {
|
|
326
321
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
327
|
-
return css
|
|
328
|
-
background:
|
|
329
|
-
display: block
|
|
330
|
-
|
|
331
|
-
padding: 0
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
outline: none;
|
|
322
|
+
return css({
|
|
323
|
+
background: tableHeaderCellBackgroundColor,
|
|
324
|
+
display: 'block',
|
|
325
|
+
boxSizing: 'border-box',
|
|
326
|
+
padding: 0,
|
|
327
|
+
':focus': {
|
|
328
|
+
outline: 'none'
|
|
335
329
|
}
|
|
336
|
-
|
|
337
|
-
${cssString}
|
|
338
|
-
`;
|
|
330
|
+
}, cssString);
|
|
339
331
|
} else {
|
|
340
|
-
return css
|
|
341
|
-
background:
|
|
342
|
-
border: 1px solid ${tableBorderColor}
|
|
343
|
-
display: block
|
|
344
|
-
|
|
345
|
-
padding: 0
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
outline: none;
|
|
332
|
+
return css({
|
|
333
|
+
background: tableHeaderCellBackgroundColor,
|
|
334
|
+
border: `1px solid ${tableBorderColor}`,
|
|
335
|
+
display: 'block',
|
|
336
|
+
boxSizing: 'border-box',
|
|
337
|
+
padding: 0,
|
|
338
|
+
':focus': {
|
|
339
|
+
outline: 'none'
|
|
349
340
|
}
|
|
350
|
-
|
|
351
|
-
${cssString}
|
|
352
|
-
`;
|
|
341
|
+
}, cssString);
|
|
353
342
|
}
|
|
354
343
|
};
|
|
355
|
-
const columnHeaderButtonSelected = () => css
|
|
356
|
-
color:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
344
|
+
const columnHeaderButtonSelected = () => css({
|
|
345
|
+
color: `var(--ds-text-inverse, ${N0})`,
|
|
346
|
+
backgroundColor: tableToolbarSelectedColor,
|
|
347
|
+
borderColor: tableBorderSelectedColor,
|
|
348
|
+
zIndex: columnControlsSelectedZIndex
|
|
349
|
+
});
|
|
361
350
|
const getFloatingDotOverrides = () => {
|
|
362
351
|
return getBooleanFF('platform.editor.custom-table-width') ? css`
|
|
363
352
|
tr
|
|
@@ -680,6 +669,9 @@ const getLastColumnResizerOverrides = () => {
|
|
|
680
669
|
}
|
|
681
670
|
` : '';
|
|
682
671
|
};
|
|
672
|
+
|
|
673
|
+
// Explicit pixel values required here to ensure correct positioning and sizes of column resize handle
|
|
674
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
683
675
|
const resizeHandleOverrides = isDragAndDropEnabled => {
|
|
684
676
|
if (isDragAndDropEnabled) {
|
|
685
677
|
return css`
|
|
@@ -786,27 +778,31 @@ export const resizeHandle = isDragAndDropEnabled => css`
|
|
|
786
778
|
`;
|
|
787
779
|
|
|
788
780
|
// Drag and Drop: drop target insert line
|
|
789
|
-
const tableCellColumnInsertLineStyles = css
|
|
790
|
-
content: ' '
|
|
791
|
-
position: absolute
|
|
792
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px)
|
|
793
|
-
width:
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
const tableCellRowInsertLineStyles = css
|
|
797
|
-
content: ' '
|
|
798
|
-
position: absolute
|
|
799
|
-
left:
|
|
800
|
-
height:
|
|
801
|
-
width: calc(100% + ${tableCellBorderWidth * 2}px)
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
const insertLineActiveColor = css
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
const insertLineInactiveColor = css
|
|
808
|
-
|
|
809
|
-
|
|
781
|
+
const tableCellColumnInsertLineStyles = css({
|
|
782
|
+
content: "' '",
|
|
783
|
+
position: 'absolute',
|
|
784
|
+
height: `calc(100% + ${tableCellBorderWidth * 2}px)`,
|
|
785
|
+
width: `${insertLineWidth}px`,
|
|
786
|
+
zIndex: columnControlsZIndex * 2
|
|
787
|
+
});
|
|
788
|
+
const tableCellRowInsertLineStyles = css({
|
|
789
|
+
content: "' '",
|
|
790
|
+
position: 'absolute',
|
|
791
|
+
left: "var(--ds-space-negative-025, -2px)",
|
|
792
|
+
height: `${insertLineWidth}px`,
|
|
793
|
+
width: `calc(100% + ${tableCellBorderWidth * 2}px)`,
|
|
794
|
+
zIndex: columnControlsZIndex * 2
|
|
795
|
+
});
|
|
796
|
+
const insertLineActiveColor = css({
|
|
797
|
+
backgroundColor: tableBorderSelectedColor
|
|
798
|
+
});
|
|
799
|
+
const insertLineInactiveColor = css({
|
|
800
|
+
backgroundColor: `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
// Explicit pixel values required here to ensure correct positioning of line that is show on row
|
|
804
|
+
// or column drag
|
|
805
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
810
806
|
export const insertLine = () => css`
|
|
811
807
|
.${ClassName.TABLE_CONTAINER} {
|
|
812
808
|
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
@@ -4,4 +4,4 @@ import { calculateDefaultSnappings, calculateDefaultTablePreserveSnappings } fro
|
|
|
4
4
|
// NOTE: We have to take 1 pixel off every length due to the fact that the tbody is 1px smaller then the table container.
|
|
5
5
|
// If we don't do this then the guidelines will not align correctly to the edge of the table
|
|
6
6
|
export const defaultGuidelines = createFixedGuidelinesFromLengths([0, ...calculateDefaultSnappings(-1)]);
|
|
7
|
-
export const defaultGuidelinesForPreserveTable = editorContainerWidth => createFixedGuidelinesFromLengths([0, ...calculateDefaultTablePreserveSnappings(-1, editorContainerWidth)]);
|
|
7
|
+
export const defaultGuidelinesForPreserveTable = editorContainerWidth => createFixedGuidelinesFromLengths([0, ...calculateDefaultTablePreserveSnappings(-1, editorContainerWidth)], undefined, true);
|