@atlaskit/editor-plugin-table 24.5.4 → 24.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +40 -6
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +42 -7
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +4 -1
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +4 -1
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +42 -7
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +42 -7
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +5 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +35 -4
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +36 -4
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +5 -2
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +5 -2
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +36 -4
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +36 -4
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +5 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +38 -4
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +39 -4
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +5 -2
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +5 -2
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +39 -4
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +39 -4
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +5 -0
- package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 24.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6e8461981e75d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e8461981e75d) -
|
|
8
|
+
Disable row and column move options when merged cells prevent reordering behind the
|
|
9
|
+
platform_editor_table_menu_updates_patch_2 experiment
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 24.5.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -12,8 +12,13 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
var
|
|
15
|
+
var _informationCircleIcon = require("@atlaskit/editor-toolbar/information-circle-icon");
|
|
16
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
17
|
+
var _toolbarKeyboardShortcutHint = require("@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint");
|
|
16
18
|
var _tableColumnMoveLeft = _interopRequireDefault(require("@atlaskit/icon/core/table-column-move-left"));
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
+
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
17
22
|
var _commands = require("../../../../pm-plugins/commands");
|
|
18
23
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
19
24
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
@@ -55,17 +60,46 @@ var MoveColumnLeftItem = exports.MoveColumnLeftItem = function MoveColumnLeftIte
|
|
|
55
60
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
56
61
|
return null;
|
|
57
62
|
}
|
|
58
|
-
|
|
63
|
+
var label = formatMessage(_messages.tableMessages.moveColumnLeft, {
|
|
64
|
+
0: selectedColumnCount
|
|
65
|
+
});
|
|
66
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnLeft);
|
|
67
|
+
var isMoveDisabled = (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
68
|
+
if (isMoveDisabled) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_tableColumnMoveLeft.default, {
|
|
71
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
72
|
+
label: "",
|
|
73
|
+
size: "small"
|
|
74
|
+
}),
|
|
75
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
76
|
+
content: formatMessage(_messages.tableMessages.canNotMoveColumnLeftWithMergedCells),
|
|
77
|
+
position: "top"
|
|
78
|
+
}, function (tooltipProps) {
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// Ignored via go/ees005
|
|
82
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
83
|
+
_react.default.createElement("span", tooltipProps, /*#__PURE__*/_react.default.createElement(_informationCircleIcon.InformationCircleIcon, {
|
|
84
|
+
label: "",
|
|
85
|
+
size: "small",
|
|
86
|
+
color: "var(--ds-icon, #292A2E)"
|
|
87
|
+
}))
|
|
88
|
+
);
|
|
89
|
+
})
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
91
|
+
color: "color.text.disabled"
|
|
92
|
+
}, label));
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
59
95
|
onClick: handleClick,
|
|
60
96
|
elemBefore: /*#__PURE__*/_react.default.createElement(_tableColumnMoveLeft.default, {
|
|
61
97
|
color: "currentColor",
|
|
62
98
|
label: "",
|
|
63
99
|
size: "small"
|
|
64
100
|
}),
|
|
65
|
-
elemAfter: /*#__PURE__*/_react.default.createElement(
|
|
101
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_toolbarKeyboardShortcutHint.ToolbarKeyboardShortcutHint, {
|
|
66
102
|
shortcut: (_tooltip = (0, _keymaps.tooltip)(_keymaps.moveColumnLeft)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
67
103
|
})
|
|
68
|
-
},
|
|
69
|
-
0: selectedColumnCount
|
|
70
|
-
}));
|
|
104
|
+
}, label);
|
|
71
105
|
};
|
|
@@ -12,7 +12,13 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
var
|
|
15
|
+
var _columnMoveRightIcon = require("@atlaskit/editor-toolbar/column-move-right-icon");
|
|
16
|
+
var _informationCircleIcon = require("@atlaskit/editor-toolbar/information-circle-icon");
|
|
17
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
18
|
+
var _toolbarKeyboardShortcutHint = require("@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint");
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
+
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
16
22
|
var _commands = require("../../../../pm-plugins/commands");
|
|
17
23
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
18
24
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
@@ -54,17 +60,46 @@ var MoveColumnRightItem = exports.MoveColumnRightItem = function MoveColumnRight
|
|
|
54
60
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
55
61
|
return null;
|
|
56
62
|
}
|
|
57
|
-
|
|
63
|
+
var label = formatMessage(_messages.tableMessages.moveColumnRight, {
|
|
64
|
+
0: selectedColumnCount
|
|
65
|
+
});
|
|
66
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnRight);
|
|
67
|
+
var isMoveDisabled = (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
68
|
+
if (isMoveDisabled) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_columnMoveRightIcon.TableColumnMoveRightIcon, {
|
|
71
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
72
|
+
label: "",
|
|
73
|
+
size: "small"
|
|
74
|
+
}),
|
|
75
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
76
|
+
content: formatMessage(_messages.tableMessages.canNotMoveColumnRightWithMergedCells),
|
|
77
|
+
position: "top"
|
|
78
|
+
}, function (tooltipProps) {
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// Ignored via go/ees005
|
|
82
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
83
|
+
_react.default.createElement("span", tooltipProps, /*#__PURE__*/_react.default.createElement(_informationCircleIcon.InformationCircleIcon, {
|
|
84
|
+
label: "",
|
|
85
|
+
size: "small",
|
|
86
|
+
color: "var(--ds-icon, #292A2E)"
|
|
87
|
+
}))
|
|
88
|
+
);
|
|
89
|
+
})
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
91
|
+
color: "color.text.disabled"
|
|
92
|
+
}, label));
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
58
95
|
onClick: handleClick,
|
|
59
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(
|
|
96
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_columnMoveRightIcon.TableColumnMoveRightIcon, {
|
|
60
97
|
color: "currentColor",
|
|
61
98
|
label: "",
|
|
62
99
|
size: "small"
|
|
63
100
|
}),
|
|
64
|
-
elemAfter: /*#__PURE__*/_react.default.createElement(
|
|
101
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_toolbarKeyboardShortcutHint.ToolbarKeyboardShortcutHint, {
|
|
65
102
|
shortcut: (_tooltip = (0, _keymaps.tooltip)(_keymaps.moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
66
103
|
})
|
|
67
|
-
},
|
|
68
|
-
0: selectedColumnCount
|
|
69
|
-
}));
|
|
104
|
+
}, label);
|
|
70
105
|
};
|
|
@@ -18,6 +18,7 @@ var _utils = require("@atlaskit/editor-tables/utils");
|
|
|
18
18
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
22
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
22
23
|
var _commands = require("../../../../pm-plugins/commands");
|
|
23
24
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
@@ -72,7 +73,9 @@ var SortDecreasingItem = exports.SortDecreasingItem = function SortDecreasingIte
|
|
|
72
73
|
color: "var(--ds-icon, #292A2E)"
|
|
73
74
|
}));
|
|
74
75
|
})
|
|
75
|
-
}, /*#__PURE__*/_react.default.createElement(_compiled.
|
|
76
|
+
}, (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
77
|
+
color: "color.text.disabled"
|
|
78
|
+
}, formatMessage(_messages.tableMessages.sortColumnDecreasing)) : /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
76
79
|
as: "span",
|
|
77
80
|
xcss: styles.disabledLabel
|
|
78
81
|
}, formatMessage(_messages.tableMessages.sortColumnDecreasing)));
|
|
@@ -18,6 +18,7 @@ var _utils = require("@atlaskit/editor-tables/utils");
|
|
|
18
18
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
19
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
22
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
22
23
|
var _commands = require("../../../../pm-plugins/commands");
|
|
23
24
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
@@ -72,7 +73,9 @@ var SortIncreasingItem = exports.SortIncreasingItem = function SortIncreasingIte
|
|
|
72
73
|
color: "var(--ds-icon, #292A2E)"
|
|
73
74
|
}));
|
|
74
75
|
})
|
|
75
|
-
}, /*#__PURE__*/_react.default.createElement(_compiled.
|
|
76
|
+
}, (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
77
|
+
color: "color.text.disabled"
|
|
78
|
+
}, formatMessage(_messages.tableMessages.sortColumnIncreasing)) : /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
76
79
|
as: "span",
|
|
77
80
|
xcss: styles.disabledLabel
|
|
78
81
|
}, formatMessage(_messages.tableMessages.sortColumnIncreasing)));
|
|
@@ -12,7 +12,13 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
var
|
|
15
|
+
var _informationCircleIcon = require("@atlaskit/editor-toolbar/information-circle-icon");
|
|
16
|
+
var _rowMoveDownIcon = require("@atlaskit/editor-toolbar/row-move-down-icon");
|
|
17
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
18
|
+
var _toolbarKeyboardShortcutHint = require("@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint");
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
+
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
16
22
|
var _commands = require("../../../../pm-plugins/commands");
|
|
17
23
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
18
24
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
@@ -54,17 +60,46 @@ var MoveRowDownItem = exports.MoveRowDownItem = function MoveRowDownItem(props)
|
|
|
54
60
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
55
61
|
return null;
|
|
56
62
|
}
|
|
57
|
-
|
|
63
|
+
var label = formatMessage(_messages.tableMessages.moveRowDown, {
|
|
64
|
+
0: selectedRowCount
|
|
65
|
+
});
|
|
66
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowDown);
|
|
67
|
+
var isMoveDisabled = (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
68
|
+
if (isMoveDisabled) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_rowMoveDownIcon.TableRowMoveDownIcon, {
|
|
71
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
72
|
+
label: "",
|
|
73
|
+
size: "small"
|
|
74
|
+
}),
|
|
75
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
76
|
+
content: formatMessage(_messages.tableMessages.canNotMoveRowDownWithMergedCells),
|
|
77
|
+
position: "top"
|
|
78
|
+
}, function (tooltipProps) {
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// Ignored via go/ees005
|
|
82
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
83
|
+
_react.default.createElement("span", tooltipProps, /*#__PURE__*/_react.default.createElement(_informationCircleIcon.InformationCircleIcon, {
|
|
84
|
+
label: "",
|
|
85
|
+
size: "small",
|
|
86
|
+
color: "var(--ds-icon, #292A2E)"
|
|
87
|
+
}))
|
|
88
|
+
);
|
|
89
|
+
})
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
91
|
+
color: "color.text.disabled"
|
|
92
|
+
}, label));
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
58
95
|
onClick: handleClick,
|
|
59
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(
|
|
96
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_rowMoveDownIcon.TableRowMoveDownIcon, {
|
|
60
97
|
color: "currentColor",
|
|
61
98
|
label: "",
|
|
62
99
|
size: "small"
|
|
63
100
|
}),
|
|
64
|
-
elemAfter: /*#__PURE__*/_react.default.createElement(
|
|
101
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_toolbarKeyboardShortcutHint.ToolbarKeyboardShortcutHint, {
|
|
65
102
|
shortcut: (_tooltip = (0, _keymaps.tooltip)(_keymaps.moveRowDown)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
66
103
|
})
|
|
67
|
-
},
|
|
68
|
-
0: selectedRowCount
|
|
69
|
-
}));
|
|
104
|
+
}, label);
|
|
70
105
|
};
|
|
@@ -12,7 +12,13 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
var
|
|
15
|
+
var _informationCircleIcon = require("@atlaskit/editor-toolbar/information-circle-icon");
|
|
16
|
+
var _rowMoveUpIcon = require("@atlaskit/editor-toolbar/row-move-up-icon");
|
|
17
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
18
|
+
var _toolbarKeyboardShortcutHint = require("@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint");
|
|
19
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
|
+
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
16
22
|
var _commands = require("../../../../pm-plugins/commands");
|
|
17
23
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
18
24
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
@@ -54,17 +60,46 @@ var MoveRowUpItem = exports.MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
54
60
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
55
61
|
return null;
|
|
56
62
|
}
|
|
57
|
-
|
|
63
|
+
var label = formatMessage(_messages.tableMessages.moveRowUp, {
|
|
64
|
+
0: selectedRowCount
|
|
65
|
+
});
|
|
66
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowUp);
|
|
67
|
+
var isMoveDisabled = (0, _expValEquals.expValEquals)('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
68
|
+
if (isMoveDisabled) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_rowMoveUpIcon.TableRowMoveUpIcon, {
|
|
71
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
72
|
+
label: "",
|
|
73
|
+
size: "small"
|
|
74
|
+
}),
|
|
75
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
76
|
+
content: formatMessage(_messages.tableMessages.canNotMoveRowUpWithMergedCells),
|
|
77
|
+
position: "top"
|
|
78
|
+
}, function (tooltipProps) {
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// Ignored via go/ees005
|
|
82
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
83
|
+
_react.default.createElement("span", tooltipProps, /*#__PURE__*/_react.default.createElement(_informationCircleIcon.InformationCircleIcon, {
|
|
84
|
+
label: "",
|
|
85
|
+
size: "small",
|
|
86
|
+
color: "var(--ds-icon, #292A2E)"
|
|
87
|
+
}))
|
|
88
|
+
);
|
|
89
|
+
})
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
91
|
+
color: "color.text.disabled"
|
|
92
|
+
}, label));
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
58
95
|
onClick: handleClick,
|
|
59
|
-
elemBefore: /*#__PURE__*/_react.default.createElement(
|
|
96
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_rowMoveUpIcon.TableRowMoveUpIcon, {
|
|
60
97
|
color: "currentColor",
|
|
61
98
|
label: "",
|
|
62
99
|
size: "small"
|
|
63
100
|
}),
|
|
64
|
-
elemAfter: /*#__PURE__*/_react.default.createElement(
|
|
101
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_toolbarKeyboardShortcutHint.ToolbarKeyboardShortcutHint, {
|
|
65
102
|
shortcut: (_tooltip = (0, _keymaps.tooltip)(_keymaps.moveRowUp)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
66
103
|
})
|
|
67
|
-
},
|
|
68
|
-
0: selectedRowCount
|
|
69
|
-
}));
|
|
104
|
+
}, label);
|
|
70
105
|
};
|
|
@@ -15,6 +15,7 @@ var _toolbarMenuContainer = require("@atlaskit/editor-toolbar/toolbar-menu-conta
|
|
|
15
15
|
var _editorUiControlModel = require("@atlaskit/editor-ui-control-model");
|
|
16
16
|
var _splitCell = require("../../../pm-plugins/commands/split-cell");
|
|
17
17
|
var _merge = require("../../../pm-plugins/transforms/merge");
|
|
18
|
+
var _dragMenu = require("../../../pm-plugins/utils/drag-menu");
|
|
18
19
|
var _TableMenuContext = require("./TableMenuContext");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
21
|
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; }
|
|
@@ -54,6 +55,10 @@ var TableMenu = exports.TableMenu = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
54
55
|
return cellOps;
|
|
55
56
|
}
|
|
56
57
|
return _objectSpread(_objectSpread({}, cellOps), {}, {
|
|
58
|
+
canMoveRowUp: (0, _dragMenu.canMove)('table-row', -1, tableMap.height, editorView.state.selection, selectionRect),
|
|
59
|
+
canMoveRowDown: (0, _dragMenu.canMove)('table-row', 1, tableMap.height, editorView.state.selection, selectionRect),
|
|
60
|
+
canMoveColumnLeft: (0, _dragMenu.canMove)('table-column', -1, tableMap.width, editorView.state.selection, selectionRect),
|
|
61
|
+
canMoveColumnRight: (0, _dragMenu.canMove)('table-column', 1, tableMap.width, editorView.state.selection, selectionRect),
|
|
57
62
|
isFirstRow: selectionRect.top === 0,
|
|
58
63
|
isLastRow: selectionRect.bottom === tableMap.height,
|
|
59
64
|
selectedRowCount: selectionRect.bottom - selectionRect.top,
|
|
@@ -5,8 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { moveColumnLeft, 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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
10
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
9
11
|
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
10
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
11
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -51,6 +56,34 @@ export const MoveColumnLeftItem = props => {
|
|
|
51
56
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
52
57
|
return null;
|
|
53
58
|
}
|
|
59
|
+
const label = formatMessage(messages.moveColumnLeft, {
|
|
60
|
+
0: selectedColumnCount
|
|
61
|
+
});
|
|
62
|
+
const canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnLeft);
|
|
63
|
+
const isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
64
|
+
if (isMoveDisabled) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
66
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
67
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
68
|
+
label: "",
|
|
69
|
+
size: "small"
|
|
70
|
+
}),
|
|
71
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
72
|
+
content: formatMessage(messages.canNotMoveColumnLeftWithMergedCells),
|
|
73
|
+
position: "top"
|
|
74
|
+
}, tooltipProps =>
|
|
75
|
+
/*#__PURE__*/
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
78
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
79
|
+
label: "",
|
|
80
|
+
size: "small",
|
|
81
|
+
color: "var(--ds-icon, #292A2E)"
|
|
82
|
+
})))
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
54
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
55
88
|
onClick: handleClick,
|
|
56
89
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
@@ -61,7 +94,5 @@ export const MoveColumnLeftItem = props => {
|
|
|
61
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
62
95
|
shortcut: (_tooltip = tooltip(moveColumnLeft)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
63
96
|
})
|
|
64
|
-
},
|
|
65
|
-
0: selectedColumnCount
|
|
66
|
-
}));
|
|
97
|
+
}, label);
|
|
67
98
|
};
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import { TableColumnMoveRightIcon
|
|
8
|
+
import { TableColumnMoveRightIcon } from '@atlaskit/editor-toolbar/column-move-right-icon';
|
|
9
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -50,6 +56,34 @@ export const MoveColumnRightItem = props => {
|
|
|
50
56
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
59
|
+
const label = formatMessage(messages.moveColumnRight, {
|
|
60
|
+
0: selectedColumnCount
|
|
61
|
+
});
|
|
62
|
+
const canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnRight);
|
|
63
|
+
const isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
64
|
+
if (isMoveDisabled) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
66
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
67
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
68
|
+
label: "",
|
|
69
|
+
size: "small"
|
|
70
|
+
}),
|
|
71
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
72
|
+
content: formatMessage(messages.canNotMoveColumnRightWithMergedCells),
|
|
73
|
+
position: "top"
|
|
74
|
+
}, tooltipProps =>
|
|
75
|
+
/*#__PURE__*/
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
78
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
79
|
+
label: "",
|
|
80
|
+
size: "small",
|
|
81
|
+
color: "var(--ds-icon, #292A2E)"
|
|
82
|
+
})))
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
53
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
54
88
|
onClick: handleClick,
|
|
55
89
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
@@ -60,7 +94,5 @@ export const MoveColumnRightItem = props => {
|
|
|
60
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
61
95
|
shortcut: (_tooltip = tooltip(moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
62
96
|
})
|
|
63
|
-
},
|
|
64
|
-
0: selectedColumnCount
|
|
65
|
-
}));
|
|
97
|
+
}, label);
|
|
66
98
|
};
|
|
@@ -10,7 +10,8 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { InformationCircleIcon, SortDescendingIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
16
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
16
17
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -66,7 +67,9 @@ export const SortDecreasingItem = ({
|
|
|
66
67
|
size: "small",
|
|
67
68
|
color: "var(--ds-icon, #292A2E)"
|
|
68
69
|
})))
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
70
|
+
}, expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/React.createElement(Text, {
|
|
71
|
+
color: "color.text.disabled"
|
|
72
|
+
}, formatMessage(messages.sortColumnDecreasing)) : /*#__PURE__*/React.createElement(Box, {
|
|
70
73
|
as: "span",
|
|
71
74
|
xcss: styles.disabledLabel
|
|
72
75
|
}, formatMessage(messages.sortColumnDecreasing)));
|
|
@@ -10,7 +10,8 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { InformationCircleIcon, SortAscendingIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
16
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
16
17
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -66,7 +67,9 @@ export const SortIncreasingItem = ({
|
|
|
66
67
|
size: "small",
|
|
67
68
|
color: "var(--ds-icon, #292A2E)"
|
|
68
69
|
})))
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
70
|
+
}, expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/React.createElement(Text, {
|
|
71
|
+
color: "color.text.disabled"
|
|
72
|
+
}, formatMessage(messages.sortColumnIncreasing)) : /*#__PURE__*/React.createElement(Box, {
|
|
70
73
|
as: "span",
|
|
71
74
|
xcss: styles.disabledLabel
|
|
72
75
|
}, formatMessage(messages.sortColumnIncreasing)));
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { TableRowMoveDownIcon } from '@atlaskit/editor-toolbar/row-move-down-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -50,6 +56,34 @@ export const MoveRowDownItem = props => {
|
|
|
50
56
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
59
|
+
const label = formatMessage(messages.moveRowDown, {
|
|
60
|
+
0: selectedRowCount
|
|
61
|
+
});
|
|
62
|
+
const canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowDown);
|
|
63
|
+
const isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
64
|
+
if (isMoveDisabled) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
66
|
+
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
67
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
68
|
+
label: "",
|
|
69
|
+
size: "small"
|
|
70
|
+
}),
|
|
71
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
72
|
+
content: formatMessage(messages.canNotMoveRowDownWithMergedCells),
|
|
73
|
+
position: "top"
|
|
74
|
+
}, tooltipProps =>
|
|
75
|
+
/*#__PURE__*/
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
78
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
79
|
+
label: "",
|
|
80
|
+
size: "small",
|
|
81
|
+
color: "var(--ds-icon, #292A2E)"
|
|
82
|
+
})))
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
53
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
54
88
|
onClick: handleClick,
|
|
55
89
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
@@ -60,7 +94,5 @@ export const MoveRowDownItem = props => {
|
|
|
60
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
61
95
|
shortcut: (_tooltip = tooltip(moveRowDown)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
62
96
|
})
|
|
63
|
-
},
|
|
64
|
-
0: selectedRowCount
|
|
65
|
-
}));
|
|
97
|
+
}, label);
|
|
66
98
|
};
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { TableRowMoveUpIcon } from '@atlaskit/editor-toolbar/row-move-up-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -50,6 +56,34 @@ export const MoveRowUpItem = props => {
|
|
|
50
56
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
59
|
+
const label = formatMessage(messages.moveRowUp, {
|
|
60
|
+
0: selectedRowCount
|
|
61
|
+
});
|
|
62
|
+
const canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowUp);
|
|
63
|
+
const isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
64
|
+
if (isMoveDisabled) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
66
|
+
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
67
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
68
|
+
label: "",
|
|
69
|
+
size: "small"
|
|
70
|
+
}),
|
|
71
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
72
|
+
content: formatMessage(messages.canNotMoveRowUpWithMergedCells),
|
|
73
|
+
position: "top"
|
|
74
|
+
}, tooltipProps =>
|
|
75
|
+
/*#__PURE__*/
|
|
76
|
+
// Ignored via go/ees005
|
|
77
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
78
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
79
|
+
label: "",
|
|
80
|
+
size: "small",
|
|
81
|
+
color: "var(--ds-icon, #292A2E)"
|
|
82
|
+
})))
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
53
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
54
88
|
onClick: handleClick,
|
|
55
89
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
@@ -60,7 +94,5 @@ export const MoveRowUpItem = props => {
|
|
|
60
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
61
95
|
shortcut: (_tooltip = tooltip(moveRowUp)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
62
96
|
})
|
|
63
|
-
},
|
|
64
|
-
0: selectedRowCount
|
|
65
|
-
}));
|
|
97
|
+
}, label);
|
|
66
98
|
};
|
|
@@ -6,6 +6,7 @@ import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-cont
|
|
|
6
6
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
7
7
|
import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
|
|
8
8
|
import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
|
|
9
|
+
import { canMove } from '../../../pm-plugins/utils/drag-menu';
|
|
9
10
|
import { TableMenuProvider } from './TableMenuContext';
|
|
10
11
|
export const TableMenu = /*#__PURE__*/memo(({
|
|
11
12
|
api,
|
|
@@ -45,6 +46,10 @@ export const TableMenu = /*#__PURE__*/memo(({
|
|
|
45
46
|
}
|
|
46
47
|
return {
|
|
47
48
|
...cellOps,
|
|
49
|
+
canMoveRowUp: canMove('table-row', -1, tableMap.height, editorView.state.selection, selectionRect),
|
|
50
|
+
canMoveRowDown: canMove('table-row', 1, tableMap.height, editorView.state.selection, selectionRect),
|
|
51
|
+
canMoveColumnLeft: canMove('table-column', -1, tableMap.width, editorView.state.selection, selectionRect),
|
|
52
|
+
canMoveColumnRight: canMove('table-column', 1, tableMap.width, editorView.state.selection, selectionRect),
|
|
48
53
|
isFirstRow: selectionRect.top === 0,
|
|
49
54
|
isLastRow: selectionRect.bottom === tableMap.height,
|
|
50
55
|
selectedRowCount: selectionRect.bottom - selectionRect.top,
|
|
@@ -5,8 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { moveColumnLeft, 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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
10
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
9
11
|
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
10
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
11
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -48,6 +53,37 @@ export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
|
48
53
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
49
54
|
return null;
|
|
50
55
|
}
|
|
56
|
+
var label = formatMessage(messages.moveColumnLeft, {
|
|
57
|
+
0: selectedColumnCount
|
|
58
|
+
});
|
|
59
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnLeft);
|
|
60
|
+
var isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
61
|
+
if (isMoveDisabled) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
63
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
64
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
65
|
+
label: "",
|
|
66
|
+
size: "small"
|
|
67
|
+
}),
|
|
68
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
+
content: formatMessage(messages.canNotMoveColumnLeftWithMergedCells),
|
|
70
|
+
position: "top"
|
|
71
|
+
}, function (tooltipProps) {
|
|
72
|
+
return (
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
// Ignored via go/ees005
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
77
|
+
label: "",
|
|
78
|
+
size: "small",
|
|
79
|
+
color: "var(--ds-icon, #292A2E)"
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
51
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
52
88
|
onClick: handleClick,
|
|
53
89
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveLeftIcon, {
|
|
@@ -58,7 +94,5 @@ export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
|
58
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
59
95
|
shortcut: (_tooltip = tooltip(moveColumnLeft)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
60
96
|
})
|
|
61
|
-
},
|
|
62
|
-
0: selectedColumnCount
|
|
63
|
-
}));
|
|
97
|
+
}, label);
|
|
64
98
|
};
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import { TableColumnMoveRightIcon
|
|
8
|
+
import { TableColumnMoveRightIcon } from '@atlaskit/editor-toolbar/column-move-right-icon';
|
|
9
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -47,6 +53,37 @@ export var MoveColumnRightItem = function MoveColumnRightItem(props) {
|
|
|
47
53
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
48
54
|
return null;
|
|
49
55
|
}
|
|
56
|
+
var label = formatMessage(messages.moveColumnRight, {
|
|
57
|
+
0: selectedColumnCount
|
|
58
|
+
});
|
|
59
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveColumnRight);
|
|
60
|
+
var isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
61
|
+
if (isMoveDisabled) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
63
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
64
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
65
|
+
label: "",
|
|
66
|
+
size: "small"
|
|
67
|
+
}),
|
|
68
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
+
content: formatMessage(messages.canNotMoveColumnRightWithMergedCells),
|
|
70
|
+
position: "top"
|
|
71
|
+
}, function (tooltipProps) {
|
|
72
|
+
return (
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
// Ignored via go/ees005
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
77
|
+
label: "",
|
|
78
|
+
size: "small",
|
|
79
|
+
color: "var(--ds-icon, #292A2E)"
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
50
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
51
88
|
onClick: handleClick,
|
|
52
89
|
elemBefore: /*#__PURE__*/React.createElement(TableColumnMoveRightIcon, {
|
|
@@ -57,7 +94,5 @@ export var MoveColumnRightItem = function MoveColumnRightItem(props) {
|
|
|
57
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
58
95
|
shortcut: (_tooltip = tooltip(moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
59
96
|
})
|
|
60
|
-
},
|
|
61
|
-
0: selectedColumnCount
|
|
62
|
-
}));
|
|
97
|
+
}, label);
|
|
63
98
|
};
|
|
@@ -10,7 +10,8 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { InformationCircleIcon, SortDescendingIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
16
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
16
17
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -65,7 +66,9 @@ export var SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
|
65
66
|
color: "var(--ds-icon, #292A2E)"
|
|
66
67
|
}));
|
|
67
68
|
})
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
+
}, expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/React.createElement(Text, {
|
|
70
|
+
color: "color.text.disabled"
|
|
71
|
+
}, formatMessage(messages.sortColumnDecreasing)) : /*#__PURE__*/React.createElement(Box, {
|
|
69
72
|
as: "span",
|
|
70
73
|
xcss: styles.disabledLabel
|
|
71
74
|
}, formatMessage(messages.sortColumnDecreasing)));
|
|
@@ -10,7 +10,8 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { InformationCircleIcon, SortAscendingIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
16
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
16
17
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -65,7 +66,9 @@ export var SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
|
65
66
|
color: "var(--ds-icon, #292A2E)"
|
|
66
67
|
}));
|
|
67
68
|
})
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
+
}, expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) ? /*#__PURE__*/React.createElement(Text, {
|
|
70
|
+
color: "color.text.disabled"
|
|
71
|
+
}, formatMessage(messages.sortColumnIncreasing)) : /*#__PURE__*/React.createElement(Box, {
|
|
69
72
|
as: "span",
|
|
70
73
|
xcss: styles.disabledLabel
|
|
71
74
|
}, formatMessage(messages.sortColumnIncreasing)));
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { TableRowMoveDownIcon } from '@atlaskit/editor-toolbar/row-move-down-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -47,6 +53,37 @@ export var MoveRowDownItem = function MoveRowDownItem(props) {
|
|
|
47
53
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
48
54
|
return null;
|
|
49
55
|
}
|
|
56
|
+
var label = formatMessage(messages.moveRowDown, {
|
|
57
|
+
0: selectedRowCount
|
|
58
|
+
});
|
|
59
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowDown);
|
|
60
|
+
var isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
61
|
+
if (isMoveDisabled) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
63
|
+
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
64
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
65
|
+
label: "",
|
|
66
|
+
size: "small"
|
|
67
|
+
}),
|
|
68
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
+
content: formatMessage(messages.canNotMoveRowDownWithMergedCells),
|
|
70
|
+
position: "top"
|
|
71
|
+
}, function (tooltipProps) {
|
|
72
|
+
return (
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
// Ignored via go/ees005
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
77
|
+
label: "",
|
|
78
|
+
size: "small",
|
|
79
|
+
color: "var(--ds-icon, #292A2E)"
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
50
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
51
88
|
onClick: handleClick,
|
|
52
89
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveDownIcon, {
|
|
@@ -57,7 +94,5 @@ export var MoveRowDownItem = function MoveRowDownItem(props) {
|
|
|
57
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
58
95
|
shortcut: (_tooltip = tooltip(moveRowDown)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
59
96
|
})
|
|
60
|
-
},
|
|
61
|
-
0: selectedRowCount
|
|
62
|
-
}));
|
|
97
|
+
}, label);
|
|
63
98
|
};
|
|
@@ -5,7 +5,13 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
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
|
-
import {
|
|
8
|
+
import { InformationCircleIcon } from '@atlaskit/editor-toolbar/information-circle-icon';
|
|
9
|
+
import { TableRowMoveUpIcon } from '@atlaskit/editor-toolbar/row-move-up-icon';
|
|
10
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
11
|
+
import { ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar/toolbar-keyboard-shortcut-hint';
|
|
12
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
9
15
|
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
10
16
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
17
|
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
|
|
@@ -47,6 +53,37 @@ export var MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
47
53
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
48
54
|
return null;
|
|
49
55
|
}
|
|
56
|
+
var label = formatMessage(messages.moveRowUp, {
|
|
57
|
+
0: selectedRowCount
|
|
58
|
+
});
|
|
59
|
+
var canMove = Boolean(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMoveRowUp);
|
|
60
|
+
var isMoveDisabled = expValEquals('platform_editor_table_menu_updates_patch_2', 'isEnabled', true) && !canMove;
|
|
61
|
+
if (isMoveDisabled) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
63
|
+
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
64
|
+
color: "var(--ds-text-disabled, #080F214A)",
|
|
65
|
+
label: "",
|
|
66
|
+
size: "small"
|
|
67
|
+
}),
|
|
68
|
+
elemAfter: /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
|
+
content: formatMessage(messages.canNotMoveRowUpWithMergedCells),
|
|
70
|
+
position: "top"
|
|
71
|
+
}, function (tooltipProps) {
|
|
72
|
+
return (
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
// Ignored via go/ees005
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
76
|
+
React.createElement("span", tooltipProps, /*#__PURE__*/React.createElement(InformationCircleIcon, {
|
|
77
|
+
label: "",
|
|
78
|
+
size: "small",
|
|
79
|
+
color: "var(--ds-icon, #292A2E)"
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
color: "color.text.disabled"
|
|
85
|
+
}, label));
|
|
86
|
+
}
|
|
50
87
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
51
88
|
onClick: handleClick,
|
|
52
89
|
elemBefore: /*#__PURE__*/React.createElement(TableRowMoveUpIcon, {
|
|
@@ -57,7 +94,5 @@ export var MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
57
94
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
58
95
|
shortcut: (_tooltip = tooltip(moveRowUp)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
59
96
|
})
|
|
60
|
-
},
|
|
61
|
-
0: selectedRowCount
|
|
62
|
-
}));
|
|
97
|
+
}, label);
|
|
63
98
|
};
|
|
@@ -9,6 +9,7 @@ import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-cont
|
|
|
9
9
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
10
10
|
import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
|
|
11
11
|
import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
|
|
12
|
+
import { canMove } from '../../../pm-plugins/utils/drag-menu';
|
|
12
13
|
import { TableMenuProvider } from './TableMenuContext';
|
|
13
14
|
export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
14
15
|
var api = _ref.api,
|
|
@@ -45,6 +46,10 @@ export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
46
|
return cellOps;
|
|
46
47
|
}
|
|
47
48
|
return _objectSpread(_objectSpread({}, cellOps), {}, {
|
|
49
|
+
canMoveRowUp: canMove('table-row', -1, tableMap.height, editorView.state.selection, selectionRect),
|
|
50
|
+
canMoveRowDown: canMove('table-row', 1, tableMap.height, editorView.state.selection, selectionRect),
|
|
51
|
+
canMoveColumnLeft: canMove('table-column', -1, tableMap.width, editorView.state.selection, selectionRect),
|
|
52
|
+
canMoveColumnRight: canMove('table-column', 1, tableMap.width, editorView.state.selection, selectionRect),
|
|
48
53
|
isFirstRow: selectionRect.top === 0,
|
|
49
54
|
isLastRow: selectionRect.bottom === tableMap.height,
|
|
50
55
|
selectedRowCount: selectionRect.bottom - selectionRect.top,
|
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
export type TableMenuContextValue = {
|
|
4
4
|
canMergeCells?: boolean;
|
|
5
|
+
canMoveColumnLeft?: boolean;
|
|
6
|
+
canMoveColumnRight?: boolean;
|
|
7
|
+
canMoveRowDown?: boolean;
|
|
8
|
+
canMoveRowUp?: boolean;
|
|
5
9
|
canSplitCell?: boolean;
|
|
6
10
|
editorView?: EditorView;
|
|
7
11
|
hasMergedCellsInTable?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "24.5.
|
|
3
|
+
"version": "24.5.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
|
|
54
54
|
"@atlaskit/primitives": "^22.2.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^135.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^135.11.0",
|
|
56
56
|
"@atlaskit/toggle": "^17.1.0",
|
|
57
57
|
"@atlaskit/tokens": "^16.3.0",
|
|
58
58
|
"@atlaskit/tooltip": "^24.0.0",
|