@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
|
@@ -1,13 +1,139 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { CELL_ACTION_SECTION, CELL_ADD_SECTION, CELL_DANGER_SECTION, CELL_ACTION_SECTION_RANK, CELL_ADD_SECTION_RANK, CELL_DANGER_SECTION_RANK } from '../cell/keys';
|
|
4
|
+
import { AddColumnRightItem } from '../column/items/AddColumnRightItem';
|
|
5
|
+
import { DeleteColumnItem } from '../column/items/DeleteColumnItem';
|
|
6
|
+
import { DistributeColumnsItem } from '../column/items/DistributeColumnsItem';
|
|
7
|
+
import { ADD_COLUMN_RIGHT_ITEM, COLUMN_ADD_SECTION, COLUMN_BACKGROUND_SECTION, COLUMN_DANGER_SECTION, COLUMN_ADD_SECTION_RANK, COLUMN_BACKGROUND_SECTION_RANK, COLUMN_DANGER_SECTION_RANK, DELETE_COLUMN_ITEM, DISTRIBUTE_COLUMNS_ITEM } from '../column/keys';
|
|
8
|
+
import { AddRowBelowItem } from '../row/items/AddRowBelowItem';
|
|
9
|
+
import { DeleteRowItem } from '../row/items/DeleteRowItem';
|
|
10
|
+
import { ADD_ROW_BELOW_ITEM, DELETE_ROW_ITEM, ROW_ADD_SECTION, ROW_BACKGROUND_SECTION, ROW_DANGER_SECTION, ROW_ADD_SECTION_RANK, ROW_BACKGROUND_SECTION_RANK, ROW_DANGER_SECTION_RANK } from '../row/keys';
|
|
5
11
|
import { BackgroundColorItem } from './items/BackgroundColorItem';
|
|
6
12
|
import { ClearCellsItem } from './items/ClearCellsItem';
|
|
7
13
|
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from './keys';
|
|
8
14
|
export const getSharedItems = ({
|
|
9
15
|
api
|
|
10
|
-
}) => [
|
|
16
|
+
}) => fg('platform_editor_table_cell_menu_update') ? [
|
|
17
|
+
// --- Cell menu update ON ---
|
|
18
|
+
// The add/delete items move out of the row/column menu files and are registered here
|
|
19
|
+
// once with an additional cell parent, so they render inside the cell menu too.
|
|
20
|
+
{
|
|
21
|
+
type: BACKGROUND_COLOR_ITEM.type,
|
|
22
|
+
key: BACKGROUND_COLOR_ITEM.key,
|
|
23
|
+
parents: [{
|
|
24
|
+
type: ROW_BACKGROUND_SECTION.type,
|
|
25
|
+
key: ROW_BACKGROUND_SECTION.key,
|
|
26
|
+
rank: ROW_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
27
|
+
}, {
|
|
28
|
+
type: COLUMN_BACKGROUND_SECTION.type,
|
|
29
|
+
key: COLUMN_BACKGROUND_SECTION.key,
|
|
30
|
+
rank: COLUMN_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
31
|
+
}, {
|
|
32
|
+
type: CELL_ACTION_SECTION.type,
|
|
33
|
+
key: CELL_ACTION_SECTION.key,
|
|
34
|
+
rank: CELL_ACTION_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
35
|
+
}],
|
|
36
|
+
component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, {
|
|
37
|
+
api: api
|
|
38
|
+
})
|
|
39
|
+
}, {
|
|
40
|
+
type: ADD_COLUMN_RIGHT_ITEM.type,
|
|
41
|
+
key: ADD_COLUMN_RIGHT_ITEM.key,
|
|
42
|
+
parents: [{
|
|
43
|
+
type: COLUMN_ADD_SECTION.type,
|
|
44
|
+
key: COLUMN_ADD_SECTION.key,
|
|
45
|
+
rank: COLUMN_ADD_SECTION_RANK[ADD_COLUMN_RIGHT_ITEM.key]
|
|
46
|
+
}, {
|
|
47
|
+
type: CELL_ADD_SECTION.type,
|
|
48
|
+
key: CELL_ADD_SECTION.key,
|
|
49
|
+
rank: CELL_ADD_SECTION_RANK[ADD_COLUMN_RIGHT_ITEM.key]
|
|
50
|
+
}],
|
|
51
|
+
component: () => /*#__PURE__*/React.createElement(AddColumnRightItem, {
|
|
52
|
+
api: api
|
|
53
|
+
})
|
|
54
|
+
}, {
|
|
55
|
+
type: ADD_ROW_BELOW_ITEM.type,
|
|
56
|
+
key: ADD_ROW_BELOW_ITEM.key,
|
|
57
|
+
parents: [{
|
|
58
|
+
type: ROW_ADD_SECTION.type,
|
|
59
|
+
key: ROW_ADD_SECTION.key,
|
|
60
|
+
rank: ROW_ADD_SECTION_RANK[ADD_ROW_BELOW_ITEM.key]
|
|
61
|
+
}, {
|
|
62
|
+
type: CELL_ADD_SECTION.type,
|
|
63
|
+
key: CELL_ADD_SECTION.key,
|
|
64
|
+
rank: CELL_ADD_SECTION_RANK[ADD_ROW_BELOW_ITEM.key]
|
|
65
|
+
}],
|
|
66
|
+
component: () => /*#__PURE__*/React.createElement(AddRowBelowItem, {
|
|
67
|
+
api: api
|
|
68
|
+
})
|
|
69
|
+
}, {
|
|
70
|
+
type: DISTRIBUTE_COLUMNS_ITEM.type,
|
|
71
|
+
key: DISTRIBUTE_COLUMNS_ITEM.key,
|
|
72
|
+
parents: [{
|
|
73
|
+
type: COLUMN_ADD_SECTION.type,
|
|
74
|
+
key: COLUMN_ADD_SECTION.key,
|
|
75
|
+
rank: COLUMN_ADD_SECTION_RANK[DISTRIBUTE_COLUMNS_ITEM.key]
|
|
76
|
+
}, {
|
|
77
|
+
type: CELL_ADD_SECTION.type,
|
|
78
|
+
key: CELL_ADD_SECTION.key,
|
|
79
|
+
rank: CELL_ADD_SECTION_RANK[DISTRIBUTE_COLUMNS_ITEM.key]
|
|
80
|
+
}],
|
|
81
|
+
component: () => /*#__PURE__*/React.createElement(DistributeColumnsItem, {
|
|
82
|
+
api: api
|
|
83
|
+
})
|
|
84
|
+
}, {
|
|
85
|
+
type: CLEAR_CELLS_ITEM.type,
|
|
86
|
+
key: CLEAR_CELLS_ITEM.key,
|
|
87
|
+
parents: [{
|
|
88
|
+
type: ROW_DANGER_SECTION.type,
|
|
89
|
+
key: ROW_DANGER_SECTION.key,
|
|
90
|
+
rank: ROW_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
91
|
+
}, {
|
|
92
|
+
type: COLUMN_DANGER_SECTION.type,
|
|
93
|
+
key: COLUMN_DANGER_SECTION.key,
|
|
94
|
+
rank: COLUMN_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
95
|
+
}, {
|
|
96
|
+
type: CELL_DANGER_SECTION.type,
|
|
97
|
+
key: CELL_DANGER_SECTION.key,
|
|
98
|
+
rank: CELL_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
99
|
+
}],
|
|
100
|
+
component: () => /*#__PURE__*/React.createElement(ClearCellsItem, {
|
|
101
|
+
api: api
|
|
102
|
+
})
|
|
103
|
+
}, {
|
|
104
|
+
type: DELETE_COLUMN_ITEM.type,
|
|
105
|
+
key: DELETE_COLUMN_ITEM.key,
|
|
106
|
+
parents: [{
|
|
107
|
+
type: COLUMN_DANGER_SECTION.type,
|
|
108
|
+
key: COLUMN_DANGER_SECTION.key,
|
|
109
|
+
rank: COLUMN_DANGER_SECTION_RANK[DELETE_COLUMN_ITEM.key]
|
|
110
|
+
}, {
|
|
111
|
+
type: CELL_DANGER_SECTION.type,
|
|
112
|
+
key: CELL_DANGER_SECTION.key,
|
|
113
|
+
rank: CELL_DANGER_SECTION_RANK[DELETE_COLUMN_ITEM.key]
|
|
114
|
+
}],
|
|
115
|
+
component: () => /*#__PURE__*/React.createElement(DeleteColumnItem, {
|
|
116
|
+
api: api
|
|
117
|
+
})
|
|
118
|
+
}, {
|
|
119
|
+
type: DELETE_ROW_ITEM.type,
|
|
120
|
+
key: DELETE_ROW_ITEM.key,
|
|
121
|
+
parents: [{
|
|
122
|
+
type: ROW_DANGER_SECTION.type,
|
|
123
|
+
key: ROW_DANGER_SECTION.key,
|
|
124
|
+
rank: ROW_DANGER_SECTION_RANK[DELETE_ROW_ITEM.key]
|
|
125
|
+
}, {
|
|
126
|
+
type: CELL_DANGER_SECTION.type,
|
|
127
|
+
key: CELL_DANGER_SECTION.key,
|
|
128
|
+
rank: CELL_DANGER_SECTION_RANK[DELETE_ROW_ITEM.key]
|
|
129
|
+
}],
|
|
130
|
+
component: () => /*#__PURE__*/React.createElement(DeleteRowItem, {
|
|
131
|
+
api: api
|
|
132
|
+
})
|
|
133
|
+
}] : [
|
|
134
|
+
// --- Cell menu update OFF: legacy shared items (background color + clear cells only).
|
|
135
|
+
// The add/delete items are registered by the row/column menu files in this mode.
|
|
136
|
+
{
|
|
11
137
|
type: BACKGROUND_COLOR_ITEM.type,
|
|
12
138
|
key: BACKGROUND_COLOR_ITEM.key,
|
|
13
139
|
parents: [{
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the table `Rect` for the current selection. Falls back to the closest cell's rect
|
|
6
|
+
* for a `TextSelection` (cell menu), where `getSelectionRect` returns `undefined`. Gated:
|
|
7
|
+
* with the gate off this behaves exactly like `getSelectionRect`.
|
|
8
|
+
*/
|
|
9
|
+
export const getMenuSelectionRect = selection => {
|
|
10
|
+
if (!fg('platform_editor_table_cell_menu_update')) {
|
|
11
|
+
return getSelectionRect(selection);
|
|
12
|
+
}
|
|
13
|
+
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RawIntlProvider } from 'react-intl';
|
|
3
|
+
import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
4
|
+
export function TableSSRReactContextsProvider(_ref) {
|
|
5
|
+
var children = _ref.children,
|
|
6
|
+
intl = _ref.intl;
|
|
7
|
+
if (!isSSR() || !isSSRStreaming()) {
|
|
8
|
+
return children;
|
|
9
|
+
}
|
|
10
|
+
if (!intl) {
|
|
11
|
+
return children;
|
|
12
|
+
}
|
|
13
|
+
return /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
14
|
+
value: intl
|
|
15
|
+
}, children);
|
|
16
|
+
}
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
import TableRowNativeStickyWithFallback from './TableRowNativeStickyWithFallback';
|
|
8
8
|
export var tableView = function tableView(options) {
|
|
9
9
|
return function (node, view, getPos) {
|
|
10
|
-
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, options.intl);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export var tableCellView = function tableCellView(options) {
|
|
@@ -10,7 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
14
14
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
15
15
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
16
16
|
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
@@ -27,6 +27,7 @@ import { isTableNested, tablesHaveDifferentColumnWidths } from '../pm-plugins/ut
|
|
|
27
27
|
import { isContentModeSupported } from '../pm-plugins/utils/tableMode/is-content-mode-supported';
|
|
28
28
|
import { RoundedTableEdges } from './rounded-table-edges';
|
|
29
29
|
import { TableComponentWithSharedState } from './TableComponentWithSharedState';
|
|
30
|
+
import { TableSSRReactContextsProvider } from './TableSSRReactContextsProvider';
|
|
30
31
|
import { tableNodeSpecWithFixedToDOM } from './toDOM';
|
|
31
32
|
var tableAttributes = function tableAttributes(node) {
|
|
32
33
|
return {
|
|
@@ -74,6 +75,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
74
75
|
_this.eventDispatcher = props.eventDispatcher;
|
|
75
76
|
_this.options = props.options;
|
|
76
77
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
78
|
+
_this.intl = props.intl;
|
|
77
79
|
if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
|
|
78
80
|
_this.roundedTableEdges = new RoundedTableEdges(function () {
|
|
79
81
|
return _this.table;
|
|
@@ -161,7 +163,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
// Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
|
|
164
|
-
|
|
166
|
+
// In SSR streaming the portal renders via `container.innerHTML = html` (portal/common.tsx), which detaches
|
|
167
|
+
// `renderedDOM` from `dom` before this runs; require it to still be a child so `removeChild` doesn't throw
|
|
168
|
+
// `NotFoundError` (which would make EditorSSRRenderer fall back to the position-blind schema toDOM and lose
|
|
169
|
+
// nested detection). CSR keeps the original condition unchanged.
|
|
170
|
+
if (this.dom && this.renderedDOM && (!isSSRStreaming() || this.renderedDOM.parentNode === this.dom)) {
|
|
165
171
|
this.dom.removeChild(this.renderedDOM);
|
|
166
172
|
}
|
|
167
173
|
// Move the table from the ProseMirror table structure into the React rendered table node.
|
|
@@ -265,7 +271,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
265
271
|
}, {
|
|
266
272
|
key: "render",
|
|
267
273
|
value: function render(props, forwardRef) {
|
|
268
|
-
return /*#__PURE__*/React.createElement(
|
|
274
|
+
return /*#__PURE__*/React.createElement(TableSSRReactContextsProvider, {
|
|
275
|
+
intl: this.intl
|
|
276
|
+
}, /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
269
277
|
forwardRef: forwardRef,
|
|
270
278
|
getNode: this.getNode,
|
|
271
279
|
view: props.view,
|
|
@@ -280,7 +288,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
280
288
|
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
281
289
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
282
290
|
allowFixedColumnWidthOption: props.allowFixedColumnWidthOption
|
|
283
|
-
});
|
|
291
|
+
}));
|
|
284
292
|
}
|
|
285
293
|
}, {
|
|
286
294
|
key: "viewShouldUpdate",
|
|
@@ -352,7 +360,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
352
360
|
}]);
|
|
353
361
|
}(ReactNodeView);
|
|
354
362
|
export { TableView as default };
|
|
355
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) {
|
|
363
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption, intl) {
|
|
356
364
|
var _pluginInjectionApi$t;
|
|
357
365
|
var _getPluginState2 = getPluginState(view.state),
|
|
358
366
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
@@ -367,22 +375,6 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
367
375
|
allowTableAlignment = _getPluginConfig.allowTableAlignment;
|
|
368
376
|
var isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
|
|
369
377
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
370
|
-
|
|
371
|
-
// In SSR use native ProseMirror spec-based render for table nodes
|
|
372
|
-
if (isSSR() && isSSRStreaming()) {
|
|
373
|
-
var isNested = isTableNested(view.state, typeof getPos === 'function' ? getPos() : undefined);
|
|
374
|
-
var tableDOMStructure = tableNodeSpecWithFixedToDOM({
|
|
375
|
-
allowColumnResizing: allowColumnResizing !== null && allowColumnResizing !== void 0 ? allowColumnResizing : false,
|
|
376
|
-
tableResizingEnabled: allowTableResizing !== null && allowTableResizing !== void 0 ? allowTableResizing : false,
|
|
377
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
378
|
-
isTableScalingEnabled: isTableScalingEnabled,
|
|
379
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
380
|
-
isCommentEditor: isCommentEditor,
|
|
381
|
-
isChromelessEditor: isChromelessEditor,
|
|
382
|
-
isNested: isNested
|
|
383
|
-
}).toDOM(node);
|
|
384
|
-
return DOMSerializer.renderSpec(document, tableDOMStructure);
|
|
385
|
-
}
|
|
386
378
|
return new TableView({
|
|
387
379
|
node: node,
|
|
388
380
|
view: view,
|
|
@@ -406,6 +398,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
406
398
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
407
399
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
408
400
|
pluginInjectionApi: pluginInjectionApi,
|
|
409
|
-
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
401
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
402
|
+
intl: intl
|
|
410
403
|
}).init();
|
|
411
404
|
};
|
|
@@ -9,7 +9,9 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
9
9
|
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
11
|
import { addColumnAt as addColumnAtPMUtils, addRowAt, findTable, selectedRect } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
15
|
import { updateRowOrColumnMovedTransform } from '../analytics/commands';
|
|
14
16
|
import { META_KEYS } from '../table-analytics';
|
|
15
17
|
import { rescaleColumns } from '../transforms/column-width';
|
|
@@ -264,8 +266,15 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
|
|
|
264
266
|
_ref2$createTableProp = _ref2.createTableProps,
|
|
265
267
|
createTableProps = _ref2$createTableProp === void 0 ? {} : _ref2$createTableProp;
|
|
266
268
|
return function (_ref3) {
|
|
267
|
-
var _api$contentInsertion, _tr$selection$$from$n2;
|
|
269
|
+
var _api$markdownMode, _api$contentInsertion, _tr$selection$$from$n2;
|
|
268
270
|
var tr = _ref3.tr;
|
|
271
|
+
// Delegate to the markdown plugin to insert a markdown table string at the CM cursor position.
|
|
272
|
+
var markdownState = api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.sharedState.currentState();
|
|
273
|
+
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')) {
|
|
274
|
+
var _api$markdownMode2;
|
|
275
|
+
api === null || api === void 0 || (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 || _api$markdownMode2.actions.insertSourceTable(createTableProps.rowsCount, createTableProps.colsCount);
|
|
276
|
+
return tr;
|
|
277
|
+
}
|
|
269
278
|
var schema = tr.doc.type.schema;
|
|
270
279
|
|
|
271
280
|
// If the cursor is inside a table
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
7
|
-
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
7
|
+
import { insideTable, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
8
8
|
import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
9
9
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
10
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -62,6 +62,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
62
62
|
}
|
|
63
63
|
return editorView.state;
|
|
64
64
|
};
|
|
65
|
+
var intl = isSSRStreaming() ? getIntl() : undefined;
|
|
65
66
|
var getNodeView = function getNodeView() {
|
|
66
67
|
return {
|
|
67
68
|
table: tableView({
|
|
@@ -73,7 +74,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
73
74
|
pluginInjectionApi: pluginInjectionApi,
|
|
74
75
|
isCommentEditor: isCommentEditor,
|
|
75
76
|
isChromelessEditor: isChromelessEditor,
|
|
76
|
-
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
77
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
78
|
+
intl: intl
|
|
77
79
|
}),
|
|
78
80
|
tableRow: tableRowView({
|
|
79
81
|
eventDispatcher: eventDispatcher,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
2
3
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
4
|
import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -25,7 +26,7 @@ var generateColStyle = function generateColStyle(fixedColWidth, tableWidth, isCo
|
|
|
25
26
|
if (hasTableBeenResized) {
|
|
26
27
|
return "width: max(".concat(fixedColWidth, "px, ").concat(tableCellMinWidth, "px)");
|
|
27
28
|
}
|
|
28
|
-
return "width: ".concat(tableCellMinWidth, "px)");
|
|
29
|
+
return isSSRStreaming() ? "width: ".concat(tableCellMinWidth, "px") : "width: ".concat(tableCellMinWidth, "px)");
|
|
29
30
|
}
|
|
30
31
|
if (isFullPageEditor || !isFullPageEditor && isTableHasWidth) {
|
|
31
32
|
var scaledPercent = isNumberColumnEnabled ? "calc(calc(var(--ak-editor-table-width) - ".concat(akEditorTableNumberColumnWidth, "px - 1px)/").concat(tableWidth, ")") : "calc(calc(var(--ak-editor-table-width) - 1px)/".concat(tableWidth, ")");
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -16,6 +16,7 @@ import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/ut
|
|
|
16
16
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
19
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
21
|
import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
|
|
21
22
|
import { createPlugin as createActiveCellHighlightPlugin } from './pm-plugins/active-cell-highlight/plugin';
|
|
@@ -554,7 +555,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
554
555
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
555
556
|
},
|
|
556
557
|
action: function action(insert, state) {
|
|
557
|
-
var _api$table, _options$tableOptions6, _tr$selection$$from$n;
|
|
558
|
+
var _api$markdownMode, _api$table, _options$tableOptions6, _tr$selection$$from$n;
|
|
558
559
|
if (isTableSelectorEnabled) {
|
|
559
560
|
var _tr = insert('');
|
|
560
561
|
_tr.setMeta(sizeSelectorPluginKey, {
|
|
@@ -563,6 +564,14 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
563
564
|
return _tr;
|
|
564
565
|
}
|
|
565
566
|
|
|
567
|
+
// Delegate to the markdown plugin to insert a markdown table string at the CM cursor position.
|
|
568
|
+
var markdownState = api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.sharedState.currentState();
|
|
569
|
+
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')) {
|
|
570
|
+
var _api$markdownMode2;
|
|
571
|
+
api === null || api === void 0 || (_api$markdownMode2 = api.markdownMode) === null || _api$markdownMode2 === void 0 || _api$markdownMode2.actions.insertSourceTable();
|
|
572
|
+
return state.tr;
|
|
573
|
+
}
|
|
574
|
+
|
|
566
575
|
// see comment on tablesPlugin.getSharedState on usage
|
|
567
576
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
568
577
|
var tableNodeProps = {
|
|
@@ -4,14 +4,166 @@ 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 var getCellMenuComponents = function getCellMenuComponents(_ref) {
|
|
13
14
|
var api = _ref.api;
|
|
14
|
-
return [
|
|
15
|
+
return 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: function component(props) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
39
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
40
|
+
parents: [{
|
|
41
|
+
type: CELL_ACTION_SECTION.type,
|
|
42
|
+
key: CELL_ACTION_SECTION.key,
|
|
43
|
+
rank: CELL_ACTION_SECTION_RANK[VERTICAL_ALIGN_MENU.key]
|
|
44
|
+
}],
|
|
45
|
+
component: function component(props) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, null, props.children);
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
50
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
51
|
+
parents: [{
|
|
52
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
53
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
54
|
+
rank: VERTICAL_ALIGN_MENU_RANK[VERTICAL_ALIGN_MENU_SECTION.key]
|
|
55
|
+
}],
|
|
56
|
+
component: function component(props) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
type: VERTICAL_ALIGN_TOP_ITEM.type,
|
|
61
|
+
key: VERTICAL_ALIGN_TOP_ITEM.key,
|
|
62
|
+
parents: [{
|
|
63
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
64
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
65
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_TOP_ITEM.key]
|
|
66
|
+
}],
|
|
67
|
+
component: function component() {
|
|
68
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
69
|
+
api: api,
|
|
70
|
+
icon: AlignPositionTopIcon,
|
|
71
|
+
label: messages.cellAlignmentTop,
|
|
72
|
+
value: "top"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
type: VERTICAL_ALIGN_MIDDLE_ITEM.type,
|
|
77
|
+
key: VERTICAL_ALIGN_MIDDLE_ITEM.key,
|
|
78
|
+
parents: [{
|
|
79
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
80
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
81
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_MIDDLE_ITEM.key]
|
|
82
|
+
}],
|
|
83
|
+
component: function component() {
|
|
84
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
85
|
+
api: api,
|
|
86
|
+
icon: AlignPositionCenterVerticalIcon,
|
|
87
|
+
label: messages.cellAlignmentMiddle,
|
|
88
|
+
value: "middle"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
type: VERTICAL_ALIGN_BOTTOM_ITEM.type,
|
|
93
|
+
key: VERTICAL_ALIGN_BOTTOM_ITEM.key,
|
|
94
|
+
parents: [{
|
|
95
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
96
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
97
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_ITEM.key]
|
|
98
|
+
}],
|
|
99
|
+
component: function component() {
|
|
100
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
101
|
+
api: api,
|
|
102
|
+
icon: AlignPositionBottomIcon,
|
|
103
|
+
label: messages.cellAlignmentBottom,
|
|
104
|
+
value: "bottom"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// --- Add / Move section (shared Add column right / Add row below / Distribute
|
|
109
|
+
// columns are registered in `../shared/getSharedItems`; Merge/Split cells below) ---
|
|
110
|
+
{
|
|
111
|
+
type: CELL_ADD_SECTION.type,
|
|
112
|
+
key: CELL_ADD_SECTION.key,
|
|
113
|
+
parents: [{
|
|
114
|
+
type: CELL_MENU.type,
|
|
115
|
+
key: CELL_MENU.key,
|
|
116
|
+
rank: CELL_MENU_RANK[CELL_ADD_SECTION.key]
|
|
117
|
+
}],
|
|
118
|
+
component: function component(props) {
|
|
119
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
120
|
+
hasSeparator: true
|
|
121
|
+
}, props.children);
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
type: MERGE_CELLS_ITEM.type,
|
|
125
|
+
key: MERGE_CELLS_ITEM.key,
|
|
126
|
+
parents: [{
|
|
127
|
+
type: CELL_ADD_SECTION.type,
|
|
128
|
+
key: CELL_ADD_SECTION.key,
|
|
129
|
+
rank: CELL_ADD_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
130
|
+
}],
|
|
131
|
+
component: function component() {
|
|
132
|
+
return /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
133
|
+
api: api
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
type: SPLIT_CELL_ITEM.type,
|
|
138
|
+
key: SPLIT_CELL_ITEM.key,
|
|
139
|
+
parents: [{
|
|
140
|
+
type: CELL_ADD_SECTION.type,
|
|
141
|
+
key: CELL_ADD_SECTION.key,
|
|
142
|
+
rank: CELL_ADD_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
143
|
+
}],
|
|
144
|
+
component: function component() {
|
|
145
|
+
return /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
146
|
+
api: api
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
// --- Danger section (Clear cell + shared Delete column / Delete row) ---
|
|
151
|
+
{
|
|
152
|
+
type: CELL_DANGER_SECTION.type,
|
|
153
|
+
key: CELL_DANGER_SECTION.key,
|
|
154
|
+
parents: [{
|
|
155
|
+
type: CELL_MENU.type,
|
|
156
|
+
key: CELL_MENU.key,
|
|
157
|
+
rank: CELL_MENU_RANK[CELL_DANGER_SECTION.key]
|
|
158
|
+
}],
|
|
159
|
+
component: function component(props) {
|
|
160
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
161
|
+
hasSeparator: true
|
|
162
|
+
}, props.children);
|
|
163
|
+
}
|
|
164
|
+
}] : [
|
|
165
|
+
// --- Cell menu update OFF: legacy cell menu (Merge/Split live in the action section) ---
|
|
166
|
+
|
|
15
167
|
// --- Menu surface ---
|
|
16
168
|
{
|
|
17
169
|
type: CELL_MENU.type,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { ADD_COLUMN_RIGHT_ITEM, DELETE_COLUMN_ITEM, DISTRIBUTE_COLUMNS_ITEM } from '../column/keys';
|
|
3
|
+
import { ADD_ROW_BELOW_ITEM, DELETE_ROW_ITEM } from '../row/keys';
|
|
2
4
|
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
|
|
3
5
|
|
|
4
6
|
// --- Menu surface ---
|
|
@@ -14,11 +16,15 @@ export var CELL_ACTION_SECTION = {
|
|
|
14
16
|
type: 'menu-section',
|
|
15
17
|
key: 'cell-action-section'
|
|
16
18
|
};
|
|
19
|
+
export var CELL_ADD_SECTION = {
|
|
20
|
+
type: 'menu-section',
|
|
21
|
+
key: 'cell-add-section'
|
|
22
|
+
};
|
|
17
23
|
export var CELL_DANGER_SECTION = {
|
|
18
24
|
type: 'menu-section',
|
|
19
25
|
key: 'cell-danger-section'
|
|
20
26
|
};
|
|
21
|
-
export var CELL_MENU_RANK = _defineProperty(_defineProperty({}, CELL_ACTION_SECTION.key, 100),
|
|
27
|
+
export var CELL_MENU_RANK = _defineProperty(_defineProperty(_defineProperty({}, CELL_ACTION_SECTION.key, 100), CELL_ADD_SECTION.key, 200), CELL_DANGER_SECTION.key, 300);
|
|
22
28
|
export var MERGE_CELLS_ITEM = {
|
|
23
29
|
type: 'menu-item',
|
|
24
30
|
key: 'merge-cells'
|
|
@@ -49,8 +55,16 @@ export var VERTICAL_ALIGN_BOTTOM_ITEM = {
|
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
// --- Item ranks within their sections ---
|
|
58
|
+
//
|
|
59
|
+
// The add/delete items rendered in the cell menu are shared with the row/column
|
|
60
|
+
// menus (registered once in `../shared/getSharedItems` with multiple parents), so
|
|
61
|
+
// we reuse their existing keys here rather than declaring cell-specific ones.
|
|
52
62
|
|
|
53
63
|
export var CELL_ACTION_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, BACKGROUND_COLOR_ITEM.key, 100), VERTICAL_ALIGN_MENU.key, 200), MERGE_CELLS_ITEM.key, 300), SPLIT_CELL_ITEM.key, 400);
|
|
54
64
|
export var VERTICAL_ALIGN_MENU_RANK = _defineProperty({}, VERTICAL_ALIGN_MENU_SECTION.key, 100);
|
|
55
65
|
export var VERTICAL_ALIGN_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, VERTICAL_ALIGN_TOP_ITEM.key, 100), VERTICAL_ALIGN_MIDDLE_ITEM.key, 200), VERTICAL_ALIGN_BOTTOM_ITEM.key, 300);
|
|
56
|
-
|
|
66
|
+
|
|
67
|
+
// Merge/Split cells are relocated from the action section into the add section when the
|
|
68
|
+
// cell menu update gate is on; they sit at the top of the section.
|
|
69
|
+
export var CELL_ADD_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, MERGE_CELLS_ITEM.key, 100), SPLIT_CELL_ITEM.key, 200), ADD_COLUMN_RIGHT_ITEM.key, 300), ADD_ROW_BELOW_ITEM.key, 400), DISTRIBUTE_COLUMNS_ITEM.key, 500);
|
|
70
|
+
export var CELL_DANGER_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, CLEAR_CELLS_ITEM.key, 100), DELETE_COLUMN_ITEM.key, 200), DELETE_ROW_ITEM.key, 300);
|