@atlaskit/editor-plugin-selection-extension 7.2.0 → 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 CHANGED
@@ -1,5 +1,14 @@
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
+
3
12
  ## 7.2.0
4
13
 
5
14
  ### Minor Changes
@@ -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
- }].concat((0, _toConsumableArray2.default)(extensionToolbarComponents), (0, _toConsumableArray2.default)(registerFirstPartyExtensions(api, firstPartyExtensions)), (0, _toConsumableArray2.default)(registerExternalExtensions(api, externalExtensions)));
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,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,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
- }].concat(_toConsumableArray(extensionToolbarComponents), _toConsumableArray(registerFirstPartyExtensions(api, firstPartyExtensions)), _toConsumableArray(registerExternalExtensions(api, externalExtensions)));
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "7.2.0",
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",
@@ -51,14 +51,14 @@
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
53
53
  "@atlaskit/primitives": "^16.4.0",
54
- "@atlaskit/tmp-editor-statsig": "^14.6.0",
54
+ "@atlaskit/tmp-editor-statsig": "^14.8.0",
55
55
  "@babel/runtime": "^7.0.0",
56
56
  "lodash": "^4.17.21",
57
57
  "react-intl-next": "npm:react-intl@^5.18.1",
58
58
  "uuid": "^3.1.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "@atlaskit/editor-common": "^110.38.0",
61
+ "@atlaskit/editor-common": "^110.40.0",
62
62
  "react": "^18.2.0"
63
63
  },
64
64
  "devDependencies": {
@@ -113,6 +113,9 @@
113
113
  },
114
114
  "platform_editor_selection_extension_improvement": {
115
115
  "type": "boolean"
116
+ },
117
+ "platform_editor_toolbar_aifc_overflow_menu_update": {
118
+ "type": "boolean"
116
119
  }
117
120
  }
118
121
  }