@atlaskit/editor-plugin-block-menu 5.0.18 → 5.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 +7 -0
- package/dist/cjs/ui/block-menu-components.js +58 -64
- package/dist/cjs/ui/copy-link.js +6 -4
- package/dist/cjs/ui/copy-section.js +0 -6
- package/dist/es2019/ui/block-menu-components.js +50 -55
- package/dist/es2019/ui/copy-link.js +6 -4
- package/dist/es2019/ui/copy-section.js +0 -6
- package/dist/esm/ui/block-menu-components.js +59 -65
- package/dist/esm/ui/copy-link.js +6 -4
- package/dist/esm/ui/copy-section.js +0 -6
- package/dist/types/ui/copy-section.d.ts +1 -1
- package/dist/types-ts4.5/ui/copy-section.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 5.0.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`56c0427b2ab20`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/56c0427b2ab20) -
|
|
8
|
+
[ux] Use new IA for block menu items.
|
|
9
|
+
|
|
3
10
|
## 5.0.18
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -9,8 +9,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
11
11
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
|
-
var _copyBlock = _interopRequireDefault(require("./copy-block"));
|
|
14
12
|
var _copyLink = require("./copy-link");
|
|
15
13
|
var _copySection = require("./copy-section");
|
|
16
14
|
var _deleteButton = require("./delete-button");
|
|
@@ -22,11 +20,11 @@ var _moveUp = require("./move-up");
|
|
|
22
20
|
var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
|
|
23
21
|
return [{
|
|
24
22
|
type: 'block-menu-item',
|
|
25
|
-
key: _blockMenu.
|
|
23
|
+
key: _blockMenu.POSITION_MOVE_UP_MENU_ITEM.key,
|
|
26
24
|
parent: {
|
|
27
25
|
type: 'block-menu-section',
|
|
28
|
-
key: _blockMenu.
|
|
29
|
-
rank: _blockMenu.
|
|
26
|
+
key: _blockMenu.POSITION_MENU_SECTION.key,
|
|
27
|
+
rank: _blockMenu.POSITION_MENU_SECTION_RANK[_blockMenu.POSITION_MOVE_UP_MENU_ITEM.key]
|
|
30
28
|
},
|
|
31
29
|
component: function component() {
|
|
32
30
|
return /*#__PURE__*/_react.default.createElement(_moveUp.MoveUpDropdownItem, {
|
|
@@ -35,11 +33,11 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
|
|
|
35
33
|
}
|
|
36
34
|
}, {
|
|
37
35
|
type: 'block-menu-item',
|
|
38
|
-
key: _blockMenu.
|
|
36
|
+
key: _blockMenu.POSITION_MOVE_DOWN_MENU_ITEM.key,
|
|
39
37
|
parent: {
|
|
40
38
|
type: 'block-menu-section',
|
|
41
|
-
key: _blockMenu.
|
|
42
|
-
rank: _blockMenu.
|
|
39
|
+
key: _blockMenu.POSITION_MENU_SECTION.key,
|
|
40
|
+
rank: _blockMenu.POSITION_MENU_SECTION_RANK[_blockMenu.POSITION_MOVE_DOWN_MENU_ITEM.key]
|
|
43
41
|
},
|
|
44
42
|
component: function component() {
|
|
45
43
|
return /*#__PURE__*/_react.default.createElement(_moveDown.MoveDownDropdownItem, {
|
|
@@ -48,14 +46,14 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
|
|
|
48
46
|
}
|
|
49
47
|
}];
|
|
50
48
|
};
|
|
51
|
-
var
|
|
49
|
+
var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
52
50
|
return [{
|
|
53
51
|
type: 'block-menu-nested',
|
|
54
|
-
key: _blockMenu.
|
|
52
|
+
key: _blockMenu.TRANSFORM_MENU_ITEM.key,
|
|
55
53
|
parent: {
|
|
56
54
|
type: 'block-menu-section',
|
|
57
|
-
key: _blockMenu.
|
|
58
|
-
rank:
|
|
55
|
+
key: _blockMenu.TRANSFORM_MENU_SECTION.key,
|
|
56
|
+
rank: _blockMenu.TRANSFORM_MENU_SECTION_RANK[_blockMenu.TRANSFORM_MENU_ITEM.key]
|
|
59
57
|
},
|
|
60
58
|
component: function component() {
|
|
61
59
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -68,32 +66,51 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
68
66
|
}
|
|
69
67
|
}, {
|
|
70
68
|
type: 'block-menu-section',
|
|
71
|
-
key: _blockMenu.
|
|
69
|
+
key: _blockMenu.TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
72
70
|
parent: {
|
|
73
71
|
type: 'block-menu-nested',
|
|
74
|
-
key: _blockMenu.
|
|
75
|
-
rank:
|
|
72
|
+
key: _blockMenu.TRANSFORM_MENU_ITEM.key,
|
|
73
|
+
rank: _blockMenu.TRANSFORM_MENU_ITEM_RANK[_blockMenu.TRANSFORM_SUGGESTED_MENU_SECTION.key]
|
|
76
74
|
},
|
|
77
75
|
component: function component() {
|
|
78
76
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
79
77
|
children: null
|
|
80
78
|
},
|
|
81
79
|
children = _ref2.children;
|
|
82
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection,
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
81
|
+
title: "Suggested"
|
|
82
|
+
}, children);
|
|
83
83
|
}
|
|
84
84
|
}, {
|
|
85
85
|
type: 'block-menu-section',
|
|
86
|
-
key: _blockMenu.
|
|
86
|
+
key: _blockMenu.TRANSFORM_CREATE_MENU_SECTION.key,
|
|
87
87
|
parent: {
|
|
88
88
|
type: 'block-menu-nested',
|
|
89
|
-
key: _blockMenu.
|
|
90
|
-
rank: _blockMenu.TRANSFORM_MENU_ITEM_RANK[_blockMenu.
|
|
89
|
+
key: _blockMenu.TRANSFORM_MENU_ITEM.key,
|
|
90
|
+
rank: _blockMenu.TRANSFORM_MENU_ITEM_RANK[_blockMenu.TRANSFORM_CREATE_MENU_SECTION.key]
|
|
91
91
|
},
|
|
92
92
|
component: function component() {
|
|
93
93
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
94
94
|
children: null
|
|
95
95
|
},
|
|
96
96
|
children = _ref3.children;
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
98
|
+
title: "Create"
|
|
99
|
+
}, children);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
type: 'block-menu-section',
|
|
103
|
+
key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
104
|
+
parent: {
|
|
105
|
+
type: 'block-menu-nested',
|
|
106
|
+
key: _blockMenu.TRANSFORM_MENU_ITEM.key,
|
|
107
|
+
rank: _blockMenu.TRANSFORM_MENU_ITEM_RANK[_blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key]
|
|
108
|
+
},
|
|
109
|
+
component: function component() {
|
|
110
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
111
|
+
children: null
|
|
112
|
+
},
|
|
113
|
+
children = _ref4.children;
|
|
97
114
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
98
115
|
title: "Structure"
|
|
99
116
|
}, children);
|
|
@@ -103,14 +120,14 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
103
120
|
key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
|
|
104
121
|
parent: {
|
|
105
122
|
type: 'block-menu-nested',
|
|
106
|
-
key: _blockMenu.
|
|
123
|
+
key: _blockMenu.TRANSFORM_MENU_ITEM.key,
|
|
107
124
|
rank: _blockMenu.TRANSFORM_MENU_ITEM_RANK[_blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key]
|
|
108
125
|
},
|
|
109
126
|
component: function component() {
|
|
110
|
-
var
|
|
127
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
111
128
|
children: null
|
|
112
129
|
},
|
|
113
|
-
children =
|
|
130
|
+
children = _ref5.children;
|
|
114
131
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
115
132
|
title: "Headings",
|
|
116
133
|
hasSeparator: true
|
|
@@ -118,33 +135,23 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
118
135
|
}
|
|
119
136
|
}, {
|
|
120
137
|
type: 'block-menu-section',
|
|
121
|
-
key: _blockMenu.
|
|
122
|
-
rank:
|
|
123
|
-
component: function component(
|
|
124
|
-
var children =
|
|
138
|
+
key: _blockMenu.TRANSFORM_MENU_SECTION.key,
|
|
139
|
+
rank: _blockMenu.MAIN_BLOCK_MENU_SECTION_RANK[_blockMenu.TRANSFORM_MENU_SECTION.key],
|
|
140
|
+
component: function component(_ref6) {
|
|
141
|
+
var children = _ref6.children;
|
|
125
142
|
return /*#__PURE__*/_react.default.createElement(_formatMenuSection.FormatMenuSection, {
|
|
126
143
|
api: api
|
|
127
144
|
}, children);
|
|
128
145
|
}
|
|
129
146
|
}];
|
|
130
147
|
};
|
|
131
|
-
var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockMenuComponents(
|
|
132
|
-
var api =
|
|
133
|
-
config =
|
|
134
|
-
return [].concat((0, _toConsumableArray2.default)(
|
|
135
|
-
type: 'block-menu-section',
|
|
136
|
-
key: _blockMenu.ADD_BLOCKS_MENU_SECTION.key,
|
|
137
|
-
rank: _blockMenu.BLOCK_MENU_SECTION_RANK[_blockMenu.ADD_BLOCKS_MENU_SECTION.key],
|
|
138
|
-
component: function component(_ref7) {
|
|
139
|
-
var children = _ref7.children;
|
|
140
|
-
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
141
|
-
hasSeparator: true
|
|
142
|
-
}, children);
|
|
143
|
-
}
|
|
144
|
-
}] : []), [{
|
|
148
|
+
var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockMenuComponents(_ref7) {
|
|
149
|
+
var api = _ref7.api,
|
|
150
|
+
config = _ref7.config;
|
|
151
|
+
return [].concat((0, _toConsumableArray2.default)(getTurnIntoMenuComponents(api)), [{
|
|
145
152
|
type: 'block-menu-section',
|
|
146
|
-
key: _blockMenu.
|
|
147
|
-
rank: _blockMenu.
|
|
153
|
+
key: _blockMenu.BLOCK_ACTIONS_MENU_SECTION.key,
|
|
154
|
+
rank: _blockMenu.MAIN_BLOCK_MENU_SECTION_RANK[_blockMenu.BLOCK_ACTIONS_MENU_SECTION.key],
|
|
148
155
|
component: function component(_ref8) {
|
|
149
156
|
var children = _ref8.children;
|
|
150
157
|
return /*#__PURE__*/_react.default.createElement(_copySection.CopySection, {
|
|
@@ -153,24 +160,11 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
|
|
|
153
160
|
}
|
|
154
161
|
}, {
|
|
155
162
|
type: 'block-menu-item',
|
|
156
|
-
key: _blockMenu.
|
|
163
|
+
key: _blockMenu.BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key,
|
|
157
164
|
parent: {
|
|
158
165
|
type: 'block-menu-section',
|
|
159
|
-
key: _blockMenu.
|
|
160
|
-
rank: _blockMenu.
|
|
161
|
-
},
|
|
162
|
-
component: function component() {
|
|
163
|
-
return /*#__PURE__*/_react.default.createElement(_copyBlock.default, {
|
|
164
|
-
api: api
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
type: 'block-menu-item',
|
|
169
|
-
key: _blockMenu.COPY_LINK_MENU_ITEM.key,
|
|
170
|
-
parent: {
|
|
171
|
-
type: 'block-menu-section',
|
|
172
|
-
key: _blockMenu.COPY_MENU_SECTION.key,
|
|
173
|
-
rank: _blockMenu.COPY_MENU_SECTION_RANK[_blockMenu.COPY_LINK_MENU_ITEM.key]
|
|
166
|
+
key: _blockMenu.BLOCK_ACTIONS_MENU_SECTION.key,
|
|
167
|
+
rank: _blockMenu.BLOCK_ACTIONS_MENU_SECTION_RANK[_blockMenu.BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key]
|
|
174
168
|
},
|
|
175
169
|
component: function component() {
|
|
176
170
|
return /*#__PURE__*/_react.default.createElement(_copyLink.CopyLinkDropdownItem, {
|
|
@@ -180,31 +174,31 @@ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockM
|
|
|
180
174
|
}
|
|
181
175
|
}, {
|
|
182
176
|
type: 'block-menu-section',
|
|
183
|
-
key: _blockMenu.
|
|
184
|
-
rank: _blockMenu.
|
|
177
|
+
key: _blockMenu.POSITION_MENU_SECTION.key,
|
|
178
|
+
rank: _blockMenu.MAIN_BLOCK_MENU_SECTION_RANK[_blockMenu.POSITION_MENU_SECTION.key],
|
|
185
179
|
component: function component(_ref9) {
|
|
186
180
|
var children = _ref9.children;
|
|
187
181
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
188
182
|
hasSeparator: true
|
|
189
183
|
}, children);
|
|
190
184
|
}
|
|
191
|
-
}, {
|
|
185
|
+
}], (0, _toConsumableArray2.default)(getMoveUpMoveDownMenuComponents(api)), [{
|
|
192
186
|
type: 'block-menu-section',
|
|
193
187
|
key: _blockMenu.DELETE_MENU_SECTION.key,
|
|
194
|
-
rank: _blockMenu.
|
|
188
|
+
rank: _blockMenu.MAIN_BLOCK_MENU_SECTION_RANK[_blockMenu.DELETE_MENU_SECTION.key],
|
|
195
189
|
component: function component(_ref0) {
|
|
196
190
|
var children = _ref0.children;
|
|
197
191
|
return /*#__PURE__*/_react.default.createElement(_deleteSection.DeleteSection, {
|
|
198
192
|
api: api
|
|
199
193
|
}, children);
|
|
200
194
|
}
|
|
201
|
-
}
|
|
195
|
+
}, {
|
|
202
196
|
type: 'block-menu-item',
|
|
203
197
|
key: _blockMenu.DELETE_MENU_ITEM.key,
|
|
204
198
|
parent: {
|
|
205
199
|
type: 'block-menu-section',
|
|
206
200
|
key: _blockMenu.DELETE_MENU_SECTION.key,
|
|
207
|
-
rank: _blockMenu.
|
|
201
|
+
rank: _blockMenu.DELETE_MENU_SECTION_RANK[_blockMenu.DELETE_MENU_ITEM.key]
|
|
208
202
|
},
|
|
209
203
|
component: function component() {
|
|
210
204
|
return /*#__PURE__*/_react.default.createElement(_deleteButton.DeleteDropdownItem, {
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -19,12 +19,14 @@ var _copyLink = require("./utils/copyLink");
|
|
|
19
19
|
var _isNestedNode = require("./utils/isNestedNode");
|
|
20
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); }
|
|
21
21
|
var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
22
|
+
var _api$selection;
|
|
22
23
|
var api = _ref.api,
|
|
23
24
|
config = _ref.config;
|
|
24
25
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
25
26
|
formatMessage = _useIntl.formatMessage;
|
|
26
27
|
var _useBlockMenu = (0, _blockMenuProvider.useBlockMenu)(),
|
|
27
28
|
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
29
|
+
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
28
30
|
var handleClick = (0, _react.useCallback)(function () {
|
|
29
31
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
30
32
|
var _api$analytics, _api$blockControls;
|
|
@@ -49,8 +51,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
49
51
|
return (0, _copyLink.copyLink)(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api);
|
|
50
52
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api, onDropdownOpenChanged]);
|
|
51
53
|
var checkIsNestedNode = (0, _react.useCallback)(function () {
|
|
52
|
-
var _api$
|
|
53
|
-
var selection = api === null || api === void 0 || (_api$
|
|
54
|
+
var _api$selection2, _api$blockControls2;
|
|
55
|
+
var selection = api === null || api === void 0 || (_api$selection2 = api.selection) === null || _api$selection2 === void 0 || (_api$selection2 = _api$selection2.sharedState) === null || _api$selection2 === void 0 || (_api$selection2 = _api$selection2.currentState()) === null || _api$selection2 === void 0 ? void 0 : _api$selection2.selection;
|
|
54
56
|
var menuTriggerBy = api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.sharedState) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.currentState()) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.menuTriggerBy;
|
|
55
57
|
if (!selection || !menuTriggerBy) {
|
|
56
58
|
return false;
|
|
@@ -58,8 +60,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
58
60
|
return (0, _isNestedNode.isNestedNode)(selection, menuTriggerBy);
|
|
59
61
|
}, [api]);
|
|
60
62
|
|
|
61
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
|
|
62
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
63
|
+
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested or on empty line
|
|
64
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') || checkIsNestedNode() || !!(selection !== null && selection !== void 0 && selection.empty)) {
|
|
63
65
|
return null;
|
|
64
66
|
}
|
|
65
67
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -11,17 +11,11 @@ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equa
|
|
|
11
11
|
var _checkIsFormatMenuHidden = require("./utils/checkIsFormatMenuHidden");
|
|
12
12
|
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); }
|
|
13
13
|
var CopySection = exports.CopySection = function CopySection(_ref) {
|
|
14
|
-
var _api$selection;
|
|
15
14
|
var api = _ref.api,
|
|
16
15
|
children = _ref.children;
|
|
17
16
|
var isFormatMenuHidden = (0, _react.useCallback)(function () {
|
|
18
17
|
return (0, _checkIsFormatMenuHidden.checkIsFormatMenuHidden)(api);
|
|
19
18
|
}, [api]);
|
|
20
|
-
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
21
|
-
var isEmptyLineSelected = !!(selection !== null && selection !== void 0 && selection.empty) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
22
|
-
if (isEmptyLineSelected) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
19
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
|
|
26
20
|
hasSeparator: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? true : !isFormatMenuHidden()
|
|
27
21
|
}, children);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_MENU_SECTION_RANK, DELETE_MENU_SECTION, DELETE_MENU_SECTION_RANK, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MENU_SECTION_RANK, POSITION_MOVE_DOWN_MENU_ITEM, POSITION_MOVE_UP_MENU_ITEM, TRANSFORM_MENU_ITEM, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, MAIN_BLOCK_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
3
3
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import CopyBlockMenuItem from './copy-block';
|
|
6
4
|
import { CopyLinkDropdownItem } from './copy-link';
|
|
7
5
|
import { CopySection } from './copy-section';
|
|
8
6
|
import { DeleteDropdownItem } from './delete-button';
|
|
@@ -14,36 +12,36 @@ import { MoveUpDropdownItem } from './move-up';
|
|
|
14
12
|
const getMoveUpMoveDownMenuComponents = api => {
|
|
15
13
|
return [{
|
|
16
14
|
type: 'block-menu-item',
|
|
17
|
-
key:
|
|
15
|
+
key: POSITION_MOVE_UP_MENU_ITEM.key,
|
|
18
16
|
parent: {
|
|
19
17
|
type: 'block-menu-section',
|
|
20
|
-
key:
|
|
21
|
-
rank:
|
|
18
|
+
key: POSITION_MENU_SECTION.key,
|
|
19
|
+
rank: POSITION_MENU_SECTION_RANK[POSITION_MOVE_UP_MENU_ITEM.key]
|
|
22
20
|
},
|
|
23
21
|
component: () => /*#__PURE__*/React.createElement(MoveUpDropdownItem, {
|
|
24
22
|
api: api
|
|
25
23
|
})
|
|
26
24
|
}, {
|
|
27
25
|
type: 'block-menu-item',
|
|
28
|
-
key:
|
|
26
|
+
key: POSITION_MOVE_DOWN_MENU_ITEM.key,
|
|
29
27
|
parent: {
|
|
30
28
|
type: 'block-menu-section',
|
|
31
|
-
key:
|
|
32
|
-
rank:
|
|
29
|
+
key: POSITION_MENU_SECTION.key,
|
|
30
|
+
rank: POSITION_MENU_SECTION_RANK[POSITION_MOVE_DOWN_MENU_ITEM.key]
|
|
33
31
|
},
|
|
34
32
|
component: () => /*#__PURE__*/React.createElement(MoveDownDropdownItem, {
|
|
35
33
|
api: api
|
|
36
34
|
})
|
|
37
35
|
}];
|
|
38
36
|
};
|
|
39
|
-
const
|
|
37
|
+
const getTurnIntoMenuComponents = api => {
|
|
40
38
|
return [{
|
|
41
39
|
type: 'block-menu-nested',
|
|
42
|
-
key:
|
|
40
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
43
41
|
parent: {
|
|
44
42
|
type: 'block-menu-section',
|
|
45
|
-
key:
|
|
46
|
-
rank:
|
|
43
|
+
key: TRANSFORM_MENU_SECTION.key,
|
|
44
|
+
rank: TRANSFORM_MENU_SECTION_RANK[TRANSFORM_MENU_ITEM.key]
|
|
47
45
|
},
|
|
48
46
|
component: ({
|
|
49
47
|
children
|
|
@@ -56,25 +54,44 @@ const getFormatMenuComponents = api => {
|
|
|
56
54
|
}
|
|
57
55
|
}, {
|
|
58
56
|
type: 'block-menu-section',
|
|
59
|
-
key:
|
|
57
|
+
key: TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
60
58
|
parent: {
|
|
61
59
|
type: 'block-menu-nested',
|
|
62
|
-
key:
|
|
63
|
-
rank:
|
|
60
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
61
|
+
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_SUGGESTED_MENU_SECTION.key]
|
|
64
62
|
},
|
|
65
63
|
component: ({
|
|
66
64
|
children
|
|
67
65
|
} = {
|
|
68
66
|
children: null
|
|
69
67
|
}) => {
|
|
70
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection,
|
|
68
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
69
|
+
title: "Suggested"
|
|
70
|
+
}, children);
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
type: 'block-menu-section',
|
|
74
|
+
key: TRANSFORM_CREATE_MENU_SECTION.key,
|
|
75
|
+
parent: {
|
|
76
|
+
type: 'block-menu-nested',
|
|
77
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
78
|
+
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_CREATE_MENU_SECTION.key]
|
|
79
|
+
},
|
|
80
|
+
component: ({
|
|
81
|
+
children
|
|
82
|
+
} = {
|
|
83
|
+
children: null
|
|
84
|
+
}) => {
|
|
85
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
86
|
+
title: "Create"
|
|
87
|
+
}, children);
|
|
71
88
|
}
|
|
72
89
|
}, {
|
|
73
90
|
type: 'block-menu-section',
|
|
74
91
|
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
75
92
|
parent: {
|
|
76
93
|
type: 'block-menu-nested',
|
|
77
|
-
key:
|
|
94
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
78
95
|
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_STRUCTURE_MENU_SECTION.key]
|
|
79
96
|
},
|
|
80
97
|
component: ({
|
|
@@ -91,7 +108,7 @@ const getFormatMenuComponents = api => {
|
|
|
91
108
|
key: TRANSFORM_HEADINGS_MENU_SECTION.key,
|
|
92
109
|
parent: {
|
|
93
110
|
type: 'block-menu-nested',
|
|
94
|
-
key:
|
|
111
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
95
112
|
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_HEADINGS_MENU_SECTION.key]
|
|
96
113
|
},
|
|
97
114
|
component: ({
|
|
@@ -106,8 +123,8 @@ const getFormatMenuComponents = api => {
|
|
|
106
123
|
}
|
|
107
124
|
}, {
|
|
108
125
|
type: 'block-menu-section',
|
|
109
|
-
key:
|
|
110
|
-
rank:
|
|
126
|
+
key: TRANSFORM_MENU_SECTION.key,
|
|
127
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[TRANSFORM_MENU_SECTION.key],
|
|
111
128
|
component: ({
|
|
112
129
|
children
|
|
113
130
|
}) => {
|
|
@@ -121,19 +138,10 @@ export const getBlockMenuComponents = ({
|
|
|
121
138
|
api,
|
|
122
139
|
config
|
|
123
140
|
}) => {
|
|
124
|
-
return [...
|
|
141
|
+
return [...getTurnIntoMenuComponents(api), {
|
|
125
142
|
type: 'block-menu-section',
|
|
126
|
-
key:
|
|
127
|
-
rank:
|
|
128
|
-
component: ({
|
|
129
|
-
children
|
|
130
|
-
}) => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
131
|
-
hasSeparator: true
|
|
132
|
-
}, children)
|
|
133
|
-
}] : []), {
|
|
134
|
-
type: 'block-menu-section',
|
|
135
|
-
key: COPY_MENU_SECTION.key,
|
|
136
|
-
rank: BLOCK_MENU_SECTION_RANK[COPY_MENU_SECTION.key],
|
|
143
|
+
key: BLOCK_ACTIONS_MENU_SECTION.key,
|
|
144
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[BLOCK_ACTIONS_MENU_SECTION.key],
|
|
137
145
|
component: ({
|
|
138
146
|
children
|
|
139
147
|
}) => /*#__PURE__*/React.createElement(CopySection, {
|
|
@@ -141,24 +149,11 @@ export const getBlockMenuComponents = ({
|
|
|
141
149
|
}, children)
|
|
142
150
|
}, {
|
|
143
151
|
type: 'block-menu-item',
|
|
144
|
-
key:
|
|
152
|
+
key: BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key,
|
|
145
153
|
parent: {
|
|
146
154
|
type: 'block-menu-section',
|
|
147
|
-
key:
|
|
148
|
-
rank:
|
|
149
|
-
},
|
|
150
|
-
component: () => {
|
|
151
|
-
return /*#__PURE__*/React.createElement(CopyBlockMenuItem, {
|
|
152
|
-
api: api
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
type: 'block-menu-item',
|
|
157
|
-
key: COPY_LINK_MENU_ITEM.key,
|
|
158
|
-
parent: {
|
|
159
|
-
type: 'block-menu-section',
|
|
160
|
-
key: COPY_MENU_SECTION.key,
|
|
161
|
-
rank: COPY_MENU_SECTION_RANK[COPY_LINK_MENU_ITEM.key]
|
|
155
|
+
key: BLOCK_ACTIONS_MENU_SECTION.key,
|
|
156
|
+
rank: BLOCK_ACTIONS_MENU_SECTION_RANK[BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key]
|
|
162
157
|
},
|
|
163
158
|
component: () => /*#__PURE__*/React.createElement(CopyLinkDropdownItem, {
|
|
164
159
|
api: api,
|
|
@@ -166,8 +161,8 @@ export const getBlockMenuComponents = ({
|
|
|
166
161
|
})
|
|
167
162
|
}, {
|
|
168
163
|
type: 'block-menu-section',
|
|
169
|
-
key:
|
|
170
|
-
rank:
|
|
164
|
+
key: POSITION_MENU_SECTION.key,
|
|
165
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[POSITION_MENU_SECTION.key],
|
|
171
166
|
component: ({
|
|
172
167
|
children
|
|
173
168
|
}) => {
|
|
@@ -175,10 +170,10 @@ export const getBlockMenuComponents = ({
|
|
|
175
170
|
hasSeparator: true
|
|
176
171
|
}, children);
|
|
177
172
|
}
|
|
178
|
-
}, {
|
|
173
|
+
}, ...getMoveUpMoveDownMenuComponents(api), {
|
|
179
174
|
type: 'block-menu-section',
|
|
180
175
|
key: DELETE_MENU_SECTION.key,
|
|
181
|
-
rank:
|
|
176
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[DELETE_MENU_SECTION.key],
|
|
182
177
|
component: ({
|
|
183
178
|
children
|
|
184
179
|
}) => {
|
|
@@ -186,13 +181,13 @@ export const getBlockMenuComponents = ({
|
|
|
186
181
|
api: api
|
|
187
182
|
}, children);
|
|
188
183
|
}
|
|
189
|
-
},
|
|
184
|
+
}, {
|
|
190
185
|
type: 'block-menu-item',
|
|
191
186
|
key: DELETE_MENU_ITEM.key,
|
|
192
187
|
parent: {
|
|
193
188
|
type: 'block-menu-section',
|
|
194
189
|
key: DELETE_MENU_SECTION.key,
|
|
195
|
-
rank:
|
|
190
|
+
rank: DELETE_MENU_SECTION_RANK[DELETE_MENU_ITEM.key]
|
|
196
191
|
},
|
|
197
192
|
component: () => /*#__PURE__*/React.createElement(DeleteDropdownItem, {
|
|
198
193
|
api: api
|
|
@@ -13,12 +13,14 @@ const CopyLinkDropdownItemContent = ({
|
|
|
13
13
|
api,
|
|
14
14
|
config
|
|
15
15
|
}) => {
|
|
16
|
+
var _api$selection, _api$selection$shared, _api$selection$shared2;
|
|
16
17
|
const {
|
|
17
18
|
formatMessage
|
|
18
19
|
} = useIntl();
|
|
19
20
|
const {
|
|
20
21
|
onDropdownOpenChanged
|
|
21
22
|
} = useBlockMenu();
|
|
23
|
+
const selection = api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : (_api$selection$shared = _api$selection.sharedState) === null || _api$selection$shared === void 0 ? void 0 : (_api$selection$shared2 = _api$selection$shared.currentState()) === null || _api$selection$shared2 === void 0 ? void 0 : _api$selection$shared2.selection;
|
|
22
24
|
const handleClick = useCallback(() => {
|
|
23
25
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
24
26
|
tr
|
|
@@ -44,8 +46,8 @@ const CopyLinkDropdownItemContent = ({
|
|
|
44
46
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api);
|
|
45
47
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api, onDropdownOpenChanged]);
|
|
46
48
|
const checkIsNestedNode = useCallback(() => {
|
|
47
|
-
var _api$
|
|
48
|
-
const selection = api === null || api === void 0 ? void 0 : (_api$
|
|
49
|
+
var _api$selection2, _api$selection2$share, _api$selection2$share2, _api$blockControls2, _api$blockControls2$s, _api$blockControls2$s2;
|
|
50
|
+
const selection = api === null || api === void 0 ? void 0 : (_api$selection2 = api.selection) === null || _api$selection2 === void 0 ? void 0 : (_api$selection2$share = _api$selection2.sharedState) === null || _api$selection2$share === void 0 ? void 0 : (_api$selection2$share2 = _api$selection2$share.currentState()) === null || _api$selection2$share2 === void 0 ? void 0 : _api$selection2$share2.selection;
|
|
49
51
|
const menuTriggerBy = api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$s = _api$blockControls2.sharedState) === null || _api$blockControls2$s === void 0 ? void 0 : (_api$blockControls2$s2 = _api$blockControls2$s.currentState()) === null || _api$blockControls2$s2 === void 0 ? void 0 : _api$blockControls2$s2.menuTriggerBy;
|
|
50
52
|
if (!selection || !menuTriggerBy) {
|
|
51
53
|
return false;
|
|
@@ -53,8 +55,8 @@ const CopyLinkDropdownItemContent = ({
|
|
|
53
55
|
return isNestedNode(selection, menuTriggerBy);
|
|
54
56
|
}, [api]);
|
|
55
57
|
|
|
56
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
|
|
57
|
-
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
58
|
+
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested or on empty line
|
|
59
|
+
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode() || !!(selection !== null && selection !== void 0 && selection.empty)) {
|
|
58
60
|
return null;
|
|
59
61
|
}
|
|
60
62
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -6,15 +6,9 @@ export const CopySection = ({
|
|
|
6
6
|
api,
|
|
7
7
|
children
|
|
8
8
|
}) => {
|
|
9
|
-
var _api$selection, _api$selection$shared, _api$selection$shared2;
|
|
10
9
|
const isFormatMenuHidden = useCallback(() => {
|
|
11
10
|
return checkIsFormatMenuHidden(api);
|
|
12
11
|
}, [api]);
|
|
13
|
-
const selection = api === null || api === void 0 ? void 0 : (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : (_api$selection$shared = _api$selection.sharedState) === null || _api$selection$shared === void 0 ? void 0 : (_api$selection$shared2 = _api$selection$shared.currentState()) === null || _api$selection$shared2 === void 0 ? void 0 : _api$selection$shared2.selection;
|
|
14
|
-
const isEmptyLineSelected = !!(selection !== null && selection !== void 0 && selection.empty) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
15
|
-
if (isEmptyLineSelected) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
12
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
19
13
|
hasSeparator: expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? true : !isFormatMenuHidden()
|
|
20
14
|
}, children);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_MENU_SECTION_RANK, DELETE_MENU_SECTION, DELETE_MENU_SECTION_RANK, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MENU_SECTION_RANK, POSITION_MOVE_DOWN_MENU_ITEM, POSITION_MOVE_UP_MENU_ITEM, TRANSFORM_MENU_ITEM, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, MAIN_BLOCK_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
4
4
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
-
import CopyBlockMenuItem from './copy-block';
|
|
7
5
|
import { CopyLinkDropdownItem } from './copy-link';
|
|
8
6
|
import { CopySection } from './copy-section';
|
|
9
7
|
import { DeleteDropdownItem } from './delete-button';
|
|
@@ -15,11 +13,11 @@ import { MoveUpDropdownItem } from './move-up';
|
|
|
15
13
|
var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(api) {
|
|
16
14
|
return [{
|
|
17
15
|
type: 'block-menu-item',
|
|
18
|
-
key:
|
|
16
|
+
key: POSITION_MOVE_UP_MENU_ITEM.key,
|
|
19
17
|
parent: {
|
|
20
18
|
type: 'block-menu-section',
|
|
21
|
-
key:
|
|
22
|
-
rank:
|
|
19
|
+
key: POSITION_MENU_SECTION.key,
|
|
20
|
+
rank: POSITION_MENU_SECTION_RANK[POSITION_MOVE_UP_MENU_ITEM.key]
|
|
23
21
|
},
|
|
24
22
|
component: function component() {
|
|
25
23
|
return /*#__PURE__*/React.createElement(MoveUpDropdownItem, {
|
|
@@ -28,11 +26,11 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
|
|
|
28
26
|
}
|
|
29
27
|
}, {
|
|
30
28
|
type: 'block-menu-item',
|
|
31
|
-
key:
|
|
29
|
+
key: POSITION_MOVE_DOWN_MENU_ITEM.key,
|
|
32
30
|
parent: {
|
|
33
31
|
type: 'block-menu-section',
|
|
34
|
-
key:
|
|
35
|
-
rank:
|
|
32
|
+
key: POSITION_MENU_SECTION.key,
|
|
33
|
+
rank: POSITION_MENU_SECTION_RANK[POSITION_MOVE_DOWN_MENU_ITEM.key]
|
|
36
34
|
},
|
|
37
35
|
component: function component() {
|
|
38
36
|
return /*#__PURE__*/React.createElement(MoveDownDropdownItem, {
|
|
@@ -41,14 +39,14 @@ var getMoveUpMoveDownMenuComponents = function getMoveUpMoveDownMenuComponents(a
|
|
|
41
39
|
}
|
|
42
40
|
}];
|
|
43
41
|
};
|
|
44
|
-
var
|
|
42
|
+
var getTurnIntoMenuComponents = function getTurnIntoMenuComponents(api) {
|
|
45
43
|
return [{
|
|
46
44
|
type: 'block-menu-nested',
|
|
47
|
-
key:
|
|
45
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
48
46
|
parent: {
|
|
49
47
|
type: 'block-menu-section',
|
|
50
|
-
key:
|
|
51
|
-
rank:
|
|
48
|
+
key: TRANSFORM_MENU_SECTION.key,
|
|
49
|
+
rank: TRANSFORM_MENU_SECTION_RANK[TRANSFORM_MENU_ITEM.key]
|
|
52
50
|
},
|
|
53
51
|
component: function component() {
|
|
54
52
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -61,32 +59,51 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
61
59
|
}
|
|
62
60
|
}, {
|
|
63
61
|
type: 'block-menu-section',
|
|
64
|
-
key:
|
|
62
|
+
key: TRANSFORM_SUGGESTED_MENU_SECTION.key,
|
|
65
63
|
parent: {
|
|
66
64
|
type: 'block-menu-nested',
|
|
67
|
-
key:
|
|
68
|
-
rank:
|
|
65
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
66
|
+
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_SUGGESTED_MENU_SECTION.key]
|
|
69
67
|
},
|
|
70
68
|
component: function component() {
|
|
71
69
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
72
70
|
children: null
|
|
73
71
|
},
|
|
74
72
|
children = _ref2.children;
|
|
75
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection,
|
|
73
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
74
|
+
title: "Suggested"
|
|
75
|
+
}, children);
|
|
76
76
|
}
|
|
77
77
|
}, {
|
|
78
78
|
type: 'block-menu-section',
|
|
79
|
-
key:
|
|
79
|
+
key: TRANSFORM_CREATE_MENU_SECTION.key,
|
|
80
80
|
parent: {
|
|
81
81
|
type: 'block-menu-nested',
|
|
82
|
-
key:
|
|
83
|
-
rank: TRANSFORM_MENU_ITEM_RANK[
|
|
82
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
83
|
+
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_CREATE_MENU_SECTION.key]
|
|
84
84
|
},
|
|
85
85
|
component: function component() {
|
|
86
86
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
87
87
|
children: null
|
|
88
88
|
},
|
|
89
89
|
children = _ref3.children;
|
|
90
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
91
|
+
title: "Create"
|
|
92
|
+
}, children);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
type: 'block-menu-section',
|
|
96
|
+
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
97
|
+
parent: {
|
|
98
|
+
type: 'block-menu-nested',
|
|
99
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
100
|
+
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_STRUCTURE_MENU_SECTION.key]
|
|
101
|
+
},
|
|
102
|
+
component: function component() {
|
|
103
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
104
|
+
children: null
|
|
105
|
+
},
|
|
106
|
+
children = _ref4.children;
|
|
90
107
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
91
108
|
title: "Structure"
|
|
92
109
|
}, children);
|
|
@@ -96,14 +113,14 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
96
113
|
key: TRANSFORM_HEADINGS_MENU_SECTION.key,
|
|
97
114
|
parent: {
|
|
98
115
|
type: 'block-menu-nested',
|
|
99
|
-
key:
|
|
116
|
+
key: TRANSFORM_MENU_ITEM.key,
|
|
100
117
|
rank: TRANSFORM_MENU_ITEM_RANK[TRANSFORM_HEADINGS_MENU_SECTION.key]
|
|
101
118
|
},
|
|
102
119
|
component: function component() {
|
|
103
|
-
var
|
|
120
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
104
121
|
children: null
|
|
105
122
|
},
|
|
106
|
-
children =
|
|
123
|
+
children = _ref5.children;
|
|
107
124
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
108
125
|
title: "Headings",
|
|
109
126
|
hasSeparator: true
|
|
@@ -111,33 +128,23 @@ var getFormatMenuComponents = function getFormatMenuComponents(api) {
|
|
|
111
128
|
}
|
|
112
129
|
}, {
|
|
113
130
|
type: 'block-menu-section',
|
|
114
|
-
key:
|
|
115
|
-
rank:
|
|
116
|
-
component: function component(
|
|
117
|
-
var children =
|
|
131
|
+
key: TRANSFORM_MENU_SECTION.key,
|
|
132
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[TRANSFORM_MENU_SECTION.key],
|
|
133
|
+
component: function component(_ref6) {
|
|
134
|
+
var children = _ref6.children;
|
|
118
135
|
return /*#__PURE__*/React.createElement(FormatMenuSection, {
|
|
119
136
|
api: api
|
|
120
137
|
}, children);
|
|
121
138
|
}
|
|
122
139
|
}];
|
|
123
140
|
};
|
|
124
|
-
export var getBlockMenuComponents = function getBlockMenuComponents(
|
|
125
|
-
var api =
|
|
126
|
-
config =
|
|
127
|
-
return [].concat(_toConsumableArray(
|
|
128
|
-
type: 'block-menu-section',
|
|
129
|
-
key: ADD_BLOCKS_MENU_SECTION.key,
|
|
130
|
-
rank: BLOCK_MENU_SECTION_RANK[ADD_BLOCKS_MENU_SECTION.key],
|
|
131
|
-
component: function component(_ref7) {
|
|
132
|
-
var children = _ref7.children;
|
|
133
|
-
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
134
|
-
hasSeparator: true
|
|
135
|
-
}, children);
|
|
136
|
-
}
|
|
137
|
-
}] : []), [{
|
|
141
|
+
export var getBlockMenuComponents = function getBlockMenuComponents(_ref7) {
|
|
142
|
+
var api = _ref7.api,
|
|
143
|
+
config = _ref7.config;
|
|
144
|
+
return [].concat(_toConsumableArray(getTurnIntoMenuComponents(api)), [{
|
|
138
145
|
type: 'block-menu-section',
|
|
139
|
-
key:
|
|
140
|
-
rank:
|
|
146
|
+
key: BLOCK_ACTIONS_MENU_SECTION.key,
|
|
147
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[BLOCK_ACTIONS_MENU_SECTION.key],
|
|
141
148
|
component: function component(_ref8) {
|
|
142
149
|
var children = _ref8.children;
|
|
143
150
|
return /*#__PURE__*/React.createElement(CopySection, {
|
|
@@ -146,24 +153,11 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref6) {
|
|
|
146
153
|
}
|
|
147
154
|
}, {
|
|
148
155
|
type: 'block-menu-item',
|
|
149
|
-
key:
|
|
156
|
+
key: BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key,
|
|
150
157
|
parent: {
|
|
151
158
|
type: 'block-menu-section',
|
|
152
|
-
key:
|
|
153
|
-
rank:
|
|
154
|
-
},
|
|
155
|
-
component: function component() {
|
|
156
|
-
return /*#__PURE__*/React.createElement(CopyBlockMenuItem, {
|
|
157
|
-
api: api
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}, {
|
|
161
|
-
type: 'block-menu-item',
|
|
162
|
-
key: COPY_LINK_MENU_ITEM.key,
|
|
163
|
-
parent: {
|
|
164
|
-
type: 'block-menu-section',
|
|
165
|
-
key: COPY_MENU_SECTION.key,
|
|
166
|
-
rank: COPY_MENU_SECTION_RANK[COPY_LINK_MENU_ITEM.key]
|
|
159
|
+
key: BLOCK_ACTIONS_MENU_SECTION.key,
|
|
160
|
+
rank: BLOCK_ACTIONS_MENU_SECTION_RANK[BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key]
|
|
167
161
|
},
|
|
168
162
|
component: function component() {
|
|
169
163
|
return /*#__PURE__*/React.createElement(CopyLinkDropdownItem, {
|
|
@@ -173,31 +167,31 @@ export var getBlockMenuComponents = function getBlockMenuComponents(_ref6) {
|
|
|
173
167
|
}
|
|
174
168
|
}, {
|
|
175
169
|
type: 'block-menu-section',
|
|
176
|
-
key:
|
|
177
|
-
rank:
|
|
170
|
+
key: POSITION_MENU_SECTION.key,
|
|
171
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[POSITION_MENU_SECTION.key],
|
|
178
172
|
component: function component(_ref9) {
|
|
179
173
|
var children = _ref9.children;
|
|
180
174
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
181
175
|
hasSeparator: true
|
|
182
176
|
}, children);
|
|
183
177
|
}
|
|
184
|
-
}, {
|
|
178
|
+
}], _toConsumableArray(getMoveUpMoveDownMenuComponents(api)), [{
|
|
185
179
|
type: 'block-menu-section',
|
|
186
180
|
key: DELETE_MENU_SECTION.key,
|
|
187
|
-
rank:
|
|
181
|
+
rank: MAIN_BLOCK_MENU_SECTION_RANK[DELETE_MENU_SECTION.key],
|
|
188
182
|
component: function component(_ref0) {
|
|
189
183
|
var children = _ref0.children;
|
|
190
184
|
return /*#__PURE__*/React.createElement(DeleteSection, {
|
|
191
185
|
api: api
|
|
192
186
|
}, children);
|
|
193
187
|
}
|
|
194
|
-
}
|
|
188
|
+
}, {
|
|
195
189
|
type: 'block-menu-item',
|
|
196
190
|
key: DELETE_MENU_ITEM.key,
|
|
197
191
|
parent: {
|
|
198
192
|
type: 'block-menu-section',
|
|
199
193
|
key: DELETE_MENU_SECTION.key,
|
|
200
|
-
rank:
|
|
194
|
+
rank: DELETE_MENU_SECTION_RANK[DELETE_MENU_ITEM.key]
|
|
201
195
|
},
|
|
202
196
|
component: function component() {
|
|
203
197
|
return /*#__PURE__*/React.createElement(DeleteDropdownItem, {
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -10,12 +10,14 @@ import { BLOCK_MENU_ITEM_NAME } from './consts';
|
|
|
10
10
|
import { copyLink } from './utils/copyLink';
|
|
11
11
|
import { isNestedNode } from './utils/isNestedNode';
|
|
12
12
|
var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
13
|
+
var _api$selection;
|
|
13
14
|
var api = _ref.api,
|
|
14
15
|
config = _ref.config;
|
|
15
16
|
var _useIntl = useIntl(),
|
|
16
17
|
formatMessage = _useIntl.formatMessage;
|
|
17
18
|
var _useBlockMenu = useBlockMenu(),
|
|
18
19
|
onDropdownOpenChanged = _useBlockMenu.onDropdownOpenChanged;
|
|
20
|
+
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
19
21
|
var handleClick = useCallback(function () {
|
|
20
22
|
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
21
23
|
var _api$analytics, _api$blockControls;
|
|
@@ -40,8 +42,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
40
42
|
return copyLink(config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api);
|
|
41
43
|
}, [config === null || config === void 0 ? void 0 : config.getLinkPath, config === null || config === void 0 ? void 0 : config.blockLinkHashPrefix, api, onDropdownOpenChanged]);
|
|
42
44
|
var checkIsNestedNode = useCallback(function () {
|
|
43
|
-
var _api$
|
|
44
|
-
var selection = api === null || api === void 0 || (_api$
|
|
45
|
+
var _api$selection2, _api$blockControls2;
|
|
46
|
+
var selection = api === null || api === void 0 || (_api$selection2 = api.selection) === null || _api$selection2 === void 0 || (_api$selection2 = _api$selection2.sharedState) === null || _api$selection2 === void 0 || (_api$selection2 = _api$selection2.currentState()) === null || _api$selection2 === void 0 ? void 0 : _api$selection2.selection;
|
|
45
47
|
var menuTriggerBy = api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.sharedState) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.currentState()) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.menuTriggerBy;
|
|
46
48
|
if (!selection || !menuTriggerBy) {
|
|
47
49
|
return false;
|
|
@@ -49,8 +51,8 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
|
|
|
49
51
|
return isNestedNode(selection, menuTriggerBy);
|
|
50
52
|
}, [api]);
|
|
51
53
|
|
|
52
|
-
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested
|
|
53
|
-
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode()) {
|
|
54
|
+
// Hide copy link when `platform_editor_adf_with_localid` feature flag is off or when the node is nested or on empty line
|
|
55
|
+
if (!fg('platform_editor_adf_with_localid') || checkIsNestedNode() || !!(selection !== null && selection !== void 0 && selection.empty)) {
|
|
54
56
|
return null;
|
|
55
57
|
}
|
|
56
58
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -3,17 +3,11 @@ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
|
3
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
4
|
import { checkIsFormatMenuHidden } from './utils/checkIsFormatMenuHidden';
|
|
5
5
|
export var CopySection = function CopySection(_ref) {
|
|
6
|
-
var _api$selection;
|
|
7
6
|
var api = _ref.api,
|
|
8
7
|
children = _ref.children;
|
|
9
8
|
var isFormatMenuHidden = useCallback(function () {
|
|
10
9
|
return checkIsFormatMenuHidden(api);
|
|
11
10
|
}, [api]);
|
|
12
|
-
var selection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.sharedState) === null || _api$selection === void 0 || (_api$selection = _api$selection.currentState()) === null || _api$selection === void 0 ? void 0 : _api$selection.selection;
|
|
13
|
-
var isEmptyLineSelected = !!(selection !== null && selection !== void 0 && selection.empty) && expValEqualsNoExposure('platform_editor_block_menu_empty_line', 'isEnabled', true);
|
|
14
|
-
if (isEmptyLineSelected) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
11
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
18
12
|
hasSeparator: expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? true : !isFormatMenuHidden()
|
|
19
13
|
}, children);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.19",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/css": "^0.17.0",
|
|
32
32
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
34
|
-
"@atlaskit/editor-plugin-block-controls": "^7.
|
|
34
|
+
"@atlaskit/editor-plugin-block-controls": "^7.9.0",
|
|
35
35
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-intent": "^4.0.0",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@atlaskit/icon-lab": "^5.12.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
46
|
-
"@atlaskit/primitives": "^16.
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
48
|
-
"@atlaskit/tokens": "^8.
|
|
46
|
+
"@atlaskit/primitives": "^16.4.0",
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^13.44.0",
|
|
48
|
+
"@atlaskit/tokens": "^8.4.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@atlaskit/editor-common": "^110.
|
|
52
|
+
"@atlaskit/editor-common": "^110.35.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
55
55
|
},
|