@atlaskit/editor-plugin-table 22.4.17 → 22.4.19
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 +14 -0
- package/dist/cjs/nodeviews/TableCell.js +9 -2
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +18 -21
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +17 -10
- package/dist/cjs/pm-plugins/commands/index.js +6 -0
- package/dist/cjs/pm-plugins/commands/misc.js +37 -5
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +23 -12
- package/dist/cjs/tablePlugin.js +5 -4
- package/dist/cjs/ui/FloatingContextualButton/index.js +32 -9
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +76 -0
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +61 -0
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +56 -0
- package/dist/cjs/ui/TableMenu/cell/items/verticalAlignUtils.js +20 -0
- package/dist/cjs/ui/TableMenu/cell/keys.js +24 -2
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -0
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/es2019/nodeviews/TableCell.js +9 -2
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +19 -18
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +10 -2
- package/dist/es2019/pm-plugins/commands/index.js +1 -1
- package/dist/es2019/pm-plugins/commands/misc.js +31 -0
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +22 -10
- package/dist/es2019/tablePlugin.js +6 -5
- package/dist/es2019/ui/FloatingContextualButton/index.js +36 -9
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +67 -1
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +56 -0
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +48 -0
- package/dist/es2019/ui/TableMenu/cell/items/verticalAlignUtils.js +15 -0
- package/dist/es2019/ui/TableMenu/cell/keys.js +31 -2
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/esm/nodeviews/TableCell.js +9 -2
- package/dist/esm/pm-plugins/commands/active-table-menu.js +18 -21
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +17 -10
- package/dist/esm/pm-plugins/commands/index.js +1 -1
- package/dist/esm/pm-plugins/commands/misc.js +36 -4
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +23 -12
- package/dist/esm/tablePlugin.js +6 -5
- package/dist/esm/ui/FloatingContextualButton/index.js +32 -9
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +77 -1
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +2 -1
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +2 -1
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +53 -0
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignNestedMenu.js +47 -0
- package/dist/esm/ui/TableMenu/cell/items/verticalAlignUtils.js +14 -0
- package/dist/esm/ui/TableMenu/cell/keys.js +23 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +3 -1
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +3 -0
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +3 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +3 -0
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +3 -0
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +2 -11
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +4 -3
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +2 -1
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types/pm-plugins/commands/index.d.ts +1 -1
- package/dist/types/pm-plugins/commands/misc.d.ts +4 -0
- package/dist/types/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
- package/dist/types/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
- package/dist/types/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
- package/dist/types/ui/TableMenu/cell/keys.d.ts +8 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignDropdownItem.d.ts +12 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/VerticalAlignNestedMenu.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/verticalAlignUtils.d.ts +3 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +8 -1
- package/package.json +5 -4
- package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
- package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
- package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -4
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
2
3
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
5
|
+
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
6
|
+
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
3
7
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
4
8
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
5
|
-
import {
|
|
9
|
+
import { VerticalAlignDropdownItem } from './items/VerticalAlignDropdownItem';
|
|
10
|
+
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';
|
|
6
12
|
export var getCellMenuComponents = function getCellMenuComponents(_ref) {
|
|
7
13
|
var api = _ref.api;
|
|
8
14
|
return [
|
|
@@ -23,6 +29,76 @@ export var getCellMenuComponents = function getCellMenuComponents(_ref) {
|
|
|
23
29
|
component: function component(props) {
|
|
24
30
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
25
31
|
}
|
|
32
|
+
}, {
|
|
33
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
34
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
35
|
+
parents: [{
|
|
36
|
+
type: CELL_ACTION_SECTION.type,
|
|
37
|
+
key: CELL_ACTION_SECTION.key,
|
|
38
|
+
rank: CELL_ACTION_SECTION_RANK[VERTICAL_ALIGN_MENU.key]
|
|
39
|
+
}],
|
|
40
|
+
component: function component(props) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, null, props.children);
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
45
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
46
|
+
parents: [{
|
|
47
|
+
type: VERTICAL_ALIGN_MENU.type,
|
|
48
|
+
key: VERTICAL_ALIGN_MENU.key,
|
|
49
|
+
rank: VERTICAL_ALIGN_MENU_RANK[VERTICAL_ALIGN_MENU_SECTION.key]
|
|
50
|
+
}],
|
|
51
|
+
component: function component(props) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
type: VERTICAL_ALIGN_TOP_ITEM.type,
|
|
56
|
+
key: VERTICAL_ALIGN_TOP_ITEM.key,
|
|
57
|
+
parents: [{
|
|
58
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
59
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
60
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_TOP_ITEM.key]
|
|
61
|
+
}],
|
|
62
|
+
component: function component() {
|
|
63
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
64
|
+
api: api,
|
|
65
|
+
icon: AlignPositionTopIcon,
|
|
66
|
+
label: messages.cellAlignmentTop,
|
|
67
|
+
value: "top"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
type: VERTICAL_ALIGN_MIDDLE_ITEM.type,
|
|
72
|
+
key: VERTICAL_ALIGN_MIDDLE_ITEM.key,
|
|
73
|
+
parents: [{
|
|
74
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
75
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
76
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_MIDDLE_ITEM.key]
|
|
77
|
+
}],
|
|
78
|
+
component: function component() {
|
|
79
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
80
|
+
api: api,
|
|
81
|
+
icon: AlignPositionCenterVerticalIcon,
|
|
82
|
+
label: messages.cellAlignmentMiddle,
|
|
83
|
+
value: "middle"
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
type: VERTICAL_ALIGN_BOTTOM_ITEM.type,
|
|
88
|
+
key: VERTICAL_ALIGN_BOTTOM_ITEM.key,
|
|
89
|
+
parents: [{
|
|
90
|
+
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
91
|
+
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
92
|
+
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_ITEM.key]
|
|
93
|
+
}],
|
|
94
|
+
component: function component() {
|
|
95
|
+
return /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
96
|
+
api: api,
|
|
97
|
+
icon: AlignPositionBottomIcon,
|
|
98
|
+
label: messages.cellAlignmentBottom,
|
|
99
|
+
value: "bottom"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
26
102
|
}, {
|
|
27
103
|
type: MERGE_CELLS_ITEM.type,
|
|
28
104
|
key: MERGE_CELLS_ITEM.key,
|
|
@@ -26,7 +26,8 @@ export var MergeCellsItem = function MergeCellsItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
mergeCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
-
closeActiveTableMenu()
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
30
31
|
};
|
|
31
32
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
32
33
|
return null;
|
|
@@ -26,7 +26,8 @@ export var SplitCellItem = function SplitCellItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
splitCellWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
-
closeActiveTableMenu()
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
30
31
|
};
|
|
31
32
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
32
33
|
return null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import { closeActiveTableMenu, setMultipleCellAttrsEditorCommand } from '../../../../pm-plugins/commands';
|
|
5
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
6
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
7
|
+
import { getSelectedCellValign } from './verticalAlignUtils';
|
|
8
|
+
export var VerticalAlignDropdownItem = function VerticalAlignDropdownItem(_ref) {
|
|
9
|
+
var _useTableMenuContext;
|
|
10
|
+
var api = _ref.api,
|
|
11
|
+
Icon = _ref.icon,
|
|
12
|
+
label = _ref.label,
|
|
13
|
+
value = _ref.value;
|
|
14
|
+
var _ref2 = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
15
|
+
editorView = _ref2.editorView;
|
|
16
|
+
var _useIntl = useIntl(),
|
|
17
|
+
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
var selectedValign = useMemo(function () {
|
|
19
|
+
return getSelectedCellValign(editorView);
|
|
20
|
+
}, [editorView]);
|
|
21
|
+
var handleClick = useCallback(function () {
|
|
22
|
+
if (!editorView || !api) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
var _getPluginState = getPluginState(editorView.state),
|
|
26
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
27
|
+
api.core.actions.execute(function (_ref3) {
|
|
28
|
+
var tr = _ref3.tr;
|
|
29
|
+
setMultipleCellAttrsEditorCommand({
|
|
30
|
+
valign: value
|
|
31
|
+
}, targetCellPosition)({
|
|
32
|
+
tr: tr
|
|
33
|
+
});
|
|
34
|
+
closeActiveTableMenu()({
|
|
35
|
+
tr: tr
|
|
36
|
+
});
|
|
37
|
+
return tr;
|
|
38
|
+
});
|
|
39
|
+
api.core.actions.focus();
|
|
40
|
+
}, [api, editorView, value]);
|
|
41
|
+
if (!editorView) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
45
|
+
elemBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
color: "currentColor",
|
|
47
|
+
label: "",
|
|
48
|
+
size: "small"
|
|
49
|
+
}),
|
|
50
|
+
isSelected: selectedValign === value,
|
|
51
|
+
onClick: handleClick
|
|
52
|
+
}, formatMessage(label));
|
|
53
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { NestedDropdownRightIcon, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
6
|
+
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
7
|
+
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
8
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
9
|
+
import { getSelectedCellValign } from './verticalAlignUtils';
|
|
10
|
+
var getTriggerIcon = function getTriggerIcon(valign) {
|
|
11
|
+
switch (valign) {
|
|
12
|
+
case 'middle':
|
|
13
|
+
return AlignPositionCenterVerticalIcon;
|
|
14
|
+
case 'bottom':
|
|
15
|
+
return AlignPositionBottomIcon;
|
|
16
|
+
case 'top':
|
|
17
|
+
default:
|
|
18
|
+
return AlignPositionTopIcon;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export var VerticalAlignNestedMenu = function VerticalAlignNestedMenu(_ref) {
|
|
22
|
+
var _useTableMenuContext;
|
|
23
|
+
var children = _ref.children;
|
|
24
|
+
var _ref2 = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
25
|
+
editorView = _ref2.editorView;
|
|
26
|
+
var _useIntl = useIntl(),
|
|
27
|
+
formatMessage = _useIntl.formatMessage;
|
|
28
|
+
var selectedValign = useMemo(function () {
|
|
29
|
+
return getSelectedCellValign(editorView);
|
|
30
|
+
}, [editorView]);
|
|
31
|
+
var TriggerIcon = getTriggerIcon(selectedValign);
|
|
32
|
+
if (!editorView) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
36
|
+
elemBefore: /*#__PURE__*/React.createElement(TriggerIcon, {
|
|
37
|
+
color: "currentColor",
|
|
38
|
+
label: "",
|
|
39
|
+
size: "small"
|
|
40
|
+
}),
|
|
41
|
+
elemAfter: /*#__PURE__*/React.createElement(NestedDropdownRightIcon, {
|
|
42
|
+
label: "",
|
|
43
|
+
size: "small"
|
|
44
|
+
}),
|
|
45
|
+
text: formatMessage(messages.cellAlignment)
|
|
46
|
+
}, children);
|
|
47
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
2
|
+
var getNormalizedValign = function getNormalizedValign(valign) {
|
|
3
|
+
return valign !== null && valign !== void 0 ? valign : 'top';
|
|
4
|
+
};
|
|
5
|
+
export var getSelectedCellValign = function getSelectedCellValign(editorView) {
|
|
6
|
+
if (!editorView) {
|
|
7
|
+
return 'top';
|
|
8
|
+
}
|
|
9
|
+
var state = editorView.state;
|
|
10
|
+
var _getPluginState = getPluginState(state),
|
|
11
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
12
|
+
var cell = typeof targetCellPosition === 'number' ? state.doc.nodeAt(targetCellPosition) : undefined;
|
|
13
|
+
return getNormalizedValign(cell === null || cell === void 0 ? void 0 : cell.attrs.valign);
|
|
14
|
+
};
|
|
@@ -27,8 +27,30 @@ export var SPLIT_CELL_ITEM = {
|
|
|
27
27
|
type: 'menu-item',
|
|
28
28
|
key: 'split-cell'
|
|
29
29
|
};
|
|
30
|
+
export var VERTICAL_ALIGN_MENU = {
|
|
31
|
+
type: 'nested-menu',
|
|
32
|
+
key: 'vertical-align'
|
|
33
|
+
};
|
|
34
|
+
export var VERTICAL_ALIGN_MENU_SECTION = {
|
|
35
|
+
type: 'menu-section',
|
|
36
|
+
key: 'vertical-align-section'
|
|
37
|
+
};
|
|
38
|
+
export var VERTICAL_ALIGN_TOP_ITEM = {
|
|
39
|
+
type: 'menu-item',
|
|
40
|
+
key: 'vertical-align-top'
|
|
41
|
+
};
|
|
42
|
+
export var VERTICAL_ALIGN_MIDDLE_ITEM = {
|
|
43
|
+
type: 'menu-item',
|
|
44
|
+
key: 'vertical-align-middle'
|
|
45
|
+
};
|
|
46
|
+
export var VERTICAL_ALIGN_BOTTOM_ITEM = {
|
|
47
|
+
type: 'menu-item',
|
|
48
|
+
key: 'vertical-align-bottom'
|
|
49
|
+
};
|
|
30
50
|
|
|
31
51
|
// --- Item ranks within their sections ---
|
|
32
52
|
|
|
33
|
-
export var CELL_ACTION_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, BACKGROUND_COLOR_ITEM.key, 100),
|
|
53
|
+
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
|
+
export var VERTICAL_ALIGN_MENU_RANK = _defineProperty({}, VERTICAL_ALIGN_MENU_SECTION.key, 100);
|
|
55
|
+
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);
|
|
34
56
|
export var CELL_DANGER_SECTION_RANK = _defineProperty({}, CLEAR_CELLS_ITEM.key, 100);
|
|
@@ -6,6 +6,7 @@ import { addColumnBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { TableColumnAddLeftIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
10
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
12
|
export var AddColumnLeftItem = function AddColumnLeftItem(_ref) {
|
|
@@ -38,6 +39,8 @@ export var AddColumnLeftItem = function AddColumnLeftItem(_ref) {
|
|
|
38
39
|
}
|
|
39
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
40
41
|
insertColumnWithAnalytics(api, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
42
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
43
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
41
44
|
};
|
|
42
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
43
46
|
onClick: handleClick,
|
|
@@ -6,6 +6,7 @@ import { addColumnAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
10
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
12
|
export var AddColumnRightItem = function AddColumnRightItem(_ref) {
|
|
@@ -38,6 +39,8 @@ export var AddColumnRightItem = function AddColumnRightItem(_ref) {
|
|
|
38
39
|
}
|
|
39
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
40
41
|
insertColumnWithAnalytics(api, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
42
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
43
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
41
44
|
};
|
|
42
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
43
46
|
onClick: handleClick,
|
|
@@ -6,7 +6,7 @@ import { deleteColumn, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
-
import { clearHoverSelection, hoverColumns } from '../../../../pm-plugins/commands';
|
|
9
|
+
import { clearHoverSelection, closeActiveTableMenu, hoverColumns } from '../../../../pm-plugins/commands';
|
|
10
10
|
import { deleteColumnsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
11
11
|
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
12
12
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
@@ -57,6 +57,8 @@ export var DeleteColumnItem = function DeleteColumnItem(_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
59
59
|
deleteColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
|
|
60
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
61
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
60
62
|
};
|
|
61
63
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
62
64
|
onClick: handleClick,
|
|
@@ -5,6 +5,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
8
9
|
import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
10
|
import { getNewResizeStateFromSelectedColumns } from '../../../../pm-plugins/table-resizing/utils/resize-state';
|
|
10
11
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
@@ -47,6 +48,8 @@ export var DistributeColumnsItem = function DistributeColumnsItem(_ref) {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
distributeColumnsWidthsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
|
|
51
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
52
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
50
53
|
};
|
|
51
54
|
if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
|
|
52
55
|
return null;
|
|
@@ -7,6 +7,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
9
|
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
10
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
11
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
12
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
12
13
|
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
@@ -41,6 +42,8 @@ export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
|
|
45
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
46
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
44
47
|
};
|
|
45
48
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
46
49
|
return null;
|
|
@@ -6,6 +6,7 @@ import { moveColumnRight, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
10
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
11
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
11
12
|
import { getSelectedColumnIndexes } from '../../../../pm-plugins/utils/selection';
|
|
@@ -40,6 +41,8 @@ export var MoveColumnRightItem = function MoveColumnRightItem(props) {
|
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.right)(editorView.state, editorView.dispatch);
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
45
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
43
46
|
};
|
|
44
47
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
45
48
|
return null;
|
|
@@ -5,6 +5,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
8
9
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
11
|
export var SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
@@ -25,6 +26,8 @@ export var SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.DESC)(editorView.state, editorView.dispatch);
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
28
31
|
};
|
|
29
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
30
33
|
onClick: handleClick,
|
|
@@ -5,6 +5,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
8
9
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
11
|
export var SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
@@ -25,6 +26,8 @@ export var SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.ASC)(editorView.state, editorView.dispatch);
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
30
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
28
31
|
};
|
|
29
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
30
33
|
onClick: handleClick,
|
|
@@ -5,6 +5,7 @@ import { addRowBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { TableRowAddAboveIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
8
9
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
11
|
export var AddRowAboveItem = function AddRowAboveItem(props) {
|
|
@@ -28,6 +29,8 @@ export var AddRowAboveItem = function AddRowAboveItem(props) {
|
|
|
28
29
|
index: index,
|
|
29
30
|
moveCursorToInsertedRow: true
|
|
30
31
|
})(editorView.state, editorView.dispatch);
|
|
32
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
33
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
31
34
|
};
|
|
32
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
33
36
|
onClick: handleClick,
|
|
@@ -5,6 +5,7 @@ import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
8
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
8
9
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
10
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
11
|
export var AddRowBelowItem = function AddRowBelowItem(props) {
|
|
@@ -28,6 +29,8 @@ export var AddRowBelowItem = function AddRowBelowItem(props) {
|
|
|
28
29
|
index: index,
|
|
29
30
|
moveCursorToInsertedRow: true
|
|
30
31
|
})(editorView.state, editorView.dispatch);
|
|
32
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
33
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
31
34
|
};
|
|
32
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
33
36
|
onClick: handleClick,
|
|
@@ -6,7 +6,7 @@ import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
-
import { clearHoverSelection, hoverRows } from '../../../../pm-plugins/commands';
|
|
9
|
+
import { clearHoverSelection, closeActiveTableMenu, hoverRows } from '../../../../pm-plugins/commands';
|
|
10
10
|
import { deleteRowsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
11
11
|
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
12
12
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
@@ -52,6 +52,8 @@ export var DeleteRowItem = function DeleteRowItem(props) {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
deleteRowsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(editorView.state, editorView.dispatch);
|
|
55
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
56
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
55
57
|
};
|
|
56
58
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
57
59
|
onClick: handleClick,
|
|
@@ -6,6 +6,7 @@ import { moveRowDown, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
10
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
11
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
11
12
|
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
@@ -40,6 +41,8 @@ export var MoveRowDownItem = function MoveRowDownItem(props) {
|
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.bottom)(editorView.state, editorView.dispatch);
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
45
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
43
46
|
};
|
|
44
47
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
45
48
|
return null;
|
|
@@ -6,6 +6,7 @@ import { moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
9
10
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
11
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
11
12
|
import { getSelectedRowIndexes } from '../../../../pm-plugins/utils/selection';
|
|
@@ -40,6 +41,8 @@ export var MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.top - 1)(editorView.state, editorView.dispatch);
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
45
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
43
46
|
};
|
|
44
47
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
45
48
|
return null;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
/* TableMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import "./TableMenu.compiled.css";
|
|
4
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
5
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
4
|
import React, { memo, useMemo } from 'react';
|
|
8
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
10
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
|
|
11
9
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
12
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
10
|
import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
|
|
14
11
|
import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
|
|
15
12
|
import { TableMenuProvider } from './TableMenuContext';
|
|
16
|
-
var tableMenuContainerStyles = {
|
|
17
|
-
container: "_2rko1qi0 _1bsb1178 _16qs130s _bfhk1bhr"
|
|
18
|
-
};
|
|
19
13
|
export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
20
14
|
var api = _ref.api,
|
|
21
15
|
editorView = _ref.editorView,
|
|
@@ -64,10 +58,7 @@ export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
64
58
|
}
|
|
65
59
|
return /*#__PURE__*/React.createElement(TableMenuProvider, {
|
|
66
60
|
value: tableMenuContext
|
|
67
|
-
}, /*#__PURE__*/React.createElement(
|
|
68
|
-
xcss: tableMenuContainerStyles.container,
|
|
69
|
-
testId: surface.key
|
|
70
|
-
}, /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
61
|
+
}, /*#__PURE__*/React.createElement(ToolbarMenuContainer, null, /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
71
62
|
surface: surface,
|
|
72
63
|
components: components
|
|
73
64
|
})));
|
|
@@ -20,7 +20,7 @@ var colorPaletteStyles = {
|
|
|
20
20
|
colorPreview: "_2rko12b0 _1h6d1l7x _1dqonqa1 _189ee4h9 _1bsbdlk8 _4t3idlk8 _1o9zidpf"
|
|
21
21
|
};
|
|
22
22
|
export var BackgroundColorItem = function BackgroundColorItem(_ref) {
|
|
23
|
-
var _useTableMenuContext
|
|
23
|
+
var _useTableMenuContext;
|
|
24
24
|
var api = _ref.api;
|
|
25
25
|
var _ref2 = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
26
26
|
editorView = _ref2.editorView;
|
|
@@ -42,8 +42,9 @@ export var BackgroundColorItem = function BackgroundColorItem(_ref) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
setColorWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, color, editorView)(editorView.state, editorView.dispatch);
|
|
45
|
-
closeActiveTableMenu()
|
|
46
|
-
|
|
45
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
46
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
47
|
+
}, [api, editorView]);
|
|
47
48
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
48
49
|
var colorPreviewStyle = useMemo(function () {
|
|
49
50
|
return {
|
|
@@ -25,7 +25,8 @@ export var ClearCellsItem = function ClearCellsItem(_ref) {
|
|
|
25
25
|
var _getPluginState = getPluginState(editorView.state),
|
|
26
26
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
27
27
|
emptyMultipleCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(editorView.state, editorView.dispatch);
|
|
28
|
-
closeActiveTableMenu()
|
|
28
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
29
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
29
30
|
};
|
|
30
31
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
31
32
|
onClick: handleClick,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { ActiveTableMenu } from '../../types';
|
|
3
|
-
export declare const closeActiveTableMenu: () =>
|
|
3
|
+
export declare const closeActiveTableMenu: () => EditorCommand;
|
|
4
4
|
export declare const toggleActiveTableMenu: (activeTableMenu: Exclude<ActiveTableMenu, {
|
|
5
5
|
type: "none";
|
|
6
|
-
}
|
|
6
|
+
}>, currentActiveTableMenu: ActiveTableMenu | undefined) => EditorCommand;
|
|
@@ -3,7 +3,7 @@ export { insertColumn, insertRow, createTable } from './insert';
|
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
4
|
export { closeActiveTableMenu, toggleActiveTableMenu } from './active-table-menu';
|
|
5
5
|
export { clearMultipleCells } from './clear';
|
|
6
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu, } from './misc';
|
|
6
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setMultipleCellAttrsEditorCommand, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu, } from './misc';
|
|
7
7
|
export { sortByColumn } from './sort';
|
|
8
8
|
export { goToNextCell } from './go-to-next-cell';
|
|
9
9
|
export { removeDescendantNodes } from './referentiality';
|
|
@@ -23,6 +23,10 @@ export declare const deleteTableIfSelected: Command;
|
|
|
23
23
|
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
24
24
|
export declare const moveCursorBackward: Command;
|
|
25
25
|
export declare const setMultipleCellAttrs: (attrs: object, editorView?: EditorView | null) => Command;
|
|
26
|
+
/**
|
|
27
|
+
* EditorCommand variant of `setMultipleCellAttrs`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const setMultipleCellAttrsEditorCommand: (attrs: object, targetCellPosition?: number) => EditorCommand;
|
|
26
30
|
export declare const selectColumn: (column: number, expand?: boolean, triggeredByKeyboard?: boolean) => Command;
|
|
27
31
|
export declare const selectColumns: (columnIndexes: number[]) => Command;
|
|
28
32
|
export declare const selectRow: (row: number, expand?: boolean, triggeredByKeyboard?: boolean) => Command;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type MessageDescriptor } from 'react-intl';
|
|
3
|
+
import type { Valign } from '@atlaskit/editor-common/types/valign';
|
|
4
|
+
import type AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
5
|
+
import type { TableMenuComponentsParams } from '../../shared/types';
|
|
6
|
+
type VerticalAlignDropdownItemProps = TableMenuComponentsParams & {
|
|
7
|
+
icon: typeof AlignPositionTopIcon;
|
|
8
|
+
label: MessageDescriptor;
|
|
9
|
+
value: Valign;
|
|
10
|
+
};
|
|
11
|
+
export declare const VerticalAlignDropdownItem: ({ api, icon: Icon, label, value, }: VerticalAlignDropdownItemProps) => React.JSX.Element | null;
|
|
12
|
+
export {};
|