@atlaskit/editor-plugin-selection-extension 7.1.3 → 7.2.1
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 +20 -0
- package/dist/cjs/ui/toolbar-components/MenuItem.js +9 -1
- package/dist/cjs/ui/toolbar-components/register-inline-toolbar.js +2 -1
- package/dist/cjs/ui/toolbar-components.js +39 -2
- package/dist/es2019/ui/toolbar-components/MenuItem.js +9 -1
- package/dist/es2019/ui/toolbar-components/register-inline-toolbar.js +3 -2
- package/dist/es2019/ui/toolbar-components.js +40 -3
- package/dist/esm/ui/toolbar-components/MenuItem.js +9 -1
- package/dist/esm/ui/toolbar-components/register-inline-toolbar.js +3 -2
- package/dist/esm/ui/toolbar-components.js +40 -3
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types-ts4.5/types/index.d.ts +6 -0
- package/package.json +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-extension
|
|
2
2
|
|
|
3
|
+
## 7.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5baa955ebe237`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5baa955ebe237) -
|
|
8
|
+
Add new menu section for all extensions (inc. loom and 1p, 3p extensions), add logic to hide menu
|
|
9
|
+
button completely when there are no menu-sections with no menu-items associated with it
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.2.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [`ed556ceff1790`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed556ceff1790) -
|
|
17
|
+
Update selectionExtension config to accept lozenge in menu button
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 7.1.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -8,6 +8,9 @@ exports.MenuItem = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
+
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
11
14
|
var _main = require("../../pm-plugins/main");
|
|
12
15
|
var _utils = require("../../pm-plugins/utils");
|
|
13
16
|
var _types = require("../../types");
|
|
@@ -53,6 +56,11 @@ var MenuItem = exports.MenuItem = function MenuItem(_ref) {
|
|
|
53
56
|
}),
|
|
54
57
|
onClick: onClickHandle(extension),
|
|
55
58
|
isDisabled: extension.isDisabled
|
|
56
|
-
}, extension.label)
|
|
59
|
+
}, extension.label, extension.lozenge && (0, _platformFeatureFlags.fg)('platform_editor_selection_extension_lozenge') && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
60
|
+
as: "span",
|
|
61
|
+
paddingInline: "space.100"
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
63
|
+
appearance: 'new'
|
|
64
|
+
}, extension.lozenge.label)));
|
|
57
65
|
}));
|
|
58
66
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.registerInlineToolbar = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _MenuItem = require("./MenuItem");
|
|
11
12
|
var _ToolbarButton = require("./ToolbarButton");
|
|
12
13
|
var _ToolbarMenu = require("./ToolbarMenu");
|
|
@@ -99,7 +100,7 @@ var registerInlineToolbar = exports.registerInlineToolbar = function registerInl
|
|
|
99
100
|
parents: [{
|
|
100
101
|
type: 'menu-section',
|
|
101
102
|
// if we have a custom menu, place items in there, otherwise in the overflow menu
|
|
102
|
-
key: getToolbarItem ? menuSectionKey : _toolbar.SELECTION_EXTENSION_MENU_SECTION.key,
|
|
103
|
+
key: getToolbarItem ? menuSectionKey : (0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_overflow_menu_update') ? _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.key : _toolbar.SELECTION_EXTENSION_MENU_SECTION.key,
|
|
103
104
|
rank: (index + 1) * EXTENSION_RANK_MULTIPLIER
|
|
104
105
|
}],
|
|
105
106
|
component: function component() {
|
|
@@ -8,6 +8,7 @@ exports.getToolbarComponents = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _MenuItem = require("./toolbar-components/MenuItem");
|
|
12
13
|
var _registerInlineToolbar = require("./toolbar-components/register-inline-toolbar");
|
|
13
14
|
var _migrateSelectionExtention = require("./utils/migrate-selection-extention");
|
|
@@ -52,7 +53,7 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
52
53
|
key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
|
|
53
54
|
rank: _toolbar.TOOLBAR_RANK[_toolbar.APPS_SECTION.key]
|
|
54
55
|
}]
|
|
55
|
-
},
|
|
56
|
+
}].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_overflow_menu_update') ? [] : [
|
|
56
57
|
// also register a section inside the overflow menu for extensions which only have menu items
|
|
57
58
|
{
|
|
58
59
|
type: _toolbar.SELECTION_EXTENSION_MENU_SECTION.type,
|
|
@@ -62,10 +63,28 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
|
|
|
62
63
|
type: _toolbar.OVERFLOW_MENU.type,
|
|
63
64
|
rank: _toolbar.OVERFLOW_MENU_RANK[_toolbar.SELECTION_EXTENSION_MENU_SECTION.key]
|
|
64
65
|
}]
|
|
65
|
-
}]
|
|
66
|
+
}]), (0, _toConsumableArray2.default)(extensionToolbarComponents), (0, _toConsumableArray2.default)(registerFirstPartyExtensions(api, firstPartyExtensions)), (0, _toConsumableArray2.default)(registerExternalExtensions(api, externalExtensions)));
|
|
66
67
|
};
|
|
67
68
|
var registerFirstPartyExtensions = function registerFirstPartyExtensions(api, extensions) {
|
|
68
69
|
var components = [];
|
|
70
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
71
|
+
components.push({
|
|
72
|
+
type: _toolbar.FIRST_PARTY_EXTENSIONS_MENU_ITEM.type,
|
|
73
|
+
key: _toolbar.FIRST_PARTY_EXTENSIONS_MENU_ITEM.key,
|
|
74
|
+
parents: [{
|
|
75
|
+
type: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
76
|
+
key: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
77
|
+
rank: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[_toolbar.FIRST_PARTY_EXTENSIONS_MENU_ITEM.key]
|
|
78
|
+
}],
|
|
79
|
+
component: function component() {
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, {
|
|
81
|
+
api: api,
|
|
82
|
+
extensionMenuItems: extensions
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return components;
|
|
87
|
+
}
|
|
69
88
|
components.push({
|
|
70
89
|
type: 'menu-item',
|
|
71
90
|
key: 'first-party-extensions-menu-item',
|
|
@@ -85,6 +104,24 @@ var registerFirstPartyExtensions = function registerFirstPartyExtensions(api, ex
|
|
|
85
104
|
};
|
|
86
105
|
var registerExternalExtensions = function registerExternalExtensions(api, extensions) {
|
|
87
106
|
var components = [];
|
|
107
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
108
|
+
components.push({
|
|
109
|
+
type: _toolbar.EXTERNAL_EXTENSIONS_MENU_ITEM.type,
|
|
110
|
+
key: _toolbar.EXTERNAL_EXTENSIONS_MENU_ITEM.key,
|
|
111
|
+
parents: [{
|
|
112
|
+
type: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
113
|
+
key: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
114
|
+
rank: _toolbar.OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[_toolbar.EXTERNAL_EXTENSIONS_MENU_ITEM.key]
|
|
115
|
+
}],
|
|
116
|
+
component: function component() {
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, {
|
|
118
|
+
api: api,
|
|
119
|
+
extensionMenuItems: extensions
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return components;
|
|
124
|
+
}
|
|
88
125
|
components.push({
|
|
89
126
|
type: 'menu-item',
|
|
90
127
|
key: 'external-extensions-menu-item',
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
4
7
|
import { selectionExtensionPluginKey } from '../../pm-plugins/main';
|
|
5
8
|
import { getSelectionAdfInfoNew, getSelectionTextInfo } from '../../pm-plugins/utils';
|
|
6
9
|
import { SelectionExtensionActionTypes } from '../../types';
|
|
@@ -48,6 +51,11 @@ export const MenuItem = ({
|
|
|
48
51
|
}),
|
|
49
52
|
onClick: onClickHandle(extension),
|
|
50
53
|
isDisabled: extension.isDisabled
|
|
51
|
-
}, extension.label)
|
|
54
|
+
}, extension.label, extension.lozenge && fg('platform_editor_selection_extension_lozenge') && /*#__PURE__*/React.createElement(Box, {
|
|
55
|
+
as: "span",
|
|
56
|
+
paddingInline: "space.100"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Lozenge, {
|
|
58
|
+
appearance: 'new'
|
|
59
|
+
}, extension.lozenge.label)));
|
|
52
60
|
}));
|
|
53
61
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SELECTION_EXTENSION_MENU_SECTION, APPS_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { SELECTION_EXTENSION_MENU_SECTION, APPS_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { MenuItem } from './MenuItem';
|
|
4
5
|
import { ToolbarButton } from './ToolbarButton';
|
|
5
6
|
import { ToolbarMenu } from './ToolbarMenu';
|
|
@@ -95,7 +96,7 @@ export const registerInlineToolbar = ({
|
|
|
95
96
|
parents: [{
|
|
96
97
|
type: 'menu-section',
|
|
97
98
|
// if we have a custom menu, place items in there, otherwise in the overflow menu
|
|
98
|
-
key: getToolbarItem ? menuSectionKey : SELECTION_EXTENSION_MENU_SECTION.key,
|
|
99
|
+
key: getToolbarItem ? menuSectionKey : fg('platform_editor_toolbar_aifc_overflow_menu_update') ? OVERFLOW_EXTENSIONS_MENU_SECTION.key : SELECTION_EXTENSION_MENU_SECTION.key,
|
|
99
100
|
rank: (index + 1) * EXTENSION_RANK_MULTIPLIER
|
|
100
101
|
}],
|
|
101
102
|
component: () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { APPS_SECTION, OVERFLOW_MENU, OVERFLOW_MENU_RANK, SELECTION_EXTENSION_MENU_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { APPS_SECTION, EXTERNAL_EXTENSIONS_MENU_ITEM, FIRST_PARTY_EXTENSIONS_MENU_ITEM, OVERFLOW_EXTENSIONS_MENU_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION_RANK, OVERFLOW_MENU, OVERFLOW_MENU_RANK, SELECTION_EXTENSION_MENU_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { MenuItem } from './toolbar-components/MenuItem';
|
|
4
5
|
import { registerInlineToolbar } from './toolbar-components/register-inline-toolbar';
|
|
5
6
|
import { migrateSelectionExtensionToMenuItem } from './utils/migrate-selection-extention';
|
|
@@ -35,7 +36,7 @@ export const getToolbarComponents = ({
|
|
|
35
36
|
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
36
37
|
rank: TOOLBAR_RANK[APPS_SECTION.key]
|
|
37
38
|
}]
|
|
38
|
-
},
|
|
39
|
+
}, ...(fg('platform_editor_toolbar_aifc_overflow_menu_update') ? [] : [
|
|
39
40
|
// also register a section inside the overflow menu for extensions which only have menu items
|
|
40
41
|
{
|
|
41
42
|
type: SELECTION_EXTENSION_MENU_SECTION.type,
|
|
@@ -45,10 +46,28 @@ export const getToolbarComponents = ({
|
|
|
45
46
|
type: OVERFLOW_MENU.type,
|
|
46
47
|
rank: OVERFLOW_MENU_RANK[SELECTION_EXTENSION_MENU_SECTION.key]
|
|
47
48
|
}]
|
|
48
|
-
}, ...extensionToolbarComponents, ...registerFirstPartyExtensions(api, firstPartyExtensions), ...registerExternalExtensions(api, externalExtensions)];
|
|
49
|
+
}]), ...extensionToolbarComponents, ...registerFirstPartyExtensions(api, firstPartyExtensions), ...registerExternalExtensions(api, externalExtensions)];
|
|
49
50
|
};
|
|
50
51
|
const registerFirstPartyExtensions = (api, extensions) => {
|
|
51
52
|
const components = [];
|
|
53
|
+
if (fg('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
54
|
+
components.push({
|
|
55
|
+
type: FIRST_PARTY_EXTENSIONS_MENU_ITEM.type,
|
|
56
|
+
key: FIRST_PARTY_EXTENSIONS_MENU_ITEM.key,
|
|
57
|
+
parents: [{
|
|
58
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
59
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
60
|
+
rank: OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[FIRST_PARTY_EXTENSIONS_MENU_ITEM.key]
|
|
61
|
+
}],
|
|
62
|
+
component: () => {
|
|
63
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
64
|
+
api: api,
|
|
65
|
+
extensionMenuItems: extensions
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return components;
|
|
70
|
+
}
|
|
52
71
|
components.push({
|
|
53
72
|
type: 'menu-item',
|
|
54
73
|
key: 'first-party-extensions-menu-item',
|
|
@@ -68,6 +87,24 @@ const registerFirstPartyExtensions = (api, extensions) => {
|
|
|
68
87
|
};
|
|
69
88
|
const registerExternalExtensions = (api, extensions) => {
|
|
70
89
|
const components = [];
|
|
90
|
+
if (fg('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
91
|
+
components.push({
|
|
92
|
+
type: EXTERNAL_EXTENSIONS_MENU_ITEM.type,
|
|
93
|
+
key: EXTERNAL_EXTENSIONS_MENU_ITEM.key,
|
|
94
|
+
parents: [{
|
|
95
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
96
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
97
|
+
rank: OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[EXTERNAL_EXTENSIONS_MENU_ITEM.key]
|
|
98
|
+
}],
|
|
99
|
+
component: () => {
|
|
100
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
101
|
+
api: api,
|
|
102
|
+
extensionMenuItems: extensions
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return components;
|
|
107
|
+
}
|
|
71
108
|
components.push({
|
|
72
109
|
type: 'menu-item',
|
|
73
110
|
key: 'external-extensions-menu-item',
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
3
3
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
4
7
|
import { selectionExtensionPluginKey } from '../../pm-plugins/main';
|
|
5
8
|
import { getSelectionAdfInfoNew, getSelectionTextInfo } from '../../pm-plugins/utils';
|
|
6
9
|
import { SelectionExtensionActionTypes } from '../../types';
|
|
@@ -46,6 +49,11 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
46
49
|
}),
|
|
47
50
|
onClick: onClickHandle(extension),
|
|
48
51
|
isDisabled: extension.isDisabled
|
|
49
|
-
}, extension.label)
|
|
52
|
+
}, extension.label, extension.lozenge && fg('platform_editor_selection_extension_lozenge') && /*#__PURE__*/React.createElement(Box, {
|
|
53
|
+
as: "span",
|
|
54
|
+
paddingInline: "space.100"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Lozenge, {
|
|
56
|
+
appearance: 'new'
|
|
57
|
+
}, extension.lozenge.label)));
|
|
50
58
|
}));
|
|
51
59
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SELECTION_EXTENSION_MENU_SECTION, APPS_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
2
|
+
import { SELECTION_EXTENSION_MENU_SECTION, APPS_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { MenuItem } from './MenuItem';
|
|
4
5
|
import { ToolbarButton } from './ToolbarButton';
|
|
5
6
|
import { ToolbarMenu } from './ToolbarMenu';
|
|
@@ -92,7 +93,7 @@ export var registerInlineToolbar = function registerInlineToolbar(_ref) {
|
|
|
92
93
|
parents: [{
|
|
93
94
|
type: 'menu-section',
|
|
94
95
|
// if we have a custom menu, place items in there, otherwise in the overflow menu
|
|
95
|
-
key: getToolbarItem ? menuSectionKey : SELECTION_EXTENSION_MENU_SECTION.key,
|
|
96
|
+
key: getToolbarItem ? menuSectionKey : fg('platform_editor_toolbar_aifc_overflow_menu_update') ? OVERFLOW_EXTENSIONS_MENU_SECTION.key : SELECTION_EXTENSION_MENU_SECTION.key,
|
|
96
97
|
rank: (index + 1) * EXTENSION_RANK_MULTIPLIER
|
|
97
98
|
}],
|
|
98
99
|
component: function component() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { APPS_SECTION, OVERFLOW_MENU, OVERFLOW_MENU_RANK, SELECTION_EXTENSION_MENU_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { APPS_SECTION, EXTERNAL_EXTENSIONS_MENU_ITEM, FIRST_PARTY_EXTENSIONS_MENU_ITEM, OVERFLOW_EXTENSIONS_MENU_SECTION, OVERFLOW_EXTENSIONS_MENU_SECTION_RANK, OVERFLOW_MENU, OVERFLOW_MENU_RANK, SELECTION_EXTENSION_MENU_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { MenuItem } from './toolbar-components/MenuItem';
|
|
5
6
|
import { registerInlineToolbar } from './toolbar-components/register-inline-toolbar';
|
|
6
7
|
import { migrateSelectionExtensionToMenuItem } from './utils/migrate-selection-extention';
|
|
@@ -45,7 +46,7 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
45
46
|
key: TOOLBARS.PRIMARY_TOOLBAR,
|
|
46
47
|
rank: TOOLBAR_RANK[APPS_SECTION.key]
|
|
47
48
|
}]
|
|
48
|
-
}
|
|
49
|
+
}].concat(_toConsumableArray(fg('platform_editor_toolbar_aifc_overflow_menu_update') ? [] : [
|
|
49
50
|
// also register a section inside the overflow menu for extensions which only have menu items
|
|
50
51
|
{
|
|
51
52
|
type: SELECTION_EXTENSION_MENU_SECTION.type,
|
|
@@ -55,10 +56,28 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
55
56
|
type: OVERFLOW_MENU.type,
|
|
56
57
|
rank: OVERFLOW_MENU_RANK[SELECTION_EXTENSION_MENU_SECTION.key]
|
|
57
58
|
}]
|
|
58
|
-
}]
|
|
59
|
+
}]), _toConsumableArray(extensionToolbarComponents), _toConsumableArray(registerFirstPartyExtensions(api, firstPartyExtensions)), _toConsumableArray(registerExternalExtensions(api, externalExtensions)));
|
|
59
60
|
};
|
|
60
61
|
var registerFirstPartyExtensions = function registerFirstPartyExtensions(api, extensions) {
|
|
61
62
|
var components = [];
|
|
63
|
+
if (fg('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
64
|
+
components.push({
|
|
65
|
+
type: FIRST_PARTY_EXTENSIONS_MENU_ITEM.type,
|
|
66
|
+
key: FIRST_PARTY_EXTENSIONS_MENU_ITEM.key,
|
|
67
|
+
parents: [{
|
|
68
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
69
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
70
|
+
rank: OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[FIRST_PARTY_EXTENSIONS_MENU_ITEM.key]
|
|
71
|
+
}],
|
|
72
|
+
component: function component() {
|
|
73
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
74
|
+
api: api,
|
|
75
|
+
extensionMenuItems: extensions
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return components;
|
|
80
|
+
}
|
|
62
81
|
components.push({
|
|
63
82
|
type: 'menu-item',
|
|
64
83
|
key: 'first-party-extensions-menu-item',
|
|
@@ -78,6 +97,24 @@ var registerFirstPartyExtensions = function registerFirstPartyExtensions(api, ex
|
|
|
78
97
|
};
|
|
79
98
|
var registerExternalExtensions = function registerExternalExtensions(api, extensions) {
|
|
80
99
|
var components = [];
|
|
100
|
+
if (fg('platform_editor_toolbar_aifc_overflow_menu_update')) {
|
|
101
|
+
components.push({
|
|
102
|
+
type: EXTERNAL_EXTENSIONS_MENU_ITEM.type,
|
|
103
|
+
key: EXTERNAL_EXTENSIONS_MENU_ITEM.key,
|
|
104
|
+
parents: [{
|
|
105
|
+
type: OVERFLOW_EXTENSIONS_MENU_SECTION.type,
|
|
106
|
+
key: OVERFLOW_EXTENSIONS_MENU_SECTION.key,
|
|
107
|
+
rank: OVERFLOW_EXTENSIONS_MENU_SECTION_RANK[EXTERNAL_EXTENSIONS_MENU_ITEM.key]
|
|
108
|
+
}],
|
|
109
|
+
component: function component() {
|
|
110
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
111
|
+
api: api,
|
|
112
|
+
extensionMenuItems: extensions
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return components;
|
|
117
|
+
}
|
|
81
118
|
components.push({
|
|
82
119
|
type: 'menu-item',
|
|
83
120
|
key: 'external-extensions-menu-item',
|
|
@@ -155,6 +155,12 @@ export type ExtensionMenuItemConfiguration = {
|
|
|
155
155
|
}>>;
|
|
156
156
|
isDisabled?: boolean;
|
|
157
157
|
label: string;
|
|
158
|
+
/**
|
|
159
|
+
* Optional lozenge to display next to the label in the menu
|
|
160
|
+
*/
|
|
161
|
+
lozenge?: {
|
|
162
|
+
label: string;
|
|
163
|
+
};
|
|
158
164
|
onClick?: () => void;
|
|
159
165
|
/**
|
|
160
166
|
* Optional menu-section to declare grouping - only used for menu items
|
|
@@ -155,6 +155,12 @@ export type ExtensionMenuItemConfiguration = {
|
|
|
155
155
|
}>>;
|
|
156
156
|
isDisabled?: boolean;
|
|
157
157
|
label: string;
|
|
158
|
+
/**
|
|
159
|
+
* Optional lozenge to display next to the label in the menu
|
|
160
|
+
*/
|
|
161
|
+
lozenge?: {
|
|
162
|
+
label: string;
|
|
163
|
+
};
|
|
158
164
|
onClick?: () => void;
|
|
159
165
|
/**
|
|
160
166
|
* Optional menu-section to declare grouping - only used for menu items
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,16 +47,18 @@
|
|
|
47
47
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
48
48
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
49
49
|
"@atlaskit/icon": "^29.0.0",
|
|
50
|
+
"@atlaskit/lozenge": "^13.1.0",
|
|
50
51
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
52
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
52
|
-
"@atlaskit/
|
|
53
|
+
"@atlaskit/primitives": "^16.4.0",
|
|
54
|
+
"@atlaskit/tmp-editor-statsig": "^14.8.0",
|
|
53
55
|
"@babel/runtime": "^7.0.0",
|
|
54
56
|
"lodash": "^4.17.21",
|
|
55
57
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
56
58
|
"uuid": "^3.1.0"
|
|
57
59
|
},
|
|
58
60
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^110.
|
|
61
|
+
"@atlaskit/editor-common": "^110.40.0",
|
|
60
62
|
"react": "^18.2.0"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
@@ -106,8 +108,14 @@
|
|
|
106
108
|
"platform_editor_use_preferences_plugin": {
|
|
107
109
|
"type": "boolean"
|
|
108
110
|
},
|
|
111
|
+
"platform_editor_selection_extension_lozenge": {
|
|
112
|
+
"type": "boolean"
|
|
113
|
+
},
|
|
109
114
|
"platform_editor_selection_extension_improvement": {
|
|
110
115
|
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
"platform_editor_toolbar_aifc_overflow_menu_update": {
|
|
118
|
+
"type": "boolean"
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
}
|