@atlaskit/editor-plugin-table 22.4.18 → 22.4.20
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/nodeviews/TableRowNativeStickyWithFallback.js +4 -4
- 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 +62 -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/cjs/ui/toolbar.js +3 -2
- 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 +57 -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/nodeviews/TableRowNativeStickyWithFallback.js +4 -4
- 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 +54 -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/esm/ui/toolbar.js +3 -2
- 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 +7 -6
- 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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.VerticalAlignDropdownItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
12
|
+
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
13
|
+
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
14
|
+
var _verticalAlignUtils = require("./verticalAlignUtils");
|
|
15
|
+
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); }
|
|
16
|
+
var VerticalAlignDropdownItem = exports.VerticalAlignDropdownItem = function VerticalAlignDropdownItem(_ref) {
|
|
17
|
+
var _useTableMenuContext;
|
|
18
|
+
var api = _ref.api,
|
|
19
|
+
Icon = _ref.icon,
|
|
20
|
+
label = _ref.label,
|
|
21
|
+
value = _ref.value;
|
|
22
|
+
var _ref2 = (_useTableMenuContext = (0, _TableMenuContext.useTableMenuContext)()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
23
|
+
editorView = _ref2.editorView;
|
|
24
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
25
|
+
formatMessage = _useIntl.formatMessage;
|
|
26
|
+
var selectedValign = (0, _react.useMemo)(function () {
|
|
27
|
+
return (0, _verticalAlignUtils.getSelectedCellValign)(editorView);
|
|
28
|
+
}, [editorView]);
|
|
29
|
+
var handleClick = (0, _react.useCallback)(function () {
|
|
30
|
+
if (!editorView || !api) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
34
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
35
|
+
api.core.actions.execute(function (_ref3) {
|
|
36
|
+
var tr = _ref3.tr;
|
|
37
|
+
(0, _commands.setMultipleCellAttrsEditorCommand)({
|
|
38
|
+
valign: value
|
|
39
|
+
}, targetCellPosition)({
|
|
40
|
+
tr: tr
|
|
41
|
+
});
|
|
42
|
+
(0, _commands.closeActiveTableMenu)()({
|
|
43
|
+
tr: tr
|
|
44
|
+
});
|
|
45
|
+
return tr;
|
|
46
|
+
});
|
|
47
|
+
api.core.actions.focus();
|
|
48
|
+
}, [api, editorView, value]);
|
|
49
|
+
if (!editorView) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
53
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(Icon, {
|
|
54
|
+
color: "currentColor",
|
|
55
|
+
label: "",
|
|
56
|
+
size: "small"
|
|
57
|
+
}),
|
|
58
|
+
isSelected: selectedValign === value,
|
|
59
|
+
onClick: handleClick,
|
|
60
|
+
role: "menuitemradio"
|
|
61
|
+
}, formatMessage(label));
|
|
62
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.VerticalAlignNestedMenu = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntl = require("react-intl");
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
13
|
+
var _alignPositionBottom = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-bottom"));
|
|
14
|
+
var _alignPositionCenterVertical = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-center-vertical"));
|
|
15
|
+
var _alignPositionTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/align-position-top"));
|
|
16
|
+
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
17
|
+
var _verticalAlignUtils = require("./verticalAlignUtils");
|
|
18
|
+
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); }
|
|
19
|
+
var getTriggerIcon = function getTriggerIcon(valign) {
|
|
20
|
+
switch (valign) {
|
|
21
|
+
case 'middle':
|
|
22
|
+
return _alignPositionCenterVertical.default;
|
|
23
|
+
case 'bottom':
|
|
24
|
+
return _alignPositionBottom.default;
|
|
25
|
+
case 'top':
|
|
26
|
+
default:
|
|
27
|
+
return _alignPositionTop.default;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var VerticalAlignNestedMenu = exports.VerticalAlignNestedMenu = function VerticalAlignNestedMenu(_ref) {
|
|
31
|
+
var _useTableMenuContext;
|
|
32
|
+
var children = _ref.children;
|
|
33
|
+
var _ref2 = (_useTableMenuContext = (0, _TableMenuContext.useTableMenuContext)()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
34
|
+
editorView = _ref2.editorView;
|
|
35
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
36
|
+
formatMessage = _useIntl.formatMessage;
|
|
37
|
+
var selectedValign = (0, _react.useMemo)(function () {
|
|
38
|
+
return (0, _verticalAlignUtils.getSelectedCellValign)(editorView);
|
|
39
|
+
}, [editorView]);
|
|
40
|
+
var TriggerIcon = getTriggerIcon(selectedValign);
|
|
41
|
+
if (!editorView) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarNestedDropdownMenu, {
|
|
45
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(TriggerIcon, {
|
|
46
|
+
color: "currentColor",
|
|
47
|
+
label: "",
|
|
48
|
+
size: "small"
|
|
49
|
+
}),
|
|
50
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_editorToolbar.NestedDropdownRightIcon, {
|
|
51
|
+
label: "",
|
|
52
|
+
size: "small"
|
|
53
|
+
}),
|
|
54
|
+
text: formatMessage(_messages.tableMessages.cellAlignment)
|
|
55
|
+
}, children);
|
|
56
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSelectedCellValign = void 0;
|
|
7
|
+
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
8
|
+
var getNormalizedValign = function getNormalizedValign(valign) {
|
|
9
|
+
return valign !== null && valign !== void 0 ? valign : 'top';
|
|
10
|
+
};
|
|
11
|
+
var getSelectedCellValign = exports.getSelectedCellValign = function getSelectedCellValign(editorView) {
|
|
12
|
+
if (!editorView) {
|
|
13
|
+
return 'top';
|
|
14
|
+
}
|
|
15
|
+
var state = editorView.state;
|
|
16
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
17
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
18
|
+
var cell = typeof targetCellPosition === 'number' ? state.doc.nodeAt(targetCellPosition) : undefined;
|
|
19
|
+
return getNormalizedValign(cell === null || cell === void 0 ? void 0 : cell.attrs.valign);
|
|
20
|
+
};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.SPLIT_CELL_ITEM = exports.MERGE_CELLS_ITEM = exports.CELL_MENU_RANK = exports.CELL_MENU = exports.CELL_DANGER_SECTION_RANK = exports.CELL_DANGER_SECTION = exports.CELL_ACTION_SECTION_RANK = exports.CELL_ACTION_SECTION = void 0;
|
|
7
|
+
exports.VERTICAL_ALIGN_TOP_ITEM = exports.VERTICAL_ALIGN_MIDDLE_ITEM = exports.VERTICAL_ALIGN_MENU_SECTION_RANK = exports.VERTICAL_ALIGN_MENU_SECTION = exports.VERTICAL_ALIGN_MENU_RANK = exports.VERTICAL_ALIGN_MENU = exports.VERTICAL_ALIGN_BOTTOM_ITEM = exports.SPLIT_CELL_ITEM = exports.MERGE_CELLS_ITEM = exports.CELL_MENU_RANK = exports.CELL_MENU = exports.CELL_DANGER_SECTION_RANK = exports.CELL_DANGER_SECTION = exports.CELL_ACTION_SECTION_RANK = exports.CELL_ACTION_SECTION = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _keys = require("../shared/keys");
|
|
10
10
|
// --- Menu surface ---
|
|
@@ -33,8 +33,30 @@ var SPLIT_CELL_ITEM = exports.SPLIT_CELL_ITEM = {
|
|
|
33
33
|
type: 'menu-item',
|
|
34
34
|
key: 'split-cell'
|
|
35
35
|
};
|
|
36
|
+
var VERTICAL_ALIGN_MENU = exports.VERTICAL_ALIGN_MENU = {
|
|
37
|
+
type: 'nested-menu',
|
|
38
|
+
key: 'vertical-align'
|
|
39
|
+
};
|
|
40
|
+
var VERTICAL_ALIGN_MENU_SECTION = exports.VERTICAL_ALIGN_MENU_SECTION = {
|
|
41
|
+
type: 'menu-section',
|
|
42
|
+
key: 'vertical-align-section'
|
|
43
|
+
};
|
|
44
|
+
var VERTICAL_ALIGN_TOP_ITEM = exports.VERTICAL_ALIGN_TOP_ITEM = {
|
|
45
|
+
type: 'menu-item',
|
|
46
|
+
key: 'vertical-align-top'
|
|
47
|
+
};
|
|
48
|
+
var VERTICAL_ALIGN_MIDDLE_ITEM = exports.VERTICAL_ALIGN_MIDDLE_ITEM = {
|
|
49
|
+
type: 'menu-item',
|
|
50
|
+
key: 'vertical-align-middle'
|
|
51
|
+
};
|
|
52
|
+
var VERTICAL_ALIGN_BOTTOM_ITEM = exports.VERTICAL_ALIGN_BOTTOM_ITEM = {
|
|
53
|
+
type: 'menu-item',
|
|
54
|
+
key: 'vertical-align-bottom'
|
|
55
|
+
};
|
|
36
56
|
|
|
37
57
|
// --- Item ranks within their sections ---
|
|
38
58
|
|
|
39
|
-
var CELL_ACTION_SECTION_RANK = exports.CELL_ACTION_SECTION_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.BACKGROUND_COLOR_ITEM.key, 100),
|
|
59
|
+
var CELL_ACTION_SECTION_RANK = exports.CELL_ACTION_SECTION_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.BACKGROUND_COLOR_ITEM.key, 100), VERTICAL_ALIGN_MENU.key, 200), MERGE_CELLS_ITEM.key, 300), SPLIT_CELL_ITEM.key, 400);
|
|
60
|
+
var VERTICAL_ALIGN_MENU_RANK = exports.VERTICAL_ALIGN_MENU_RANK = (0, _defineProperty2.default)({}, VERTICAL_ALIGN_MENU_SECTION.key, 100);
|
|
61
|
+
var VERTICAL_ALIGN_MENU_SECTION_RANK = exports.VERTICAL_ALIGN_MENU_SECTION_RANK = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, VERTICAL_ALIGN_TOP_ITEM.key, 100), VERTICAL_ALIGN_MIDDLE_ITEM.key, 200), VERTICAL_ALIGN_BOTTOM_ITEM.key, 300);
|
|
40
62
|
var CELL_DANGER_SECTION_RANK = exports.CELL_DANGER_SECTION_RANK = (0, _defineProperty2.default)({}, _keys.CLEAR_CELLS_ITEM.key, 100);
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
16
17
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
17
18
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
18
19
|
var AddColumnLeftItem = exports.AddColumnLeftItem = function AddColumnLeftItem(_ref) {
|
|
@@ -45,6 +46,8 @@ var AddColumnLeftItem = exports.AddColumnLeftItem = function AddColumnLeftItem(_
|
|
|
45
46
|
}
|
|
46
47
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
47
48
|
(0, _commandsWithAnalytics.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)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
49
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
50
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
48
51
|
};
|
|
49
52
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
50
53
|
onClick: handleClick,
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
16
17
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
17
18
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
18
19
|
var AddColumnRightItem = exports.AddColumnRightItem = function AddColumnRightItem(_ref) {
|
|
@@ -45,6 +46,8 @@ var AddColumnRightItem = exports.AddColumnRightItem = function AddColumnRightIte
|
|
|
45
46
|
}
|
|
46
47
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
47
48
|
(0, _commandsWithAnalytics.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)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
49
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
50
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
48
51
|
};
|
|
49
52
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
50
53
|
onClick: handleClick,
|
|
@@ -64,6 +64,8 @@ var DeleteColumnItem = exports.DeleteColumnItem = function DeleteColumnItem(_ref
|
|
|
64
64
|
}
|
|
65
65
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
66
66
|
(0, _commandsWithAnalytics.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)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
|
|
67
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
68
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
67
69
|
};
|
|
68
70
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
69
71
|
onClick: handleClick,
|
|
@@ -12,6 +12,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
16
17
|
var _resizeState = require("../../../../pm-plugins/table-resizing/utils/resize-state");
|
|
17
18
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
@@ -54,6 +55,8 @@ var DistributeColumnsItem = exports.DistributeColumnsItem = function DistributeC
|
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
(0, _commandsWithAnalytics.distributeColumnsWidthsWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
|
|
58
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
59
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
57
60
|
};
|
|
58
61
|
if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
|
|
59
62
|
return null;
|
|
@@ -14,6 +14,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
16
|
var _tableColumnMoveLeft = _interopRequireDefault(require("@atlaskit/icon/core/table-column-move-left"));
|
|
17
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
17
18
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
18
19
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
19
20
|
var _selection = require("../../../../pm-plugins/utils/selection");
|
|
@@ -48,6 +49,8 @@ var MoveColumnLeftItem = exports.MoveColumnLeftItem = function MoveColumnLeftIte
|
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
(0, _commandsWithAnalytics.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, (0, _pluginFactory.getPluginState)(editorView.state).getIntl)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, _consts.TABLE_COLUMN, (0, _selection.getSelectedColumnIndexes)(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
|
|
52
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
53
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
51
54
|
};
|
|
52
55
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
53
56
|
return null;
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
16
17
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
17
18
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
18
19
|
var _selection = require("../../../../pm-plugins/utils/selection");
|
|
@@ -47,6 +48,8 @@ var MoveColumnRightItem = exports.MoveColumnRightItem = function MoveColumnRight
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
(0, _commandsWithAnalytics.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, (0, _pluginFactory.getPluginState)(editorView.state).getIntl)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, _consts.TABLE_COLUMN, (0, _selection.getSelectedColumnIndexes)(selectionRect), selectionRect.right)(editorView.state, editorView.dispatch);
|
|
51
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
52
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
50
53
|
};
|
|
51
54
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
52
55
|
return null;
|
|
@@ -12,6 +12,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
16
17
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
17
18
|
var SortDecreasingItem = exports.SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
@@ -32,6 +33,8 @@ var SortDecreasingItem = exports.SortDecreasingItem = function SortDecreasingIte
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, _customSteps.TableSortOrder.DESC)(editorView.state, editorView.dispatch);
|
|
36
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
37
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
35
38
|
};
|
|
36
39
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
37
40
|
onClick: handleClick,
|
|
@@ -12,6 +12,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
16
17
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
17
18
|
var SortIncreasingItem = exports.SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
@@ -32,6 +33,8 @@ var SortIncreasingItem = exports.SortIncreasingItem = function SortIncreasingIte
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, _customSteps.TableSortOrder.ASC)(editorView.state, editorView.dispatch);
|
|
36
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
37
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
35
38
|
};
|
|
36
39
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
37
40
|
onClick: handleClick,
|
|
@@ -12,6 +12,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
16
17
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
17
18
|
var AddRowAboveItem = exports.AddRowAboveItem = function AddRowAboveItem(props) {
|
|
@@ -35,6 +36,8 @@ var AddRowAboveItem = exports.AddRowAboveItem = function AddRowAboveItem(props)
|
|
|
35
36
|
index: index,
|
|
36
37
|
moveCursorToInsertedRow: true
|
|
37
38
|
})(editorView.state, editorView.dispatch);
|
|
39
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
40
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
38
41
|
};
|
|
39
42
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
40
43
|
onClick: handleClick,
|
|
@@ -12,6 +12,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
15
16
|
var _commandsWithAnalytics = require("../../../../pm-plugins/commands/commands-with-analytics");
|
|
16
17
|
var _TableMenuContext = require("../../shared/TableMenuContext");
|
|
17
18
|
var AddRowBelowItem = exports.AddRowBelowItem = function AddRowBelowItem(props) {
|
|
@@ -35,6 +36,8 @@ var AddRowBelowItem = exports.AddRowBelowItem = function AddRowBelowItem(props)
|
|
|
35
36
|
index: index,
|
|
36
37
|
moveCursorToInsertedRow: true
|
|
37
38
|
})(editorView.state, editorView.dispatch);
|
|
39
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
40
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
38
41
|
};
|
|
39
42
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
40
43
|
onClick: handleClick,
|
|
@@ -59,6 +59,8 @@ var DeleteRowItem = exports.DeleteRowItem = function DeleteRowItem(props) {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
(0, _commandsWithAnalytics.deleteRowsWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(editorView.state, editorView.dispatch);
|
|
62
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
63
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
62
64
|
};
|
|
63
65
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
64
66
|
onClick: handleClick,
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
16
17
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
17
18
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
18
19
|
var _selection = require("../../../../pm-plugins/utils/selection");
|
|
@@ -47,6 +48,8 @@ var MoveRowDownItem = exports.MoveRowDownItem = function MoveRowDownItem(props)
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
(0, _commandsWithAnalytics.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, (0, _pluginFactory.getPluginState)(editorView.state).getIntl)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, _consts.TABLE_ROW, (0, _selection.getSelectedRowIndexes)(selectionRect), selectionRect.bottom)(editorView.state, editorView.dispatch);
|
|
51
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
52
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
50
53
|
};
|
|
51
54
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
52
55
|
return null;
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
16
|
+
var _commands = require("../../../../pm-plugins/commands");
|
|
16
17
|
var _commandsWithAnalytics = require("../../../../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
17
18
|
var _pluginFactory = require("../../../../pm-plugins/plugin-factory");
|
|
18
19
|
var _selection = require("../../../../pm-plugins/utils/selection");
|
|
@@ -47,6 +48,8 @@ var MoveRowUpItem = exports.MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
(0, _commandsWithAnalytics.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, (0, _pluginFactory.getPluginState)(editorView.state).getIntl)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, _consts.TABLE_ROW, (0, _selection.getSelectedRowIndexes)(selectionRect), selectionRect.top - 1)(editorView.state, editorView.dispatch);
|
|
51
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
52
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
50
53
|
};
|
|
51
54
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
52
55
|
return null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* TableMenu.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
1
|
"use strict";
|
|
3
2
|
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -7,24 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.TableMenu = void 0;
|
|
10
|
-
require("./TableMenu.compiled.css");
|
|
11
|
-
var _runtime = require("@compiled/react/runtime");
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
12
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
16
13
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
|
+
var _toolbarMenuContainer = require("@atlaskit/editor-toolbar/toolbar-menu-container");
|
|
17
15
|
var _editorUiControlModel = require("@atlaskit/editor-ui-control-model");
|
|
18
|
-
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
16
|
var _splitCell = require("../../../pm-plugins/commands/split-cell");
|
|
20
17
|
var _merge = require("../../../pm-plugins/transforms/merge");
|
|
21
18
|
var _TableMenuContext = require("./TableMenuContext");
|
|
22
19
|
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); }
|
|
23
20
|
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; }
|
|
24
21
|
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) { (0, _defineProperty2.default)(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; }
|
|
25
|
-
var tableMenuContainerStyles = {
|
|
26
|
-
container: "_2rko1qi0 _1bsb1178 _16qs130s _bfhk1bhr"
|
|
27
|
-
};
|
|
28
22
|
var TableMenu = exports.TableMenu = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
29
23
|
var api = _ref.api,
|
|
30
24
|
editorView = _ref.editorView,
|
|
@@ -73,10 +67,7 @@ var TableMenu = exports.TableMenu = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
73
67
|
}
|
|
74
68
|
return /*#__PURE__*/_react.default.createElement(_TableMenuContext.TableMenuProvider, {
|
|
75
69
|
value: tableMenuContext
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
77
|
-
xcss: tableMenuContainerStyles.container,
|
|
78
|
-
testId: surface.key
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement(_editorUiControlModel.SurfaceRenderer, {
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement(_toolbarMenuContainer.ToolbarMenuContainer, null, /*#__PURE__*/_react.default.createElement(_editorUiControlModel.SurfaceRenderer, {
|
|
80
71
|
surface: surface,
|
|
81
72
|
components: components
|
|
82
73
|
})));
|
|
@@ -28,7 +28,7 @@ var colorPaletteStyles = {
|
|
|
28
28
|
colorPreview: "_2rko12b0 _1h6d1l7x _1dqonqa1 _189ee4h9 _1bsbdlk8 _4t3idlk8 _1o9zidpf"
|
|
29
29
|
};
|
|
30
30
|
var BackgroundColorItem = exports.BackgroundColorItem = function BackgroundColorItem(_ref) {
|
|
31
|
-
var _useTableMenuContext
|
|
31
|
+
var _useTableMenuContext;
|
|
32
32
|
var api = _ref.api;
|
|
33
33
|
var _ref2 = (_useTableMenuContext = (0, _TableMenuContext.useTableMenuContext)()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {},
|
|
34
34
|
editorView = _ref2.editorView;
|
|
@@ -50,8 +50,9 @@ var BackgroundColorItem = exports.BackgroundColorItem = function BackgroundColor
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
(0, _commandsWithAnalytics.setColorWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, color, editorView)(editorView.state, editorView.dispatch);
|
|
53
|
-
(0, _commands.closeActiveTableMenu)()
|
|
54
|
-
|
|
53
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
54
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
55
|
+
}, [api, editorView]);
|
|
55
56
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
56
57
|
var colorPreviewStyle = (0, _react.useMemo)(function () {
|
|
57
58
|
return {
|
|
@@ -32,7 +32,8 @@ var ClearCellsItem = exports.ClearCellsItem = function ClearCellsItem(_ref) {
|
|
|
32
32
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
33
33
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
34
34
|
(0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(editorView.state, editorView.dispatch);
|
|
35
|
-
(0, _commands.closeActiveTableMenu)()
|
|
35
|
+
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)());
|
|
36
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
36
37
|
};
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
38
39
|
onClick: handleClick,
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -55,6 +55,7 @@ var _isContentModeSupported = require("../pm-plugins/utils/tableMode/is-content-
|
|
|
55
55
|
var _types = require("../types");
|
|
56
56
|
var _FloatingAlignmentButtons = require("./FloatingAlignmentButtons/FloatingAlignmentButtons");
|
|
57
57
|
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); }
|
|
58
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
58
59
|
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; }
|
|
59
60
|
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) { (0, _defineProperty2.default)(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; } /**
|
|
60
61
|
* @jsxRuntime classic
|
|
@@ -873,10 +874,10 @@ var isLayoutOptionDisabledImpl = function isLayoutOptionDisabledImpl(selectedNod
|
|
|
873
874
|
var getMemoizedIsLayoutOptionDisabled = (0, _memoizeOne.default)(isLayoutOptionDisabledImpl, function (_ref6, _ref7) {
|
|
874
875
|
var _ref8 = (0, _toArray2.default)(_ref6),
|
|
875
876
|
prevNode = _ref8[0],
|
|
876
|
-
prevRest = _ref8.slice(1);
|
|
877
|
+
prevRest = _arrayLikeToArray(_ref8).slice(1);
|
|
877
878
|
var _ref9 = (0, _toArray2.default)(_ref7),
|
|
878
879
|
nextNode = _ref9[0],
|
|
879
|
-
nextRest = _ref9.slice(1);
|
|
880
|
+
nextRest = _arrayLikeToArray(_ref9).slice(1);
|
|
880
881
|
// Only node needs special comparison (attrs only), rest use reference equality
|
|
881
882
|
var nodeEqual = (0, _isEqual.default)(prevNode.attrs, nextNode.attrs);
|
|
882
883
|
var restEqual = prevRest.every(function (val, idx) {
|
|
@@ -27,6 +27,13 @@ function delayUntilIdle(cb) {
|
|
|
27
27
|
// Ignored via go/ees005
|
|
28
28
|
// eslint-disable-next-line require-unicode-regexp
|
|
29
29
|
const cssVariablePattern = /^VAR\(--.*\)$/;
|
|
30
|
+
const getCellDomAttrsForTableMenuUpdates = node => {
|
|
31
|
+
const attrs = getCellDomAttrs(node);
|
|
32
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && node.attrs.valign) {
|
|
33
|
+
attrs['data-valign'] = node.attrs.valign;
|
|
34
|
+
}
|
|
35
|
+
return attrs;
|
|
36
|
+
};
|
|
30
37
|
export default class TableCell extends TableNodeView {
|
|
31
38
|
constructor(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
32
39
|
super(node, view, getPos, eventDispatcher);
|
|
@@ -147,8 +154,8 @@ export default class TableCell extends TableNodeView {
|
|
|
147
154
|
if (this.node.type !== node.type) {
|
|
148
155
|
return false;
|
|
149
156
|
}
|
|
150
|
-
const attrs =
|
|
151
|
-
const nextAttrs =
|
|
157
|
+
const attrs = getCellDomAttrsForTableMenuUpdates(this.node);
|
|
158
|
+
const nextAttrs = getCellDomAttrsForTableMenuUpdates(node);
|
|
152
159
|
const {
|
|
153
160
|
colspan,
|
|
154
161
|
rowspan
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const closeActiveTableMenu = () =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!activeTableMenu || activeTableMenu.type === 'none') {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
1
|
+
import { pluginKey } from '../plugin-key';
|
|
2
|
+
export const closeActiveTableMenu = () => ({
|
|
3
|
+
tr
|
|
4
|
+
}) => {
|
|
5
|
+
tr.setMeta(pluginKey, {
|
|
10
6
|
type: 'SET_ACTIVE_TABLE_MENU',
|
|
11
7
|
data: {
|
|
12
8
|
activeTableMenu: {
|
|
13
9
|
type: 'none'
|
|
14
10
|
}
|
|
15
11
|
}
|
|
16
|
-
};
|
|
17
|
-
|
|
12
|
+
});
|
|
13
|
+
if (!tr.docChanged) {
|
|
14
|
+
tr.setMeta('addToHistory', false);
|
|
15
|
+
}
|
|
16
|
+
return tr;
|
|
17
|
+
};
|
|
18
18
|
const isSameActiveTableMenu = (current, next) => {
|
|
19
19
|
if (!current || current.type !== next.type) {
|
|
20
20
|
return false;
|
|
@@ -24,16 +24,17 @@ const isSameActiveTableMenu = (current, next) => {
|
|
|
24
24
|
}
|
|
25
25
|
return true;
|
|
26
26
|
};
|
|
27
|
-
export const toggleActiveTableMenu = activeTableMenu =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return {
|
|
27
|
+
export const toggleActiveTableMenu = (activeTableMenu, currentActiveTableMenu) => ({
|
|
28
|
+
tr
|
|
29
|
+
}) => {
|
|
30
|
+
tr.setMeta(pluginKey, {
|
|
32
31
|
type: 'SET_ACTIVE_TABLE_MENU',
|
|
33
32
|
data: {
|
|
34
33
|
activeTableMenu: isSameActiveTableMenu(currentActiveTableMenu, activeTableMenu) ? {
|
|
35
34
|
type: 'none'
|
|
36
35
|
} : activeTableMenu
|
|
37
36
|
}
|
|
38
|
-
};
|
|
39
|
-
|
|
37
|
+
});
|
|
38
|
+
tr.setMeta('addToHistory', false);
|
|
39
|
+
return tr;
|
|
40
|
+
};
|
|
@@ -42,11 +42,19 @@ export const toggleActiveTableMenuWithAnalytics = editorAnalyticsAPI => (directi
|
|
|
42
42
|
};
|
|
43
43
|
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
44
44
|
if (dispatch) {
|
|
45
|
-
|
|
45
|
+
const {
|
|
46
|
+
activeTableMenu: currentActiveTableMenu
|
|
47
|
+
} = getPluginState(state);
|
|
48
|
+
const newTr = toggleActiveTableMenu({
|
|
46
49
|
type: direction,
|
|
47
50
|
index,
|
|
48
51
|
openedBy: trigger
|
|
49
|
-
}
|
|
52
|
+
}, currentActiveTableMenu)({
|
|
53
|
+
tr: state.tr
|
|
54
|
+
});
|
|
55
|
+
if (newTr) {
|
|
56
|
+
dispatch(newTr);
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
return true;
|
|
52
60
|
});
|
|
@@ -6,7 +6,7 @@ export { insertColumn, insertRow, createTable } from './insert';
|
|
|
6
6
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
7
7
|
export { closeActiveTableMenu, toggleActiveTableMenu } from './active-table-menu';
|
|
8
8
|
export { clearMultipleCells } from './clear';
|
|
9
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu } from './misc';
|
|
9
|
+
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';
|
|
10
10
|
export { sortByColumn } from './sort';
|
|
11
11
|
export { goToNextCell } from './go-to-next-cell';
|
|
12
12
|
export { removeDescendantNodes } from './referentiality';
|