@atlaskit/editor-plugin-table 10.5.0 → 10.5.2
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 +17 -0
- package/dist/cjs/nodeviews/TableComponent.js +4 -3
- package/dist/cjs/pm-plugins/utils/paste.js +2 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +0 -2
- package/dist/es2019/nodeviews/TableComponent.js +4 -3
- package/dist/es2019/pm-plugins/utils/paste.js +2 -1
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +0 -2
- package/dist/esm/nodeviews/TableComponent.js +4 -3
- package/dist/esm/pm-plugins/utils/paste.js +2 -1
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +0 -2
- package/package.json +6 -9
- package/src/nodeviews/TableComponent.tsx +3 -4
- package/src/pm-plugins/utils/drag-menu.tsx +121 -40
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -2
- package/src/ui/toolbar.tsx +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130115](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130115)
|
|
8
|
+
[`e60f1c02e9715`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e60f1c02e9715) -
|
|
9
|
+
Clean up feature flag platform_editor_table_drag_menu_mount_point_fix
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 10.5.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#130002](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130002)
|
|
17
|
+
[`e273880dffa90`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e273880dffa90) -
|
|
18
|
+
Clean up feature flag platform_editor_nested_table_in_nested_parent_fix
|
|
19
|
+
|
|
3
20
|
## 10.5.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -170,7 +170,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
170
170
|
var prevAttrs = prevNode.attrs;
|
|
171
171
|
var isNested = (0, _nodes.isTableNested)(_this.props.view.state, _this.props.getPos());
|
|
172
172
|
var parentWidth = _this.getParentNodeWidth();
|
|
173
|
-
if (isNested && (0, _nodes.isTableNestedInMoreThanOneNode)(_this.props.view.state, _this.props.getPos())
|
|
173
|
+
if (isNested && (0, _nodes.isTableNestedInMoreThanOneNode)(_this.props.view.state, _this.props.getPos())) {
|
|
174
174
|
var resizeObsWrapperWidth = _this.wrapperWidth || 0;
|
|
175
175
|
var wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (_this.state.parentWidth || 0));
|
|
176
176
|
var isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -428,14 +428,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
428
428
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
429
429
|
this.handleColgroupUpdates(true);
|
|
430
430
|
}
|
|
431
|
-
if (this.wrapper
|
|
431
|
+
if (this.wrapper) {
|
|
432
432
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
433
433
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
434
434
|
_step2;
|
|
435
435
|
try {
|
|
436
436
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
437
|
+
var _entry$contentRect3;
|
|
437
438
|
var entry = _step2.value;
|
|
438
|
-
_this2.wrapperWidth = entry.contentRect.width;
|
|
439
|
+
_this2.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
439
440
|
}
|
|
440
441
|
} catch (err) {
|
|
441
442
|
_iterator2.e(err);
|
|
@@ -90,7 +90,8 @@ var transformSliceToRemoveNestedTables = exports.transformSliceToRemoveNestedTab
|
|
|
90
90
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
91
91
|
var isPasteInTable = (0, _utils2.hasParentNodeOfType)([table, tableCell, tableHeader])(selection);
|
|
92
92
|
var isPasteInNestedTable = (0, _nesting.getParentOfTypeCount)(schema.nodes.table)(selection.$from) > 1;
|
|
93
|
-
var
|
|
93
|
+
var isPasteFullTableInsideEmptyCellEnabled = (0, _platformFeatureFlags.fg)('platform_editor_paste_full_table_inside_empty_cell');
|
|
94
|
+
var isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && (!isPasteFullTableInsideEmptyCellEnabled || slice.openStart !== 0 && slice.openEnd !== 0);
|
|
94
95
|
|
|
95
96
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
96
97
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
@@ -23,7 +23,6 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
23
23
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
24
24
|
var _paintBucketEditorBackgroundColor = _interopRequireDefault(require("@atlaskit/icon/core/migration/paint-bucket--editor-background-color"));
|
|
25
25
|
var _paintBucket = _interopRequireDefault(require("@atlaskit/icon/core/paint-bucket"));
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _primitives = require("@atlaskit/primitives");
|
|
28
27
|
var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
|
|
29
28
|
var _commands = require("../../pm-plugins/commands");
|
|
@@ -519,7 +518,6 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
519
518
|
fitHeight: fitHeight,
|
|
520
519
|
fitWidth: fitWidth,
|
|
521
520
|
direction: direction,
|
|
522
|
-
mountPoint: (0, _platformFeatureFlags.fg)('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
|
|
523
521
|
boundariesElement: boundariesElement,
|
|
524
522
|
scrollableElement: scrollableElement
|
|
525
523
|
});
|
|
@@ -158,7 +158,7 @@ class TableComponent extends React.Component {
|
|
|
158
158
|
const prevAttrs = prevNode.attrs;
|
|
159
159
|
const isNested = isTableNested(this.props.view.state, this.props.getPos());
|
|
160
160
|
let parentWidth = this.getParentNodeWidth();
|
|
161
|
-
if (isNested && isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
161
|
+
if (isNested && isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())) {
|
|
162
162
|
const resizeObsWrapperWidth = this.wrapperWidth || 0;
|
|
163
163
|
const wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (this.state.parentWidth || 0));
|
|
164
164
|
const isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -411,10 +411,11 @@ class TableComponent extends React.Component {
|
|
|
411
411
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
412
412
|
this.handleColgroupUpdates(true);
|
|
413
413
|
}
|
|
414
|
-
if (this.wrapper
|
|
414
|
+
if (this.wrapper) {
|
|
415
415
|
this.wrapperReisizeObserver = new ResizeObserver(entries => {
|
|
416
416
|
for (const entry of entries) {
|
|
417
|
-
|
|
417
|
+
var _entry$contentRect3;
|
|
418
|
+
this.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
418
419
|
}
|
|
419
420
|
});
|
|
420
421
|
this.wrapperReisizeObserver.observe(this.wrapper);
|
|
@@ -80,7 +80,8 @@ export const transformSliceToRemoveNestedTables = (slice, schema, selection) =>
|
|
|
80
80
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
81
81
|
const isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
82
82
|
const isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
83
|
-
const
|
|
83
|
+
const isPasteFullTableInsideEmptyCellEnabled = fg('platform_editor_paste_full_table_inside_empty_cell');
|
|
84
|
+
const isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && (!isPasteFullTableInsideEmptyCellEnabled || slice.openStart !== 0 && slice.openEnd !== 0);
|
|
84
85
|
|
|
85
86
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
86
87
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
@@ -21,7 +21,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
21
21
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
22
22
|
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
23
23
|
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
24
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
26
25
|
import Toggle from '@atlaskit/toggle';
|
|
27
26
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
|
|
@@ -518,7 +517,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
518
517
|
fitHeight: fitHeight,
|
|
519
518
|
fitWidth: fitWidth,
|
|
520
519
|
direction: direction,
|
|
521
|
-
mountPoint: fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
|
|
522
520
|
boundariesElement: boundariesElement,
|
|
523
521
|
scrollableElement: scrollableElement
|
|
524
522
|
});
|
|
@@ -164,7 +164,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
164
164
|
var prevAttrs = prevNode.attrs;
|
|
165
165
|
var isNested = isTableNested(_this.props.view.state, _this.props.getPos());
|
|
166
166
|
var parentWidth = _this.getParentNodeWidth();
|
|
167
|
-
if (isNested && isTableNestedInMoreThanOneNode(_this.props.view.state, _this.props.getPos())
|
|
167
|
+
if (isNested && isTableNestedInMoreThanOneNode(_this.props.view.state, _this.props.getPos())) {
|
|
168
168
|
var resizeObsWrapperWidth = _this.wrapperWidth || 0;
|
|
169
169
|
var wrapperWidthDiffBetweenRerenders = Math.abs(resizeObsWrapperWidth - (_this.state.parentWidth || 0));
|
|
170
170
|
var isOusideOfThreshold = wrapperWidthDiffBetweenRerenders <= NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD || wrapperWidthDiffBetweenRerenders > NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD;
|
|
@@ -422,14 +422,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
422
422
|
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
423
423
|
this.handleColgroupUpdates(true);
|
|
424
424
|
}
|
|
425
|
-
if (this.wrapper
|
|
425
|
+
if (this.wrapper) {
|
|
426
426
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
427
427
|
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
428
428
|
_step2;
|
|
429
429
|
try {
|
|
430
430
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
431
|
+
var _entry$contentRect3;
|
|
431
432
|
var entry = _step2.value;
|
|
432
|
-
_this2.wrapperWidth = entry.contentRect.width;
|
|
433
|
+
_this2.wrapperWidth = (_entry$contentRect3 = entry.contentRect) === null || _entry$contentRect3 === void 0 ? void 0 : _entry$contentRect3.width;
|
|
433
434
|
}
|
|
434
435
|
} catch (err) {
|
|
435
436
|
_iterator2.e(err);
|
|
@@ -83,7 +83,8 @@ export var transformSliceToRemoveNestedTables = function transformSliceToRemoveN
|
|
|
83
83
|
var _slice$content$firstC, _slice$content$lastCh;
|
|
84
84
|
var isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
85
85
|
var isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
86
|
-
var
|
|
86
|
+
var isPasteFullTableInsideEmptyCellEnabled = fg('platform_editor_paste_full_table_inside_empty_cell');
|
|
87
|
+
var isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && (!isPasteFullTableInsideEmptyCellEnabled || slice.openStart !== 0 && slice.openEnd !== 0);
|
|
87
88
|
|
|
88
89
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
89
90
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
@@ -23,7 +23,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
23
23
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
24
24
|
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
25
25
|
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
26
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
26
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
28
27
|
import Toggle from '@atlaskit/toggle';
|
|
29
28
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
|
|
@@ -508,7 +507,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
508
507
|
fitHeight: fitHeight,
|
|
509
508
|
fitWidth: fitWidth,
|
|
510
509
|
direction: direction,
|
|
511
|
-
mountPoint: fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
|
|
512
510
|
boundariesElement: boundariesElement,
|
|
513
511
|
scrollableElement: scrollableElement
|
|
514
512
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
33
|
"@atlaskit/button": "^21.1.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
35
|
+
"@atlaskit/editor-common": "^102.13.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
55
55
|
"@atlaskit/primitives": "^14.2.0",
|
|
56
56
|
"@atlaskit/theme": "^18.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^4.2.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.0.0",
|
|
59
59
|
"@atlaskit/tokens": "^4.5.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.0.0",
|
|
@@ -116,9 +116,6 @@
|
|
|
116
116
|
"platform_editor_batch_steps_table": {
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
-
"platform_editor_nested_table_in_nested_parent_fix": {
|
|
120
|
-
"type": "boolean"
|
|
121
|
-
},
|
|
122
119
|
"platform-visual-refresh-icons": {
|
|
123
120
|
"type": "boolean"
|
|
124
121
|
},
|
|
@@ -129,9 +126,6 @@
|
|
|
129
126
|
"platform_editor_set_alignment_when_resized": {
|
|
130
127
|
"type": "boolean"
|
|
131
128
|
},
|
|
132
|
-
"platform_editor_table_drag_menu_mount_point_fix": {
|
|
133
|
-
"type": "boolean"
|
|
134
|
-
},
|
|
135
129
|
"platform_editor_table_overflow_in_full_width_fix": {
|
|
136
130
|
"type": "boolean"
|
|
137
131
|
},
|
|
@@ -194,6 +188,9 @@
|
|
|
194
188
|
},
|
|
195
189
|
"platform_editor_scroll_table_flickering_fix": {
|
|
196
190
|
"type": "boolean"
|
|
191
|
+
},
|
|
192
|
+
"platform_editor_paste_full_table_inside_empty_cell": {
|
|
193
|
+
"type": "boolean"
|
|
197
194
|
}
|
|
198
195
|
}
|
|
199
196
|
}
|
|
@@ -286,10 +286,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
286
286
|
this.handleColgroupUpdates(true);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
if (this.wrapper
|
|
289
|
+
if (this.wrapper) {
|
|
290
290
|
this.wrapperReisizeObserver = new ResizeObserver((entries) => {
|
|
291
291
|
for (const entry of entries) {
|
|
292
|
-
this.wrapperWidth = entry.contentRect
|
|
292
|
+
this.wrapperWidth = entry.contentRect?.width;
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
@@ -1193,8 +1193,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1193
1193
|
|
|
1194
1194
|
if (
|
|
1195
1195
|
isNested &&
|
|
1196
|
-
isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
1197
|
-
fg('platform_editor_nested_table_in_nested_parent_fix')
|
|
1196
|
+
isTableNestedInMoreThanOneNode(this.props.view.state, this.props.getPos())
|
|
1198
1197
|
) {
|
|
1199
1198
|
const resizeObsWrapperWidth = this.wrapperWidth || 0;
|
|
1200
1199
|
|
|
@@ -183,13 +183,25 @@ export const getDragMenuConfig = (
|
|
|
183
183
|
{
|
|
184
184
|
label: 'above',
|
|
185
185
|
offset: 0,
|
|
186
|
-
icon: () =>
|
|
186
|
+
icon: () => (
|
|
187
|
+
<TableRowAddAboveIcon
|
|
188
|
+
LEGACY_fallbackIcon={AddRowAboveIcon}
|
|
189
|
+
spacing={'spacious'}
|
|
190
|
+
label={''}
|
|
191
|
+
/>
|
|
192
|
+
),
|
|
187
193
|
keymap: addRowBefore,
|
|
188
194
|
},
|
|
189
195
|
{
|
|
190
196
|
label: 'below',
|
|
191
197
|
offset: 1,
|
|
192
|
-
icon: () =>
|
|
198
|
+
icon: () => (
|
|
199
|
+
<TableRowAddBelowIcon
|
|
200
|
+
LEGACY_fallbackIcon={AddRowBelowIcon}
|
|
201
|
+
spacing={'spacious'}
|
|
202
|
+
label={''}
|
|
203
|
+
/>
|
|
204
|
+
),
|
|
193
205
|
keymap: addRowAfter,
|
|
194
206
|
},
|
|
195
207
|
]
|
|
@@ -197,13 +209,25 @@ export const getDragMenuConfig = (
|
|
|
197
209
|
{
|
|
198
210
|
label: 'left',
|
|
199
211
|
offset: 0,
|
|
200
|
-
icon: () =>
|
|
212
|
+
icon: () => (
|
|
213
|
+
<TableColumnAddLeftIcon
|
|
214
|
+
LEGACY_fallbackIcon={AddColLeftIcon}
|
|
215
|
+
spacing={'spacious'}
|
|
216
|
+
label={''}
|
|
217
|
+
/>
|
|
218
|
+
),
|
|
201
219
|
keymap: addColumnBefore,
|
|
202
220
|
},
|
|
203
221
|
{
|
|
204
222
|
label: 'right',
|
|
205
223
|
offset: 1,
|
|
206
|
-
icon: () =>
|
|
224
|
+
icon: () => (
|
|
225
|
+
<TableColumnAddRightIcon
|
|
226
|
+
LEGACY_fallbackIcon={AddColRightIcon}
|
|
227
|
+
spacing={'spacious'}
|
|
228
|
+
label={''}
|
|
229
|
+
/>
|
|
230
|
+
),
|
|
207
231
|
keymap: addColumnAfter,
|
|
208
232
|
},
|
|
209
233
|
];
|
|
@@ -212,7 +236,13 @@ export const getDragMenuConfig = (
|
|
|
212
236
|
? [
|
|
213
237
|
{
|
|
214
238
|
label: 'up',
|
|
215
|
-
icon: () =>
|
|
239
|
+
icon: () => (
|
|
240
|
+
<TableRowMoveUpIcon
|
|
241
|
+
LEGACY_fallbackIcon={ArrowUpIcon}
|
|
242
|
+
spacing={'spacious'}
|
|
243
|
+
label={''}
|
|
244
|
+
/>
|
|
245
|
+
),
|
|
216
246
|
keymap: moveRowUp,
|
|
217
247
|
canMove: canMove('table-row', -1, tableMap?.height ?? 0, selection, selectionRect),
|
|
218
248
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -220,7 +250,13 @@ export const getDragMenuConfig = (
|
|
|
220
250
|
},
|
|
221
251
|
{
|
|
222
252
|
label: 'down',
|
|
223
|
-
icon: () =>
|
|
253
|
+
icon: () => (
|
|
254
|
+
<TableRowMoveDownIcon
|
|
255
|
+
LEGACY_fallbackIcon={ArrowDownIcon}
|
|
256
|
+
spacing={'spacious'}
|
|
257
|
+
label={''}
|
|
258
|
+
/>
|
|
259
|
+
),
|
|
224
260
|
keymap: moveRowDown,
|
|
225
261
|
canMove: canMove('table-row', 1, tableMap?.height ?? 0, selection, selectionRect),
|
|
226
262
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -230,7 +266,13 @@ export const getDragMenuConfig = (
|
|
|
230
266
|
: [
|
|
231
267
|
{
|
|
232
268
|
label: 'left',
|
|
233
|
-
icon: () =>
|
|
269
|
+
icon: () => (
|
|
270
|
+
<TableColumnMoveLeftIcon
|
|
271
|
+
LEGACY_fallbackIcon={ArrowLeftIcon}
|
|
272
|
+
spacing={'spacious'}
|
|
273
|
+
label={''}
|
|
274
|
+
/>
|
|
275
|
+
),
|
|
234
276
|
keymap: moveColumnLeft,
|
|
235
277
|
canMove: canMove('table-column', -1, tableMap?.width ?? 0, selection, selectionRect),
|
|
236
278
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -238,7 +280,13 @@ export const getDragMenuConfig = (
|
|
|
238
280
|
},
|
|
239
281
|
{
|
|
240
282
|
label: 'right',
|
|
241
|
-
icon: () =>
|
|
283
|
+
icon: () => (
|
|
284
|
+
<TableColumnMoveRightIcon
|
|
285
|
+
LEGACY_fallbackIcon={ArrowRightIcon}
|
|
286
|
+
spacing={'spacious'}
|
|
287
|
+
label={''}
|
|
288
|
+
/>
|
|
289
|
+
),
|
|
242
290
|
keymap: moveColumnRight,
|
|
243
291
|
canMove: canMove('table-column', 1, tableMap?.width ?? 0, selection, selectionRect),
|
|
244
292
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -251,12 +299,24 @@ export const getDragMenuConfig = (
|
|
|
251
299
|
{
|
|
252
300
|
label: 'increasing',
|
|
253
301
|
order: SortOrder.ASC,
|
|
254
|
-
icon: () =>
|
|
302
|
+
icon: () => (
|
|
303
|
+
<SortAscendingIcon
|
|
304
|
+
LEGACY_fallbackIcon={HipchatChevronDoubleUpIcon}
|
|
305
|
+
spacing={'spacious'}
|
|
306
|
+
label={''}
|
|
307
|
+
/>
|
|
308
|
+
),
|
|
255
309
|
},
|
|
256
310
|
{
|
|
257
311
|
label: 'decreasing',
|
|
258
312
|
order: SortOrder.DESC,
|
|
259
|
-
icon: () =>
|
|
313
|
+
icon: () => (
|
|
314
|
+
<SortDescendingIcon
|
|
315
|
+
LEGACY_fallbackIcon={HipchatChevronDoubleDownIcon}
|
|
316
|
+
spacing={'spacious'}
|
|
317
|
+
label={''}
|
|
318
|
+
/>
|
|
319
|
+
),
|
|
260
320
|
},
|
|
261
321
|
]
|
|
262
322
|
: [];
|
|
@@ -329,7 +389,13 @@ export const getDragMenuConfig = (
|
|
|
329
389
|
}
|
|
330
390
|
return false;
|
|
331
391
|
},
|
|
332
|
-
icon: () =>
|
|
392
|
+
icon: () => (
|
|
393
|
+
<TableColumnsDistributeIcon
|
|
394
|
+
LEGACY_fallbackIcon={EditorLayoutThreeEqualIcon}
|
|
395
|
+
spacing={'spacious'}
|
|
396
|
+
label={''}
|
|
397
|
+
/>
|
|
398
|
+
),
|
|
333
399
|
}
|
|
334
400
|
: undefined,
|
|
335
401
|
{
|
|
@@ -342,7 +408,9 @@ export const getDragMenuConfig = (
|
|
|
342
408
|
)(state, dispatch);
|
|
343
409
|
return true;
|
|
344
410
|
},
|
|
345
|
-
icon: () =>
|
|
411
|
+
icon: () => (
|
|
412
|
+
<TableCellClearIcon LEGACY_fallbackIcon={CrossCircleIcon} spacing={'spacious'} label={''} />
|
|
413
|
+
),
|
|
346
414
|
keymap: tooltip(backspace),
|
|
347
415
|
},
|
|
348
416
|
{
|
|
@@ -371,36 +439,49 @@ export const getDragMenuConfig = (
|
|
|
371
439
|
}
|
|
372
440
|
return true;
|
|
373
441
|
},
|
|
374
|
-
icon:
|
|
442
|
+
icon:
|
|
443
|
+
direction === 'row'
|
|
444
|
+
? () => (
|
|
445
|
+
<TableRowDeleteIcon
|
|
446
|
+
LEGACY_fallbackIcon={RemoveIcon}
|
|
447
|
+
spacing={'spacious'}
|
|
448
|
+
label={''}
|
|
449
|
+
/>
|
|
450
|
+
)
|
|
451
|
+
: () => (
|
|
452
|
+
<TableColumnDeleteIcon
|
|
453
|
+
LEGACY_fallbackIcon={RemoveIcon}
|
|
454
|
+
spacing={'spacious'}
|
|
455
|
+
label={''}
|
|
456
|
+
/>
|
|
457
|
+
),
|
|
375
458
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn),
|
|
376
459
|
},
|
|
377
|
-
...moveOptions.map(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}),
|
|
403
|
-
),
|
|
460
|
+
...moveOptions.map(({ label, canMove, icon, keymap, getOriginIndexes, getTargetIndex }) => ({
|
|
461
|
+
id: `move_${direction}_${label}`,
|
|
462
|
+
title: `Move ${direction} ${label}`,
|
|
463
|
+
disabled: !canMove,
|
|
464
|
+
icon: icon,
|
|
465
|
+
onClick: (state: EditorState, dispatch?: CommandDispatch) => {
|
|
466
|
+
if (canMove) {
|
|
467
|
+
requestAnimationFrame(() => {
|
|
468
|
+
moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(
|
|
469
|
+
INPUT_METHOD.TABLE_CONTEXT_MENU,
|
|
470
|
+
`table-${direction}`,
|
|
471
|
+
// Ignored via go/ees005
|
|
472
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
473
|
+
getOriginIndexes(selectionRect!),
|
|
474
|
+
// Ignored via go/ees005
|
|
475
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
476
|
+
getTargetIndex(selectionRect!),
|
|
477
|
+
)(editorView.state, editorView.dispatch);
|
|
478
|
+
});
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
return false;
|
|
482
|
+
},
|
|
483
|
+
keymap: keymap && tooltip(keymap),
|
|
484
|
+
})),
|
|
404
485
|
];
|
|
405
486
|
|
|
406
487
|
const allConfigs = [...restConfigs];
|
|
@@ -106,12 +106,14 @@ export const transformSliceToRemoveNestedTables = (
|
|
|
106
106
|
if (isNestingAllowed) {
|
|
107
107
|
const isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
|
|
108
108
|
const isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
|
|
109
|
+
const isPasteFullTableInsideEmptyCellEnabled = fg(
|
|
110
|
+
'platform_editor_paste_full_table_inside_empty_cell',
|
|
111
|
+
);
|
|
109
112
|
const isCellPaste =
|
|
110
113
|
isPasteInTable &&
|
|
111
114
|
slice.content.childCount === 1 &&
|
|
112
115
|
slice.content.firstChild?.type === table &&
|
|
113
|
-
slice.openStart !== 0 &&
|
|
114
|
-
slice.openEnd !== 0;
|
|
116
|
+
(!isPasteFullTableInsideEmptyCellEnabled || (slice.openStart !== 0 && slice.openEnd !== 0));
|
|
115
117
|
|
|
116
118
|
// if nesting is allowed we bump up the default nesting allowance to 2 to support
|
|
117
119
|
// two levels of nesting in nodes that support table nesting already such as layoutSection and expands
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
} from '@atlaskit/editor-tables/utils';
|
|
44
44
|
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
45
45
|
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
46
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
47
46
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
48
47
|
import Toggle from '@atlaskit/toggle';
|
|
49
48
|
|
|
@@ -636,7 +635,6 @@ const DragMenu = React.memo(
|
|
|
636
635
|
fitHeight={fitHeight}
|
|
637
636
|
fitWidth={fitWidth}
|
|
638
637
|
direction={direction}
|
|
639
|
-
mountPoint={fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint}
|
|
640
638
|
boundariesElement={boundariesElement}
|
|
641
639
|
scrollableElement={scrollableElement}
|
|
642
640
|
/>
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -840,7 +840,13 @@ const getColumnSettingItems = (
|
|
|
840
840
|
id: 'editor.table.distributeColumns',
|
|
841
841
|
type: 'button',
|
|
842
842
|
title: formatMessage(messages.distributeColumns),
|
|
843
|
-
icon: () =>
|
|
843
|
+
icon: () => (
|
|
844
|
+
<TableColumnsDistributeIcon
|
|
845
|
+
LEGACY_fallbackIcon={DistributeColumnIcon}
|
|
846
|
+
spacing={'spacious'}
|
|
847
|
+
label={''}
|
|
848
|
+
/>
|
|
849
|
+
),
|
|
844
850
|
onClick: (state, dispatch, view) =>
|
|
845
851
|
getDistributeConfig(
|
|
846
852
|
getEditorContainerWidth,
|