@atlaskit/editor-plugin-block-menu 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 0.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bfd653291c561`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bfd653291c561) -
8
+ [ux] ED-29018 Register taskList dropdown item and add menu item keys
9
+ - Updated dependencies
10
+
11
+ ## 0.0.18
12
+
13
+ ### Patch Changes
14
+
15
+ - [`942b7b9e97c21`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/942b7b9e97c21) -
16
+ Support nested block menu via selection extension config
17
+ - Updated dependencies
18
+
3
19
  ## 0.0.17
4
20
 
5
21
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getBlockMenuComponents = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ var _blockMenu = require("@atlaskit/editor-common/block-menu");
10
11
  var _editorToolbar = require("@atlaskit/editor-toolbar");
11
12
  var _changes = _interopRequireDefault(require("@atlaskit/icon/core/changes"));
12
13
  var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
@@ -19,11 +20,11 @@ var _moveUp = require("./move-up");
19
20
  var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
20
21
  return [{
21
22
  type: 'block-menu-item',
22
- key: 'block-menu-item-move-up',
23
+ key: _blockMenu.MOVE_UP_MENU_ITEM.key,
23
24
  parent: {
24
25
  type: 'block-menu-section',
25
- key: 'block-menu-section-move-up-down',
26
- rank: 100
26
+ key: _blockMenu.MOVE_UP_DOWN_MENU_SECTION.key,
27
+ rank: _blockMenu.MOVE_BLOCK_SECTION_RANK[_blockMenu.MOVE_UP_MENU_ITEM.key]
27
28
  },
28
29
  component: function component() {
29
30
  return /*#__PURE__*/_react.default.createElement(_moveUp.MoveUpDropdownItem, {
@@ -32,11 +33,11 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
32
33
  }
33
34
  }, {
34
35
  type: 'block-menu-item',
35
- key: 'block-menu-item-move-down',
36
+ key: _blockMenu.MOVE_DOWN_MENU_ITEM.key,
36
37
  parent: {
37
38
  type: 'block-menu-section',
38
- key: 'block-menu-section-move-up-down',
39
- rank: 200
39
+ key: _blockMenu.MOVE_UP_DOWN_MENU_SECTION.key,
40
+ rank: _blockMenu.MOVE_BLOCK_SECTION_RANK[_blockMenu.MOVE_DOWN_MENU_ITEM.key]
40
41
  },
41
42
  component: function component() {
42
43
  return /*#__PURE__*/_react.default.createElement(_moveDown.MoveDownDropdownItem, {
@@ -48,10 +49,10 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
48
49
  var getFormatMenuComponents = function getFormatMenuComponents() {
49
50
  return [{
50
51
  type: 'block-menu-nested',
51
- key: 'nested-menu-format',
52
+ key: _blockMenu.NESTED_FORMAT_MENU.key,
52
53
  parent: {
53
54
  type: 'block-menu-section',
54
- key: 'block-menu-section-primary',
55
+ key: _blockMenu.PRIMARY_MENU_SECTION.key,
55
56
  rank: 100
56
57
  },
57
58
  component: function component() {
@@ -71,10 +72,10 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
71
72
  }
72
73
  }, {
73
74
  type: 'block-menu-section',
74
- key: 'nested-menu-format-section-primary',
75
+ key: _blockMenu.NESTED_FORMAT_MENU_SECTION.key,
75
76
  parent: {
76
77
  type: 'block-menu-nested',
77
- key: 'nested-menu-format',
78
+ key: _blockMenu.NESTED_FORMAT_MENU.key,
78
79
  rank: 100
79
80
  },
80
81
  component: function component() {
@@ -86,7 +87,7 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
86
87
  }
87
88
  }, {
88
89
  type: 'block-menu-section',
89
- key: 'block-menu-section-primary',
90
+ key: _blockMenu.PRIMARY_MENU_SECTION.key,
90
91
  rank: 100,
91
92
  component: function component(_ref3) {
92
93
  var children = _ref3.children;
@@ -99,8 +100,8 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
99
100
  config = _ref4.config;
100
101
  return [].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
101
102
  type: 'block-menu-section',
102
- key: 'block-menu-section-copy',
103
- rank: 200,
103
+ key: _blockMenu.COPY_MENU_SECTION.key,
104
+ rank: _blockMenu.BLOCK_MENU_SECTION_RANK[_blockMenu.COPY_MENU_SECTION.key],
104
105
  component: function component(_ref5) {
105
106
  var children = _ref5.children;
106
107
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
@@ -109,11 +110,11 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
109
110
  }
110
111
  }, {
111
112
  type: 'block-menu-item',
112
- key: 'block-menu-copy-block',
113
+ key: _blockMenu.COPY_BLOCK_MENU_ITEM.key,
113
114
  parent: {
114
115
  type: 'block-menu-section',
115
- key: 'block-menu-section-copy',
116
- rank: 200
116
+ key: _blockMenu.COPY_MENU_SECTION.key,
117
+ rank: _blockMenu.COPY_MENU_SECTION_RANK[_blockMenu.COPY_BLOCK_MENU_ITEM.key]
117
118
  },
118
119
  component: function component() {
119
120
  return /*#__PURE__*/_react.default.createElement(_copyBlock.default, {
@@ -122,11 +123,11 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
122
123
  }
123
124
  }, {
124
125
  type: 'block-menu-item',
125
- key: 'block-menu-item-copy-link',
126
+ key: _blockMenu.COPY_LINK_MENU_ITEM.key,
126
127
  parent: {
127
128
  type: 'block-menu-section',
128
- key: 'block-menu-section-copy',
129
- rank: 100
129
+ key: _blockMenu.COPY_MENU_SECTION.key,
130
+ rank: _blockMenu.COPY_MENU_SECTION_RANK[_blockMenu.COPY_LINK_MENU_ITEM.key]
130
131
  },
131
132
  component: function component() {
132
133
  return /*#__PURE__*/_react.default.createElement(_copyLink.CopyLinkDropdownItem, {
@@ -136,8 +137,8 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
136
137
  }
137
138
  }, {
138
139
  type: 'block-menu-section',
139
- key: 'block-menu-section-move-up-down',
140
- rank: 300,
140
+ key: _blockMenu.MOVE_UP_DOWN_MENU_SECTION.key,
141
+ rank: _blockMenu.BLOCK_MENU_SECTION_RANK[_blockMenu.MOVE_UP_DOWN_MENU_SECTION.key],
141
142
  component: function component(_ref6) {
142
143
  var children = _ref6.children;
143
144
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
@@ -146,8 +147,8 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
146
147
  }
147
148
  }, {
148
149
  type: 'block-menu-section',
149
- key: 'block-menu-section-delete',
150
- rank: 400,
150
+ key: _blockMenu.DELETE_MENU_SECTION.key,
151
+ rank: _blockMenu.BLOCK_MENU_SECTION_RANK[_blockMenu.DELETE_MENU_SECTION.key],
151
152
  component: function component(_ref7) {
152
153
  var children = _ref7.children;
153
154
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
@@ -156,11 +157,11 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
156
157
  }
157
158
  }], (0, _toConsumableArray2.default)(getMoveUpMoveDownMenuComponents(api)), [{
158
159
  type: 'block-menu-item',
159
- key: 'block-menu-item-delete',
160
+ key: _blockMenu.DELETE_MENU_ITEM.key,
160
161
  parent: {
161
162
  type: 'block-menu-section',
162
- key: 'block-menu-section-delete',
163
- rank: 50
163
+ key: _blockMenu.DELETE_MENU_SECTION.key,
164
+ rank: _blockMenu.DELETE_SECTION_RANK[_blockMenu.DELETE_MENU_ITEM.key]
164
165
  },
165
166
  component: function component() {
166
167
  return /*#__PURE__*/_react.default.createElement(_deleteButton.DeleteDropdownItem, {
@@ -52,6 +52,9 @@ var BlockMenuRenderer = exports.BlockMenuRenderer = function BlockMenuRenderer(_
52
52
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, menuSections.map(function (section) {
53
53
  // Get all items for the current section, including nested menus, and sort them by rank
54
54
  var currentSectionItemsSorted = getSortedChildren([].concat((0, _toConsumableArray2.default)(menuItems), (0, _toConsumableArray2.default)(nestedMenus)), section.key);
55
+ if (currentSectionItemsSorted.length === 0) {
56
+ return null;
57
+ }
55
58
 
56
59
  // iterate over the current section items, if it is nested menu, get their children, sort them
57
60
  // if they are menu items, just render as they are sorted above
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { MOVE_UP_MENU_ITEM, MOVE_UP_DOWN_MENU_SECTION, MOVE_DOWN_MENU_ITEM, MOVE_BLOCK_SECTION_RANK, PRIMARY_MENU_SECTION, BLOCK_MENU_SECTION_RANK, COPY_MENU_SECTION, COPY_BLOCK_MENU_ITEM, COPY_MENU_SECTION_RANK, COPY_LINK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, DELETE_SECTION_RANK, NESTED_FORMAT_MENU_SECTION, NESTED_FORMAT_MENU } from '@atlaskit/editor-common/block-menu';
2
3
  import { ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
3
4
  import ChangesIcon from '@atlaskit/icon/core/changes';
4
5
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
@@ -11,22 +12,22 @@ import { MoveUpDropdownItem } from './move-up';
11
12
  const getMoveUpMoveDownMenuComponents = api => {
12
13
  return [{
13
14
  type: 'block-menu-item',
14
- key: 'block-menu-item-move-up',
15
+ key: MOVE_UP_MENU_ITEM.key,
15
16
  parent: {
16
17
  type: 'block-menu-section',
17
- key: 'block-menu-section-move-up-down',
18
- rank: 100
18
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
19
+ rank: MOVE_BLOCK_SECTION_RANK[MOVE_UP_MENU_ITEM.key]
19
20
  },
20
21
  component: () => /*#__PURE__*/React.createElement(MoveUpDropdownItem, {
21
22
  api: api
22
23
  })
23
24
  }, {
24
25
  type: 'block-menu-item',
25
- key: 'block-menu-item-move-down',
26
+ key: MOVE_DOWN_MENU_ITEM.key,
26
27
  parent: {
27
28
  type: 'block-menu-section',
28
- key: 'block-menu-section-move-up-down',
29
- rank: 200
29
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
30
+ rank: MOVE_BLOCK_SECTION_RANK[MOVE_DOWN_MENU_ITEM.key]
30
31
  },
31
32
  component: () => /*#__PURE__*/React.createElement(MoveDownDropdownItem, {
32
33
  api: api
@@ -36,10 +37,10 @@ const getMoveUpMoveDownMenuComponents = api => {
36
37
  const getFormatMenuComponents = () => {
37
38
  return [{
38
39
  type: 'block-menu-nested',
39
- key: 'nested-menu-format',
40
+ key: NESTED_FORMAT_MENU.key,
40
41
  parent: {
41
42
  type: 'block-menu-section',
42
- key: 'block-menu-section-primary',
43
+ key: PRIMARY_MENU_SECTION.key,
43
44
  rank: 100
44
45
  },
45
46
  component: ({
@@ -59,10 +60,10 @@ const getFormatMenuComponents = () => {
59
60
  }
60
61
  }, {
61
62
  type: 'block-menu-section',
62
- key: 'nested-menu-format-section-primary',
63
+ key: NESTED_FORMAT_MENU_SECTION.key,
63
64
  parent: {
64
65
  type: 'block-menu-nested',
65
- key: 'nested-menu-format',
66
+ key: NESTED_FORMAT_MENU.key,
66
67
  rank: 100
67
68
  },
68
69
  component: ({
@@ -74,7 +75,7 @@ const getFormatMenuComponents = () => {
74
75
  }
75
76
  }, {
76
77
  type: 'block-menu-section',
77
- key: 'block-menu-section-primary',
78
+ key: PRIMARY_MENU_SECTION.key,
78
79
  rank: 100,
79
80
  component: ({
80
81
  children
@@ -89,8 +90,8 @@ export const getBlockMenuComponents = ({
89
90
  }) => {
90
91
  return [...(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), {
91
92
  type: 'block-menu-section',
92
- key: 'block-menu-section-copy',
93
- rank: 200,
93
+ key: COPY_MENU_SECTION.key,
94
+ rank: BLOCK_MENU_SECTION_RANK[COPY_MENU_SECTION.key],
94
95
  component: ({
95
96
  children
96
97
  }) => {
@@ -100,11 +101,11 @@ export const getBlockMenuComponents = ({
100
101
  }
101
102
  }, {
102
103
  type: 'block-menu-item',
103
- key: 'block-menu-copy-block',
104
+ key: COPY_BLOCK_MENU_ITEM.key,
104
105
  parent: {
105
106
  type: 'block-menu-section',
106
- key: 'block-menu-section-copy',
107
- rank: 200
107
+ key: COPY_MENU_SECTION.key,
108
+ rank: COPY_MENU_SECTION_RANK[COPY_BLOCK_MENU_ITEM.key]
108
109
  },
109
110
  component: () => {
110
111
  return /*#__PURE__*/React.createElement(CopyBlockMenuItem, {
@@ -113,11 +114,11 @@ export const getBlockMenuComponents = ({
113
114
  }
114
115
  }, {
115
116
  type: 'block-menu-item',
116
- key: 'block-menu-item-copy-link',
117
+ key: COPY_LINK_MENU_ITEM.key,
117
118
  parent: {
118
119
  type: 'block-menu-section',
119
- key: 'block-menu-section-copy',
120
- rank: 100
120
+ key: COPY_MENU_SECTION.key,
121
+ rank: COPY_MENU_SECTION_RANK[COPY_LINK_MENU_ITEM.key]
121
122
  },
122
123
  component: () => /*#__PURE__*/React.createElement(CopyLinkDropdownItem, {
123
124
  api: api,
@@ -125,8 +126,8 @@ export const getBlockMenuComponents = ({
125
126
  })
126
127
  }, {
127
128
  type: 'block-menu-section',
128
- key: 'block-menu-section-move-up-down',
129
- rank: 300,
129
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
130
+ rank: BLOCK_MENU_SECTION_RANK[MOVE_UP_DOWN_MENU_SECTION.key],
130
131
  component: ({
131
132
  children
132
133
  }) => {
@@ -136,8 +137,8 @@ export const getBlockMenuComponents = ({
136
137
  }
137
138
  }, {
138
139
  type: 'block-menu-section',
139
- key: 'block-menu-section-delete',
140
- rank: 400,
140
+ key: DELETE_MENU_SECTION.key,
141
+ rank: BLOCK_MENU_SECTION_RANK[DELETE_MENU_SECTION.key],
141
142
  component: ({
142
143
  children
143
144
  }) => {
@@ -147,11 +148,11 @@ export const getBlockMenuComponents = ({
147
148
  }
148
149
  }, ...getMoveUpMoveDownMenuComponents(api), {
149
150
  type: 'block-menu-item',
150
- key: 'block-menu-item-delete',
151
+ key: DELETE_MENU_ITEM.key,
151
152
  parent: {
152
153
  type: 'block-menu-section',
153
- key: 'block-menu-section-delete',
154
- rank: 50
154
+ key: DELETE_MENU_SECTION.key,
155
+ rank: DELETE_SECTION_RANK[DELETE_MENU_ITEM.key]
155
156
  },
156
157
  component: () => /*#__PURE__*/React.createElement(DeleteDropdownItem, {
157
158
  api: api
@@ -31,6 +31,9 @@ export const BlockMenuRenderer = ({
31
31
  return /*#__PURE__*/React.createElement(Fragment, null, menuSections.map(section => {
32
32
  // Get all items for the current section, including nested menus, and sort them by rank
33
33
  const currentSectionItemsSorted = getSortedChildren([...menuItems, ...nestedMenus], section.key);
34
+ if (currentSectionItemsSorted.length === 0) {
35
+ return null;
36
+ }
34
37
 
35
38
  // iterate over the current section items, if it is nested menu, get their children, sort them
36
39
  // if they are menu items, just render as they are sorted above
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import React from 'react';
3
+ import { MOVE_UP_MENU_ITEM, MOVE_UP_DOWN_MENU_SECTION, MOVE_DOWN_MENU_ITEM, MOVE_BLOCK_SECTION_RANK, PRIMARY_MENU_SECTION, BLOCK_MENU_SECTION_RANK, COPY_MENU_SECTION, COPY_BLOCK_MENU_ITEM, COPY_MENU_SECTION_RANK, COPY_LINK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, DELETE_SECTION_RANK, NESTED_FORMAT_MENU_SECTION, NESTED_FORMAT_MENU } from '@atlaskit/editor-common/block-menu';
3
4
  import { ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
4
5
  import ChangesIcon from '@atlaskit/icon/core/changes';
5
6
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
@@ -12,11 +13,11 @@ import { MoveUpDropdownItem } from './move-up';
12
13
  var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
13
14
  return [{
14
15
  type: 'block-menu-item',
15
- key: 'block-menu-item-move-up',
16
+ key: MOVE_UP_MENU_ITEM.key,
16
17
  parent: {
17
18
  type: 'block-menu-section',
18
- key: 'block-menu-section-move-up-down',
19
- rank: 100
19
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
20
+ rank: MOVE_BLOCK_SECTION_RANK[MOVE_UP_MENU_ITEM.key]
20
21
  },
21
22
  component: function component() {
22
23
  return /*#__PURE__*/React.createElement(MoveUpDropdownItem, {
@@ -25,11 +26,11 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
25
26
  }
26
27
  }, {
27
28
  type: 'block-menu-item',
28
- key: 'block-menu-item-move-down',
29
+ key: MOVE_DOWN_MENU_ITEM.key,
29
30
  parent: {
30
31
  type: 'block-menu-section',
31
- key: 'block-menu-section-move-up-down',
32
- rank: 200
32
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
33
+ rank: MOVE_BLOCK_SECTION_RANK[MOVE_DOWN_MENU_ITEM.key]
33
34
  },
34
35
  component: function component() {
35
36
  return /*#__PURE__*/React.createElement(MoveDownDropdownItem, {
@@ -41,10 +42,10 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
41
42
  var getFormatMenuComponents = function getFormatMenuComponents() {
42
43
  return [{
43
44
  type: 'block-menu-nested',
44
- key: 'nested-menu-format',
45
+ key: NESTED_FORMAT_MENU.key,
45
46
  parent: {
46
47
  type: 'block-menu-section',
47
- key: 'block-menu-section-primary',
48
+ key: PRIMARY_MENU_SECTION.key,
48
49
  rank: 100
49
50
  },
50
51
  component: function component() {
@@ -64,10 +65,10 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
64
65
  }
65
66
  }, {
66
67
  type: 'block-menu-section',
67
- key: 'nested-menu-format-section-primary',
68
+ key: NESTED_FORMAT_MENU_SECTION.key,
68
69
  parent: {
69
70
  type: 'block-menu-nested',
70
- key: 'nested-menu-format',
71
+ key: NESTED_FORMAT_MENU.key,
71
72
  rank: 100
72
73
  },
73
74
  component: function component() {
@@ -79,7 +80,7 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
79
80
  }
80
81
  }, {
81
82
  type: 'block-menu-section',
82
- key: 'block-menu-section-primary',
83
+ key: PRIMARY_MENU_SECTION.key,
83
84
  rank: 100,
84
85
  component: function component(_ref3) {
85
86
  var children = _ref3.children;
@@ -92,8 +93,8 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
92
93
  config = _ref4.config;
93
94
  return [].concat(_toConsumableArray(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
94
95
  type: 'block-menu-section',
95
- key: 'block-menu-section-copy',
96
- rank: 200,
96
+ key: COPY_MENU_SECTION.key,
97
+ rank: BLOCK_MENU_SECTION_RANK[COPY_MENU_SECTION.key],
97
98
  component: function component(_ref5) {
98
99
  var children = _ref5.children;
99
100
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
@@ -102,11 +103,11 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
102
103
  }
103
104
  }, {
104
105
  type: 'block-menu-item',
105
- key: 'block-menu-copy-block',
106
+ key: COPY_BLOCK_MENU_ITEM.key,
106
107
  parent: {
107
108
  type: 'block-menu-section',
108
- key: 'block-menu-section-copy',
109
- rank: 200
109
+ key: COPY_MENU_SECTION.key,
110
+ rank: COPY_MENU_SECTION_RANK[COPY_BLOCK_MENU_ITEM.key]
110
111
  },
111
112
  component: function component() {
112
113
  return /*#__PURE__*/React.createElement(CopyBlockMenuItem, {
@@ -115,11 +116,11 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
115
116
  }
116
117
  }, {
117
118
  type: 'block-menu-item',
118
- key: 'block-menu-item-copy-link',
119
+ key: COPY_LINK_MENU_ITEM.key,
119
120
  parent: {
120
121
  type: 'block-menu-section',
121
- key: 'block-menu-section-copy',
122
- rank: 100
122
+ key: COPY_MENU_SECTION.key,
123
+ rank: COPY_MENU_SECTION_RANK[COPY_LINK_MENU_ITEM.key]
123
124
  },
124
125
  component: function component() {
125
126
  return /*#__PURE__*/React.createElement(CopyLinkDropdownItem, {
@@ -129,8 +130,8 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
129
130
  }
130
131
  }, {
131
132
  type: 'block-menu-section',
132
- key: 'block-menu-section-move-up-down',
133
- rank: 300,
133
+ key: MOVE_UP_DOWN_MENU_SECTION.key,
134
+ rank: BLOCK_MENU_SECTION_RANK[MOVE_UP_DOWN_MENU_SECTION.key],
134
135
  component: function component(_ref6) {
135
136
  var children = _ref6.children;
136
137
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
@@ -139,8 +140,8 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
139
140
  }
140
141
  }, {
141
142
  type: 'block-menu-section',
142
- key: 'block-menu-section-delete',
143
- rank: 400,
143
+ key: DELETE_MENU_SECTION.key,
144
+ rank: BLOCK_MENU_SECTION_RANK[DELETE_MENU_SECTION.key],
144
145
  component: function component(_ref7) {
145
146
  var children = _ref7.children;
146
147
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
@@ -149,11 +150,11 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
149
150
  }
150
151
  }], _toConsumableArray(getMoveUpMoveDownMenuComponents(api)), [{
151
152
  type: 'block-menu-item',
152
- key: 'block-menu-item-delete',
153
+ key: DELETE_MENU_ITEM.key,
153
154
  parent: {
154
155
  type: 'block-menu-section',
155
- key: 'block-menu-section-delete',
156
- rank: 50
156
+ key: DELETE_MENU_SECTION.key,
157
+ rank: DELETE_SECTION_RANK[DELETE_MENU_ITEM.key]
157
158
  },
158
159
  component: function component() {
159
160
  return /*#__PURE__*/React.createElement(DeleteDropdownItem, {
@@ -43,6 +43,9 @@ export var BlockMenuRenderer = function BlockMenuRenderer(_ref) {
43
43
  return /*#__PURE__*/React.createElement(Fragment, null, menuSections.map(function (section) {
44
44
  // Get all items for the current section, including nested menus, and sort them by rank
45
45
  var currentSectionItemsSorted = getSortedChildren([].concat(_toConsumableArray(menuItems), _toConsumableArray(nestedMenus)), section.key);
46
+ if (currentSectionItemsSorted.length === 0) {
47
+ return null;
48
+ }
46
49
 
47
50
  // iterate over the current section items, if it is nested menu, get their children, sort them
48
51
  // if they are menu items, just render as they are sorted above
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -46,7 +46,7 @@
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^107.34.0",
49
+ "@atlaskit/editor-common": "^107.35.0",
50
50
  "react": "^18.2.0",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1"
52
52
  },