@atlaskit/editor-plugin-selection-toolbar 5.0.5 → 5.0.7

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,23 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 5.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
8
+ [ux] ED-29120 add a new config option for default editor preset
9
+ (`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
10
+ for editors that can't be excluded at the experiment level.
11
+ - Updated dependencies
12
+
13
+ ## 5.0.6
14
+
15
+ ### Patch Changes
16
+
17
+ - [`0812ff5bd7bd1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0812ff5bd7bd1) -
18
+ Dont render menu sections in live view
19
+ - Updated dependencies
20
+
3
21
  ## 5.0.5
4
22
 
5
23
  ### Patch Changes
@@ -42,7 +42,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
42
42
  config = _ref.config;
43
43
  var __selectionToolbarHandlers = [];
44
44
  var primaryToolbarComponent;
45
- var isToolbarAIFCEnabled = (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
45
+ var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true, {
46
46
  exposure: true
47
47
  });
48
48
  var userPreferencesProvider = config.userPreferencesProvider,
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.MenuSection = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var MenuSection = exports.MenuSection = function MenuSection(_ref) {
12
+ var children = _ref.children,
13
+ api = _ref.api;
14
+ var viewMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
15
+ var isEdit = viewMode === 'edit';
16
+ if (!isEdit) {
17
+ return null;
18
+ }
19
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
20
+ };
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getToolbarComponents = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _toolbar = require("@atlaskit/editor-common/toolbar");
10
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
+ var _MenuSection = require("./MenuSection");
10
12
  var _PinButton = require("./PinButton");
11
13
  var _PinMenuItem = require("./PinMenuItem");
12
14
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, contextualFormattingEnabled) {
@@ -17,7 +19,13 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
17
19
  type: _toolbar.OVERFLOW_MENU.type,
18
20
  key: _toolbar.OVERFLOW_MENU.key,
19
21
  rank: _toolbar.OVERFLOW_MENU_RANK[_toolbar.PIN_MENU_SECTION.key]
20
- }]
22
+ }],
23
+ component: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? function (_ref) {
24
+ var children = _ref.children;
25
+ return /*#__PURE__*/_react.default.createElement(_MenuSection.MenuSection, {
26
+ api: api
27
+ }, children);
28
+ } : undefined
21
29
  }, {
22
30
  type: _toolbar.PIN_MENU_ITEM.type,
23
31
  key: _toolbar.PIN_MENU_ITEM.key,
@@ -32,7 +32,7 @@ export const selectionToolbarPlugin = ({
32
32
  }) => {
33
33
  const __selectionToolbarHandlers = [];
34
34
  let primaryToolbarComponent;
35
- const isToolbarAIFCEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
35
+ const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
36
36
  exposure: true
37
37
  });
38
38
  const {
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export const MenuSection = ({
5
+ children,
6
+ api
7
+ }) => {
8
+ const viewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
9
+ const isEdit = viewMode === 'edit';
10
+ if (!isEdit) {
11
+ return null;
12
+ }
13
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
14
+ };
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { MenuSection } from './MenuSection';
3
5
  import { PinButton } from './PinButton';
4
6
  import { PinMenuItem } from './PinMenuItem';
5
7
  export const getToolbarComponents = (api, contextualFormattingEnabled) => {
@@ -10,7 +12,14 @@ export const getToolbarComponents = (api, contextualFormattingEnabled) => {
10
12
  type: OVERFLOW_MENU.type,
11
13
  key: OVERFLOW_MENU.key,
12
14
  rank: OVERFLOW_MENU_RANK[PIN_MENU_SECTION.key]
13
- }]
15
+ }],
16
+ component: expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? ({
17
+ children
18
+ }) => {
19
+ return /*#__PURE__*/React.createElement(MenuSection, {
20
+ api: api
21
+ }, children);
22
+ } : undefined
14
23
  }, {
15
24
  type: PIN_MENU_ITEM.type,
16
25
  key: PIN_MENU_ITEM.key,
@@ -35,7 +35,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
35
35
  config = _ref.config;
36
36
  var __selectionToolbarHandlers = [];
37
37
  var primaryToolbarComponent;
38
- var isToolbarAIFCEnabled = editorExperiment('platform_editor_toolbar_aifc', true, {
38
+ var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true, {
39
39
  exposure: true
40
40
  });
41
41
  var userPreferencesProvider = config.userPreferencesProvider,
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ export var MenuSection = function MenuSection(_ref) {
5
+ var children = _ref.children,
6
+ api = _ref.api;
7
+ var viewMode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
8
+ var isEdit = viewMode === 'edit';
9
+ if (!isEdit) {
10
+ return null;
11
+ }
12
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
13
+ };
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { OVERFLOW_MENU, OVERFLOW_MENU_RANK, PIN_BUTTON, PIN_GROUP, PIN_MENU_ITEM, PIN_MENU_SECTION, PIN_MENU_SECTION_RANK, PIN_GROUP_RANK, PIN_SECTION, PIN_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { MenuSection } from './MenuSection';
3
5
  import { PinButton } from './PinButton';
4
6
  import { PinMenuItem } from './PinMenuItem';
5
7
  export var getToolbarComponents = function getToolbarComponents(api, contextualFormattingEnabled) {
@@ -10,7 +12,13 @@ export var getToolbarComponents = function getToolbarComponents(api, contextualF
10
12
  type: OVERFLOW_MENU.type,
11
13
  key: OVERFLOW_MENU.key,
12
14
  rank: OVERFLOW_MENU_RANK[PIN_MENU_SECTION.key]
13
- }]
15
+ }],
16
+ component: expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? function (_ref) {
17
+ var children = _ref.children;
18
+ return /*#__PURE__*/React.createElement(MenuSection, {
19
+ api: api
20
+ }, children);
21
+ } : undefined
14
22
  }, {
15
23
  type: PIN_MENU_ITEM.type,
16
24
  key: PIN_MENU_ITEM.key,
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
4
+ type MenuSectionProps = {
5
+ api: ExtractInjectionAPI<SelectionToolbarPlugin> | undefined;
6
+ children: React.ReactNode;
7
+ };
8
+ export declare const MenuSection: ({ children, api }: MenuSectionProps) => React.JSX.Element | null;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { SelectionToolbarPlugin } from '../selectionToolbarPluginType';
4
+ type MenuSectionProps = {
5
+ api: ExtractInjectionAPI<SelectionToolbarPlugin> | undefined;
6
+ children: React.ReactNode;
7
+ };
8
+ export declare const MenuSection: ({ children, api }: MenuSectionProps) => React.JSX.Element | null;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/editor-plugin-connectivity": "^4.0.0",
36
36
  "@atlaskit/editor-plugin-editor-viewmode": "^6.0.0",
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^5.0.0",
38
- "@atlaskit/editor-plugin-toolbar": "^1.1.0",
38
+ "@atlaskit/editor-plugin-toolbar": "^1.2.0",
39
39
  "@atlaskit/editor-plugin-user-intent": "^2.0.0",
40
40
  "@atlaskit/editor-plugin-user-preferences": "^2.0.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -45,13 +45,13 @@
45
45
  "@atlaskit/icon-lab": "^5.7.0",
46
46
  "@atlaskit/menu": "^8.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
- "@atlaskit/tmp-editor-statsig": "^12.6.0",
48
+ "@atlaskit/tmp-editor-statsig": "^12.8.0",
49
49
  "@atlaskit/tokens": "^6.3.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "bind-event-listener": "^3.0.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@atlaskit/editor-common": "^108.5.0",
54
+ "@atlaskit/editor-common": "^108.6.0",
55
55
  "react": "^18.2.0",
56
56
  "react-dom": "^18.2.0",
57
57
  "react-intl-next": "npm:react-intl@^5.18.1"