@atlaskit/editor-plugin-table 24.3.14 → 24.4.0
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 +19 -0
- package/dist/cjs/nodeviews/TableSSRReactContextsProvider.js +23 -0
- package/dist/cjs/nodeviews/table-node-views.js +1 -1
- package/dist/cjs/nodeviews/table.js +14 -21
- package/dist/cjs/pm-plugins/commands/insert.js +10 -1
- package/dist/cjs/pm-plugins/main.js +3 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -1
- package/dist/cjs/tablePlugin.js +10 -1
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +153 -1
- package/dist/cjs/ui/TableMenu/cell/keys.js +19 -5
- package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +166 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +2 -2
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +3 -3
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -2
- package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +136 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +2 -2
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +3 -3
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +141 -1
- package/dist/cjs/ui/TableMenu/shared/selection.js +19 -0
- package/dist/es2019/nodeviews/TableSSRReactContextsProvider.js +17 -0
- package/dist/es2019/nodeviews/table-node-views.js +1 -1
- package/dist/es2019/nodeviews/table.js +15 -22
- package/dist/es2019/pm-plugins/commands/insert.js +10 -1
- package/dist/es2019/pm-plugins/main.js +4 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -1
- package/dist/es2019/tablePlugin.js +10 -1
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +134 -2
- package/dist/es2019/ui/TableMenu/cell/keys.js +25 -2
- package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +144 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +2 -2
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +3 -3
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -2
- package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +118 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +2 -2
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +3 -3
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +130 -4
- package/dist/es2019/ui/TableMenu/shared/selection.js +14 -0
- package/dist/esm/nodeviews/TableSSRReactContextsProvider.js +16 -0
- package/dist/esm/nodeviews/table-node-views.js +1 -1
- package/dist/esm/nodeviews/table.js +15 -22
- package/dist/esm/pm-plugins/commands/insert.js +10 -1
- package/dist/esm/pm-plugins/main.js +4 -2
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -1
- package/dist/esm/tablePlugin.js +10 -1
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +154 -2
- package/dist/esm/ui/TableMenu/cell/keys.js +16 -2
- package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +166 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +2 -2
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +3 -3
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -2
- package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +136 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +2 -2
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +3 -3
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +144 -4
- package/dist/esm/ui/TableMenu/shared/selection.js +14 -0
- package/dist/types/nodeviews/TableSSRReactContextsProvider.d.ts +8 -0
- package/dist/types/nodeviews/table-node-views.d.ts +2 -0
- package/dist/types/nodeviews/table.d.ts +3 -1
- package/dist/types/nodeviews/types.d.ts +2 -0
- package/dist/types/tablePluginType.d.ts +3 -2
- package/dist/types/ui/TableMenu/cell/keys.d.ts +2 -0
- package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
- package/dist/types/ui/TableMenu/shared/selection.d.ts +8 -0
- package/package.json +9 -3
|
@@ -13,6 +13,7 @@ import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/ut
|
|
|
13
13
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
16
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
18
|
import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
|
|
18
19
|
import { createPlugin as createActiveCellHighlightPlugin } from './pm-plugins/active-cell-highlight/plugin';
|
|
@@ -544,7 +545,7 @@ const tablePlugin = ({
|
|
|
544
545
|
keyshortcut: tooltip(toggleTable),
|
|
545
546
|
icon: () => /*#__PURE__*/React.createElement(IconTable, null),
|
|
546
547
|
action(insert, state) {
|
|
547
|
-
var _api$table, _options$tableOptions6, _tr$selection$$from$n;
|
|
548
|
+
var _api$markdownMode, _api$table, _options$tableOptions6, _tr$selection$$from$n;
|
|
548
549
|
if (isTableSelectorEnabled) {
|
|
549
550
|
const tr = insert('');
|
|
550
551
|
tr.setMeta(sizeSelectorPluginKey, {
|
|
@@ -553,6 +554,14 @@ const tablePlugin = ({
|
|
|
553
554
|
return tr;
|
|
554
555
|
}
|
|
555
556
|
|
|
557
|
+
// Delegate to the markdown plugin to insert a markdown table string at the CM cursor position.
|
|
558
|
+
const markdownState = api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.sharedState.currentState();
|
|
559
|
+
if (markdownState !== null && markdownState !== void 0 && markdownState.isMarkdownMode && (markdownState === null || markdownState === void 0 ? void 0 : markdownState.view) === 'syntax' && expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true) && fg('platform_editor_markdown_compatible_toolbar')) {
|
|
560
|
+
var _api$markdownMode2;
|
|
561
|
+
api === null || api === void 0 ? void 0 : (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 ? void 0 : _api$markdownMode2.actions.insertSourceTable();
|
|
562
|
+
return state.tr;
|
|
563
|
+
}
|
|
564
|
+
|
|
556
565
|
// see comment on tablesPlugin.getSharedState on usage
|
|
557
566
|
const tableState = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
558
567
|
const tableNodeProps = {
|
|
@@ -4,14 +4,146 @@ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
|
4
4
|
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
5
5
|
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
6
6
|
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
8
9
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
9
10
|
import { VerticalAlignDropdownItem } from './items/VerticalAlignDropdownItem';
|
|
10
11
|
import { VerticalAlignNestedMenu } from './items/VerticalAlignNestedMenu';
|
|
11
|
-
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK, VERTICAL_ALIGN_BOTTOM_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_ITEM, VERTICAL_ALIGN_TOP_ITEM } from './keys';
|
|
12
|
+
import { CELL_MENU, CELL_ACTION_SECTION, CELL_ADD_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK, CELL_ADD_SECTION_RANK, VERTICAL_ALIGN_BOTTOM_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_ITEM, VERTICAL_ALIGN_TOP_ITEM } from './keys';
|
|
12
13
|
export const getCellMenuComponents = ({
|
|
13
14
|
api
|
|
14
|
-
}) => [
|
|
15
|
+
}) => fg('platform_editor_table_cell_menu_update') ? [
|
|
16
|
+
// --- Cell menu update ON ---
|
|
17
|
+
// Merge/Split cells move into the Add section (alongside the shared add/distribute
|
|
18
|
+
// items); the danger section gains the shared Delete column/row items.
|
|
19
|
+
|
|
20
|
+
// --- Menu surface ---
|
|
21
|
+
{
|
|
22
|
+
type: CELL_MENU.type,
|
|
23
|
+
key: CELL_MENU.key
|
|
24
|
+
},
|
|
25
|
+
// --- Main action section (Background color, Vertical align) ---
|
|
26
|
+
{
|
|
27
|
+
type: CELL_ACTION_SECTION.type,
|
|
28
|
+
key: CELL_ACTION_SECTION.key,
|
|
29
|
+
parents: [{
|
|
30
|
+
type: CELL_MENU.type,
|
|
31
|
+
key: CELL_MENU.key,
|
|
32
|
+
rank: CELL_MENU_RANK[CELL_ACTION_SECTION.key]
|
|
33
|
+
}],
|
|
34
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
35
|
+
}, {
|
|
36
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
37
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
38
|
+
parents: [{
|
|
39
|
+
type: CELL_ACTION_SECTION.type,
|
|
40
|
+
key: CELL_ACTION_SECTION.key,
|
|
41
|
+
rank: CELL_ACTION_SECTION_RANK[VERTICAL_ALIGN_MENU.key]
|
|
42
|
+
}],
|
|
43
|
+
component: props => /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, null, props.children)
|
|
44
|
+
}, {
|
|
45
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
46
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
47
|
+
parents: [{
|
|
48
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
49
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
50
|
+
rank: VERTICAL_ALIGN_MENU_RANK[VERTICAL_ALIGN_MENU_SECTION.key]
|
|
51
|
+
}],
|
|
52
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
53
|
+
}, {
|
|
54
|
+
type: VERTICAL_ALIGN_TOP_ITEM.type,
|
|
55
|
+
key: VERTICAL_ALIGN_TOP_ITEM.key,
|
|
56
|
+
parents: [{
|
|
57
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
58
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
59
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_TOP_ITEM.key]
|
|
60
|
+
}],
|
|
61
|
+
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
62
|
+
api: api,
|
|
63
|
+
icon: AlignPositionTopIcon,
|
|
64
|
+
label: messages.cellAlignmentTop,
|
|
65
|
+
value: "top"
|
|
66
|
+
})
|
|
67
|
+
}, {
|
|
68
|
+
type: VERTICAL_ALIGN_MIDDLE_ITEM.type,
|
|
69
|
+
key: VERTICAL_ALIGN_MIDDLE_ITEM.key,
|
|
70
|
+
parents: [{
|
|
71
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
72
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
73
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_MIDDLE_ITEM.key]
|
|
74
|
+
}],
|
|
75
|
+
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
76
|
+
api: api,
|
|
77
|
+
icon: AlignPositionCenterVerticalIcon,
|
|
78
|
+
label: messages.cellAlignmentMiddle,
|
|
79
|
+
value: "middle"
|
|
80
|
+
})
|
|
81
|
+
}, {
|
|
82
|
+
type: VERTICAL_ALIGN_BOTTOM_ITEM.type,
|
|
83
|
+
key: VERTICAL_ALIGN_BOTTOM_ITEM.key,
|
|
84
|
+
parents: [{
|
|
85
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
86
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
87
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_ITEM.key]
|
|
88
|
+
}],
|
|
89
|
+
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
90
|
+
api: api,
|
|
91
|
+
icon: AlignPositionBottomIcon,
|
|
92
|
+
label: messages.cellAlignmentBottom,
|
|
93
|
+
value: "bottom"
|
|
94
|
+
})
|
|
95
|
+
},
|
|
96
|
+
// --- Add / Move section (shared Add column right / Add row below / Distribute
|
|
97
|
+
// columns are registered in `../shared/getSharedItems`; Merge/Split cells below) ---
|
|
98
|
+
{
|
|
99
|
+
type: CELL_ADD_SECTION.type,
|
|
100
|
+
key: CELL_ADD_SECTION.key,
|
|
101
|
+
parents: [{
|
|
102
|
+
type: CELL_MENU.type,
|
|
103
|
+
key: CELL_MENU.key,
|
|
104
|
+
rank: CELL_MENU_RANK[CELL_ADD_SECTION.key]
|
|
105
|
+
}],
|
|
106
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
107
|
+
hasSeparator: true
|
|
108
|
+
}, props.children)
|
|
109
|
+
}, {
|
|
110
|
+
type: MERGE_CELLS_ITEM.type,
|
|
111
|
+
key: MERGE_CELLS_ITEM.key,
|
|
112
|
+
parents: [{
|
|
113
|
+
type: CELL_ADD_SECTION.type,
|
|
114
|
+
key: CELL_ADD_SECTION.key,
|
|
115
|
+
rank: CELL_ADD_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
116
|
+
}],
|
|
117
|
+
component: () => /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
118
|
+
api: api
|
|
119
|
+
})
|
|
120
|
+
}, {
|
|
121
|
+
type: SPLIT_CELL_ITEM.type,
|
|
122
|
+
key: SPLIT_CELL_ITEM.key,
|
|
123
|
+
parents: [{
|
|
124
|
+
type: CELL_ADD_SECTION.type,
|
|
125
|
+
key: CELL_ADD_SECTION.key,
|
|
126
|
+
rank: CELL_ADD_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
127
|
+
}],
|
|
128
|
+
component: () => /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
129
|
+
api: api
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
// --- Danger section (Clear cell + shared Delete column / Delete row) ---
|
|
133
|
+
{
|
|
134
|
+
type: CELL_DANGER_SECTION.type,
|
|
135
|
+
key: CELL_DANGER_SECTION.key,
|
|
136
|
+
parents: [{
|
|
137
|
+
type: CELL_MENU.type,
|
|
138
|
+
key: CELL_MENU.key,
|
|
139
|
+
rank: CELL_MENU_RANK[CELL_DANGER_SECTION.key]
|
|
140
|
+
}],
|
|
141
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
142
|
+
hasSeparator: true
|
|
143
|
+
}, props.children)
|
|
144
|
+
}] : [
|
|
145
|
+
// --- Cell menu update OFF: legacy cell menu (Merge/Split live in the action section) ---
|
|
146
|
+
|
|
15
147
|
// --- Menu surface ---
|
|
16
148
|
{
|
|
17
149
|
type: CELL_MENU.type,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ADD_COLUMN_RIGHT_ITEM, DELETE_COLUMN_ITEM, DISTRIBUTE_COLUMNS_ITEM } from '../column/keys';
|
|
2
|
+
import { ADD_ROW_BELOW_ITEM, DELETE_ROW_ITEM } from '../row/keys';
|
|
1
3
|
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
|
|
2
4
|
|
|
3
5
|
// --- Menu surface ---
|
|
@@ -13,13 +15,18 @@ export const CELL_ACTION_SECTION = {
|
|
|
13
15
|
type: 'menu-section',
|
|
14
16
|
key: 'cell-action-section'
|
|
15
17
|
};
|
|
18
|
+
export const CELL_ADD_SECTION = {
|
|
19
|
+
type: 'menu-section',
|
|
20
|
+
key: 'cell-add-section'
|
|
21
|
+
};
|
|
16
22
|
export const CELL_DANGER_SECTION = {
|
|
17
23
|
type: 'menu-section',
|
|
18
24
|
key: 'cell-danger-section'
|
|
19
25
|
};
|
|
20
26
|
export const CELL_MENU_RANK = {
|
|
21
27
|
[CELL_ACTION_SECTION.key]: 100,
|
|
22
|
-
[
|
|
28
|
+
[CELL_ADD_SECTION.key]: 200,
|
|
29
|
+
[CELL_DANGER_SECTION.key]: 300
|
|
23
30
|
};
|
|
24
31
|
export const MERGE_CELLS_ITEM = {
|
|
25
32
|
type: 'menu-item',
|
|
@@ -51,6 +58,10 @@ export const VERTICAL_ALIGN_BOTTOM_ITEM = {
|
|
|
51
58
|
};
|
|
52
59
|
|
|
53
60
|
// --- Item ranks within their sections ---
|
|
61
|
+
//
|
|
62
|
+
// The add/delete items rendered in the cell menu are shared with the row/column
|
|
63
|
+
// menus (registered once in `../shared/getSharedItems` with multiple parents), so
|
|
64
|
+
// we reuse their existing keys here rather than declaring cell-specific ones.
|
|
54
65
|
|
|
55
66
|
export const CELL_ACTION_SECTION_RANK = {
|
|
56
67
|
[BACKGROUND_COLOR_ITEM.key]: 100,
|
|
@@ -66,6 +77,18 @@ export const VERTICAL_ALIGN_MENU_SECTION_RANK = {
|
|
|
66
77
|
[VERTICAL_ALIGN_MIDDLE_ITEM.key]: 200,
|
|
67
78
|
[VERTICAL_ALIGN_BOTTOM_ITEM.key]: 300
|
|
68
79
|
};
|
|
80
|
+
|
|
81
|
+
// Merge/Split cells are relocated from the action section into the add section when the
|
|
82
|
+
// cell menu update gate is on; they sit at the top of the section.
|
|
83
|
+
export const CELL_ADD_SECTION_RANK = {
|
|
84
|
+
[MERGE_CELLS_ITEM.key]: 100,
|
|
85
|
+
[SPLIT_CELL_ITEM.key]: 200,
|
|
86
|
+
[ADD_COLUMN_RIGHT_ITEM.key]: 300,
|
|
87
|
+
[ADD_ROW_BELOW_ITEM.key]: 400,
|
|
88
|
+
[DISTRIBUTE_COLUMNS_ITEM.key]: 500
|
|
89
|
+
};
|
|
69
90
|
export const CELL_DANGER_SECTION_RANK = {
|
|
70
|
-
[CLEAR_CELLS_ITEM.key]: 100
|
|
91
|
+
[CLEAR_CELLS_ITEM.key]: 100,
|
|
92
|
+
[DELETE_COLUMN_ITEM.key]: 200,
|
|
93
|
+
[DELETE_ROW_ITEM.key]: 300
|
|
71
94
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { AddColumnLeftItem } from './items/AddColumnLeftItem';
|
|
4
5
|
import { AddColumnRightItem } from './items/AddColumnRightItem';
|
|
5
6
|
import { ColumnBackgroundSection } from './items/ColumnBackgroundSection';
|
|
@@ -14,7 +15,149 @@ import { SortIncreasingItem } from './items/SortIncreasingItem';
|
|
|
14
15
|
import { COLUMN_MENU, COLUMN_TOGGLE_SECTION, COLUMN_BACKGROUND_SECTION, COLUMN_SORT_SECTION, COLUMN_ADD_SECTION, COLUMN_DANGER_SECTION, COLUMN_SECTION_RANK, HEADER_COLUMN_TOGGLE_ITEM, SORT_INCREASING_ITEM, SORT_DECREASING_ITEM, ADD_COLUMN_LEFT_ITEM, ADD_COLUMN_RIGHT_ITEM, MOVE_COLUMN_LEFT_ITEM, MOVE_COLUMN_RIGHT_ITEM, DISTRIBUTE_COLUMNS_ITEM, DELETE_COLUMN_ITEM, COLUMN_TOGGLE_SECTION_RANK, COLUMN_SORT_SECTION_RANK, COLUMN_ADD_SECTION_RANK, COLUMN_DANGER_SECTION_RANK } from './keys';
|
|
15
16
|
export const getColumnMenuComponents = ({
|
|
16
17
|
api
|
|
17
|
-
}) => [
|
|
18
|
+
}) => fg('platform_editor_table_cell_menu_update') ? [
|
|
19
|
+
// --- Cell menu update ON ---
|
|
20
|
+
// AddColumnRightItem/DistributeColumnsItem/DeleteColumnItem are registered in
|
|
21
|
+
// `../shared/getSharedItems` (shared with the cell menu), so they are omitted here.
|
|
22
|
+
|
|
23
|
+
// --- Menu surface ---
|
|
24
|
+
{
|
|
25
|
+
type: COLUMN_MENU.type,
|
|
26
|
+
key: COLUMN_MENU.key
|
|
27
|
+
},
|
|
28
|
+
// --- Toggle section (Header column) ---
|
|
29
|
+
{
|
|
30
|
+
type: COLUMN_TOGGLE_SECTION.type,
|
|
31
|
+
key: COLUMN_TOGGLE_SECTION.key,
|
|
32
|
+
parents: [{
|
|
33
|
+
type: COLUMN_MENU.type,
|
|
34
|
+
key: COLUMN_MENU.key,
|
|
35
|
+
rank: COLUMN_SECTION_RANK[COLUMN_TOGGLE_SECTION.key]
|
|
36
|
+
}],
|
|
37
|
+
component: props => /*#__PURE__*/React.createElement(ColumnToggleSection, {
|
|
38
|
+
api: api
|
|
39
|
+
}, props.children)
|
|
40
|
+
}, {
|
|
41
|
+
type: HEADER_COLUMN_TOGGLE_ITEM.type,
|
|
42
|
+
key: HEADER_COLUMN_TOGGLE_ITEM.key,
|
|
43
|
+
parents: [{
|
|
44
|
+
type: COLUMN_TOGGLE_SECTION.type,
|
|
45
|
+
key: COLUMN_TOGGLE_SECTION.key,
|
|
46
|
+
rank: COLUMN_TOGGLE_SECTION_RANK[HEADER_COLUMN_TOGGLE_ITEM.key]
|
|
47
|
+
}],
|
|
48
|
+
component: () => /*#__PURE__*/React.createElement(HeaderColumnToggleItem, {
|
|
49
|
+
api: api
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
// --- Background color section ---
|
|
53
|
+
{
|
|
54
|
+
type: COLUMN_BACKGROUND_SECTION.type,
|
|
55
|
+
key: COLUMN_BACKGROUND_SECTION.key,
|
|
56
|
+
parents: [{
|
|
57
|
+
type: COLUMN_MENU.type,
|
|
58
|
+
key: COLUMN_MENU.key,
|
|
59
|
+
rank: COLUMN_SECTION_RANK[COLUMN_BACKGROUND_SECTION.key]
|
|
60
|
+
}],
|
|
61
|
+
component: props => /*#__PURE__*/React.createElement(ColumnBackgroundSection, {
|
|
62
|
+
api: api
|
|
63
|
+
}, props.children)
|
|
64
|
+
},
|
|
65
|
+
// --- Sort section ---
|
|
66
|
+
{
|
|
67
|
+
type: COLUMN_SORT_SECTION.type,
|
|
68
|
+
key: COLUMN_SORT_SECTION.key,
|
|
69
|
+
parents: [{
|
|
70
|
+
type: COLUMN_MENU.type,
|
|
71
|
+
key: COLUMN_MENU.key,
|
|
72
|
+
rank: COLUMN_SECTION_RANK[COLUMN_SORT_SECTION.key]
|
|
73
|
+
}],
|
|
74
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
75
|
+
hasSeparator: true
|
|
76
|
+
}, props.children)
|
|
77
|
+
}, {
|
|
78
|
+
type: SORT_INCREASING_ITEM.type,
|
|
79
|
+
key: SORT_INCREASING_ITEM.key,
|
|
80
|
+
parents: [{
|
|
81
|
+
type: COLUMN_SORT_SECTION.type,
|
|
82
|
+
key: COLUMN_SORT_SECTION.key,
|
|
83
|
+
rank: COLUMN_SORT_SECTION_RANK[SORT_INCREASING_ITEM.key]
|
|
84
|
+
}],
|
|
85
|
+
component: () => /*#__PURE__*/React.createElement(SortIncreasingItem, {
|
|
86
|
+
api: api
|
|
87
|
+
})
|
|
88
|
+
}, {
|
|
89
|
+
type: SORT_DECREASING_ITEM.type,
|
|
90
|
+
key: SORT_DECREASING_ITEM.key,
|
|
91
|
+
parents: [{
|
|
92
|
+
type: COLUMN_SORT_SECTION.type,
|
|
93
|
+
key: COLUMN_SORT_SECTION.key,
|
|
94
|
+
rank: COLUMN_SORT_SECTION_RANK[SORT_DECREASING_ITEM.key]
|
|
95
|
+
}],
|
|
96
|
+
component: () => /*#__PURE__*/React.createElement(SortDecreasingItem, {
|
|
97
|
+
api: api
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
// --- Add / Move section ---
|
|
101
|
+
{
|
|
102
|
+
type: COLUMN_ADD_SECTION.type,
|
|
103
|
+
key: COLUMN_ADD_SECTION.key,
|
|
104
|
+
parents: [{
|
|
105
|
+
type: COLUMN_MENU.type,
|
|
106
|
+
key: COLUMN_MENU.key,
|
|
107
|
+
rank: COLUMN_SECTION_RANK[COLUMN_ADD_SECTION.key]
|
|
108
|
+
}],
|
|
109
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
110
|
+
hasSeparator: true
|
|
111
|
+
}, props.children)
|
|
112
|
+
}, {
|
|
113
|
+
type: ADD_COLUMN_LEFT_ITEM.type,
|
|
114
|
+
key: ADD_COLUMN_LEFT_ITEM.key,
|
|
115
|
+
parents: [{
|
|
116
|
+
type: COLUMN_ADD_SECTION.type,
|
|
117
|
+
key: COLUMN_ADD_SECTION.key,
|
|
118
|
+
rank: COLUMN_ADD_SECTION_RANK[ADD_COLUMN_LEFT_ITEM.key]
|
|
119
|
+
}],
|
|
120
|
+
component: () => /*#__PURE__*/React.createElement(AddColumnLeftItem, {
|
|
121
|
+
api: api
|
|
122
|
+
})
|
|
123
|
+
}, {
|
|
124
|
+
type: MOVE_COLUMN_LEFT_ITEM.type,
|
|
125
|
+
key: MOVE_COLUMN_LEFT_ITEM.key,
|
|
126
|
+
parents: [{
|
|
127
|
+
type: COLUMN_ADD_SECTION.type,
|
|
128
|
+
key: COLUMN_ADD_SECTION.key,
|
|
129
|
+
rank: COLUMN_ADD_SECTION_RANK[MOVE_COLUMN_LEFT_ITEM.key]
|
|
130
|
+
}],
|
|
131
|
+
component: () => /*#__PURE__*/React.createElement(MoveColumnLeftItem, {
|
|
132
|
+
api: api
|
|
133
|
+
})
|
|
134
|
+
}, {
|
|
135
|
+
type: MOVE_COLUMN_RIGHT_ITEM.type,
|
|
136
|
+
key: MOVE_COLUMN_RIGHT_ITEM.key,
|
|
137
|
+
parents: [{
|
|
138
|
+
type: COLUMN_ADD_SECTION.type,
|
|
139
|
+
key: COLUMN_ADD_SECTION.key,
|
|
140
|
+
rank: COLUMN_ADD_SECTION_RANK[MOVE_COLUMN_RIGHT_ITEM.key]
|
|
141
|
+
}],
|
|
142
|
+
component: () => /*#__PURE__*/React.createElement(MoveColumnRightItem, {
|
|
143
|
+
api: api
|
|
144
|
+
})
|
|
145
|
+
},
|
|
146
|
+
// --- Danger section (Clear cells, Delete column) ---
|
|
147
|
+
{
|
|
148
|
+
type: COLUMN_DANGER_SECTION.type,
|
|
149
|
+
key: COLUMN_DANGER_SECTION.key,
|
|
150
|
+
parents: [{
|
|
151
|
+
type: COLUMN_MENU.type,
|
|
152
|
+
key: COLUMN_MENU.key,
|
|
153
|
+
rank: COLUMN_SECTION_RANK[COLUMN_DANGER_SECTION.key]
|
|
154
|
+
}],
|
|
155
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
156
|
+
hasSeparator: true
|
|
157
|
+
}, props.children)
|
|
158
|
+
}] : [
|
|
159
|
+
// --- Cell menu update OFF: legacy column menu (registers its own add/delete items) ---
|
|
160
|
+
|
|
18
161
|
// --- Menu surface ---
|
|
19
162
|
{
|
|
20
163
|
type: COLUMN_MENU.type,
|
|
@@ -4,10 +4,10 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { addColumnAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
9
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { getMenuSelectionRect } from '../../shared/selection';
|
|
11
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
12
12
|
export const AddColumnRightItem = ({
|
|
13
13
|
api
|
|
@@ -36,7 +36,7 @@ export const AddColumnRightItem = ({
|
|
|
36
36
|
if (!editorView) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const selectionRect =
|
|
39
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
40
40
|
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
41
41
|
if (index === undefined) {
|
|
42
42
|
return;
|
|
@@ -4,11 +4,11 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteColumn, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { clearHoverSelection, closeActiveTableMenu, hoverColumns } from '../../../../pm-plugins/commands';
|
|
10
9
|
import { deleteColumnsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
11
10
|
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
11
|
+
import { getMenuSelectionRect } from '../../shared/selection';
|
|
12
12
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
13
13
|
export const DeleteColumnItem = ({
|
|
14
14
|
api
|
|
@@ -38,7 +38,7 @@ export const DeleteColumnItem = ({
|
|
|
38
38
|
if (!editorView) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
const selectionRect =
|
|
41
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
42
42
|
if (!selectionRect) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
@@ -55,7 +55,7 @@ export const DeleteColumnItem = ({
|
|
|
55
55
|
if (!editorView) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const selectionRect =
|
|
58
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
59
59
|
if (!selectionRect) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
@@ -3,11 +3,11 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
6
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
7
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
8
|
import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
9
|
import { getNewResizeStateFromSelectedColumns } from '../../../../pm-plugins/table-resizing/utils/resize-state';
|
|
10
|
+
import { getMenuSelectionRect } from '../../shared/selection';
|
|
11
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
12
12
|
/** Distribute columns is only visible when more than one column is selected. */
|
|
13
13
|
const shouldShowDistributeColumns = selectedColumnCount => (selectedColumnCount !== null && selectedColumnCount !== void 0 ? selectedColumnCount : 0) > 1;
|
|
@@ -38,7 +38,7 @@ export const DistributeColumnsItem = ({
|
|
|
38
38
|
if (!editorView) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
const selectionRect =
|
|
41
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
42
42
|
const editorContainerWidth = api === null || api === void 0 ? void 0 : (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState();
|
|
43
43
|
if (!selectionRect || !editorContainerWidth) {
|
|
44
44
|
return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { AddRowAboveItem } from './items/AddRowAboveItem';
|
|
4
5
|
import { AddRowBelowItem } from './items/AddRowBelowItem';
|
|
5
6
|
import { DeleteRowItem } from './items/DeleteRowItem';
|
|
@@ -10,7 +11,123 @@ import { NumberedRowsToggleItem } from './items/NumberedRowsToggleItem';
|
|
|
10
11
|
import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_MENU_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, ADD_ROW_ABOVE_ITEM, ADD_ROW_BELOW_ITEM, MOVE_ROW_UP_ITEM, MOVE_ROW_DOWN_ITEM, DELETE_ROW_ITEM, ROW_TOGGLE_SECTION_RANK, ROW_ADD_SECTION_RANK, ROW_DANGER_SECTION_RANK } from './keys';
|
|
11
12
|
export const getRowMenuComponents = ({
|
|
12
13
|
api
|
|
13
|
-
}) => [
|
|
14
|
+
}) => fg('platform_editor_table_cell_menu_update') ? [
|
|
15
|
+
// --- Cell menu update ON ---
|
|
16
|
+
// AddRowBelowItem/DeleteRowItem are registered in `../shared/getSharedItems`
|
|
17
|
+
// (shared with the cell menu), so they are omitted here.
|
|
18
|
+
|
|
19
|
+
// --- Menu surface ---
|
|
20
|
+
{
|
|
21
|
+
type: ROW_MENU.type,
|
|
22
|
+
key: ROW_MENU.key
|
|
23
|
+
},
|
|
24
|
+
// --- Toggle section (Header row, Numbered rows) ---
|
|
25
|
+
{
|
|
26
|
+
type: ROW_TOGGLE_SECTION.type,
|
|
27
|
+
key: ROW_TOGGLE_SECTION.key,
|
|
28
|
+
parents: [{
|
|
29
|
+
type: ROW_MENU.type,
|
|
30
|
+
key: ROW_MENU.key,
|
|
31
|
+
rank: ROW_MENU_SECTION_RANK[ROW_TOGGLE_SECTION.key]
|
|
32
|
+
}],
|
|
33
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
34
|
+
}, {
|
|
35
|
+
type: HEADER_ROW_TOGGLE_ITEM.type,
|
|
36
|
+
key: HEADER_ROW_TOGGLE_ITEM.key,
|
|
37
|
+
parents: [{
|
|
38
|
+
type: ROW_TOGGLE_SECTION.type,
|
|
39
|
+
key: ROW_TOGGLE_SECTION.key,
|
|
40
|
+
rank: ROW_TOGGLE_SECTION_RANK[HEADER_ROW_TOGGLE_ITEM.key]
|
|
41
|
+
}],
|
|
42
|
+
component: () => /*#__PURE__*/React.createElement(HeaderRowToggleItem, {
|
|
43
|
+
api: api
|
|
44
|
+
})
|
|
45
|
+
}, {
|
|
46
|
+
type: NUMBERED_ROWS_TOGGLE_ITEM.type,
|
|
47
|
+
key: NUMBERED_ROWS_TOGGLE_ITEM.key,
|
|
48
|
+
parents: [{
|
|
49
|
+
type: ROW_TOGGLE_SECTION.type,
|
|
50
|
+
key: ROW_TOGGLE_SECTION.key,
|
|
51
|
+
rank: ROW_TOGGLE_SECTION_RANK[NUMBERED_ROWS_TOGGLE_ITEM.key]
|
|
52
|
+
}],
|
|
53
|
+
component: () => /*#__PURE__*/React.createElement(NumberedRowsToggleItem, {
|
|
54
|
+
api: api
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
// --- Background color section ---
|
|
58
|
+
{
|
|
59
|
+
type: ROW_BACKGROUND_SECTION.type,
|
|
60
|
+
key: ROW_BACKGROUND_SECTION.key,
|
|
61
|
+
parents: [{
|
|
62
|
+
type: ROW_MENU.type,
|
|
63
|
+
key: ROW_MENU.key,
|
|
64
|
+
rank: ROW_MENU_SECTION_RANK[ROW_BACKGROUND_SECTION.key]
|
|
65
|
+
}],
|
|
66
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
67
|
+
hasSeparator: true
|
|
68
|
+
}, props.children)
|
|
69
|
+
},
|
|
70
|
+
// --- Add / Move section ---
|
|
71
|
+
{
|
|
72
|
+
type: ROW_ADD_SECTION.type,
|
|
73
|
+
key: ROW_ADD_SECTION.key,
|
|
74
|
+
parents: [{
|
|
75
|
+
type: ROW_MENU.type,
|
|
76
|
+
key: ROW_MENU.key,
|
|
77
|
+
rank: ROW_MENU_SECTION_RANK[ROW_ADD_SECTION.key]
|
|
78
|
+
}],
|
|
79
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
80
|
+
hasSeparator: true
|
|
81
|
+
}, props.children)
|
|
82
|
+
}, {
|
|
83
|
+
type: ADD_ROW_ABOVE_ITEM.type,
|
|
84
|
+
key: ADD_ROW_ABOVE_ITEM.key,
|
|
85
|
+
parents: [{
|
|
86
|
+
type: ROW_ADD_SECTION.type,
|
|
87
|
+
key: ROW_ADD_SECTION.key,
|
|
88
|
+
rank: ROW_ADD_SECTION_RANK[ADD_ROW_ABOVE_ITEM.key]
|
|
89
|
+
}],
|
|
90
|
+
component: () => /*#__PURE__*/React.createElement(AddRowAboveItem, {
|
|
91
|
+
api: api
|
|
92
|
+
})
|
|
93
|
+
}, {
|
|
94
|
+
type: MOVE_ROW_UP_ITEM.type,
|
|
95
|
+
key: MOVE_ROW_UP_ITEM.key,
|
|
96
|
+
parents: [{
|
|
97
|
+
type: ROW_ADD_SECTION.type,
|
|
98
|
+
key: ROW_ADD_SECTION.key,
|
|
99
|
+
rank: ROW_ADD_SECTION_RANK[MOVE_ROW_UP_ITEM.key]
|
|
100
|
+
}],
|
|
101
|
+
component: () => /*#__PURE__*/React.createElement(MoveRowUpItem, {
|
|
102
|
+
api: api
|
|
103
|
+
})
|
|
104
|
+
}, {
|
|
105
|
+
type: MOVE_ROW_DOWN_ITEM.type,
|
|
106
|
+
key: MOVE_ROW_DOWN_ITEM.key,
|
|
107
|
+
parents: [{
|
|
108
|
+
type: ROW_ADD_SECTION.type,
|
|
109
|
+
key: ROW_ADD_SECTION.key,
|
|
110
|
+
rank: ROW_ADD_SECTION_RANK[MOVE_ROW_DOWN_ITEM.key]
|
|
111
|
+
}],
|
|
112
|
+
component: () => /*#__PURE__*/React.createElement(MoveRowDownItem, {
|
|
113
|
+
api: api
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
// --- Danger section (Clear cells, Delete row) ---
|
|
117
|
+
{
|
|
118
|
+
type: ROW_DANGER_SECTION.type,
|
|
119
|
+
key: ROW_DANGER_SECTION.key,
|
|
120
|
+
parents: [{
|
|
121
|
+
type: ROW_MENU.type,
|
|
122
|
+
key: ROW_MENU.key,
|
|
123
|
+
rank: ROW_MENU_SECTION_RANK[ROW_DANGER_SECTION.key]
|
|
124
|
+
}],
|
|
125
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
126
|
+
hasSeparator: true
|
|
127
|
+
}, props.children)
|
|
128
|
+
}] : [
|
|
129
|
+
// --- Cell menu update OFF: legacy row menu (registers its own add/delete items) ---
|
|
130
|
+
|
|
14
131
|
// --- Menu surface ---
|
|
15
132
|
{
|
|
16
133
|
type: ROW_MENU.type,
|
|
@@ -3,10 +3,10 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
6
|
import { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
7
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
8
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { getMenuSelectionRect } from '../../shared/selection';
|
|
10
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
11
|
export const AddRowBelowItem = props => {
|
|
12
12
|
var _useTableMenuContext, _tooltip;
|
|
@@ -24,7 +24,7 @@ export const AddRowBelowItem = props => {
|
|
|
24
24
|
if (!editorView) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const selectionRect =
|
|
27
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
28
28
|
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.bottom;
|
|
29
29
|
if (index === undefined) {
|
|
30
30
|
return;
|
|
@@ -4,11 +4,11 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { clearHoverSelection, closeActiveTableMenu, hoverRows } from '../../../../pm-plugins/commands';
|
|
10
9
|
import { deleteRowsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
11
10
|
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
11
|
+
import { getMenuSelectionRect } from '../../shared/selection';
|
|
12
12
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
13
13
|
export const DeleteRowItem = props => {
|
|
14
14
|
var _tableMenuContext$sel, _tooltip;
|
|
@@ -35,7 +35,7 @@ export const DeleteRowItem = props => {
|
|
|
35
35
|
if (!editorView) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
const selectionRect =
|
|
38
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
39
39
|
if (!selectionRect) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -52,7 +52,7 @@ export const DeleteRowItem = props => {
|
|
|
52
52
|
if (!editorView) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
const selectionRect =
|
|
55
|
+
const selectionRect = getMenuSelectionRect(editorView.state.selection);
|
|
56
56
|
if (!selectionRect) {
|
|
57
57
|
return;
|
|
58
58
|
}
|