@atlaskit/editor-plugin-toolbar 0.4.4 → 0.4.5

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,13 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 0.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4ef462fecb522`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ef462fecb522) -
8
+ [ux] [ED-29003] Register loom component as a dropdown menu item in overflow menu
9
+ - Updated dependencies
10
+
3
11
  ## 0.4.4
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.OverflowSection = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var OverflowSection = exports.OverflowSection = function OverflowSection(_ref) {
12
+ var children = _ref.children,
13
+ hasSeparator = _ref.hasSeparator,
14
+ testId = _ref.testId;
15
+ var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
16
+ editorAppearance = _useEditorToolbar.editorAppearance;
17
+ if (editorAppearance === 'full-page') {
18
+ return null;
19
+ }
20
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarSection, {
21
+ hasSeparator: hasSeparator,
22
+ testId: testId
23
+ }, children);
24
+ };
@@ -8,11 +8,13 @@ exports.getToolbarComponents = 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 _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
12
  var _consts = require("./consts");
12
13
  var _OverflowMenu = require("./OverflowMenu");
14
+ var _OverflowSection = require("./OverflowSection");
13
15
  var _Section = require("./Section");
14
16
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
15
- return [{
17
+ var components = [{
16
18
  type: 'toolbar',
17
19
  key: _toolbar.TOOLBARS.INLINE_TEXT_TOOLBAR,
18
20
  component: function component(_ref) {
@@ -130,4 +132,40 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
130
132
  rank: _toolbar.TOOLBAR_RANK[_toolbar.PIN_SECTION.key]
131
133
  }]
132
134
  }];
135
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true)) {
136
+ components.push({
137
+ type: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
138
+ key: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
139
+ parents: [{
140
+ type: 'toolbar',
141
+ key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
142
+ rank: _toolbar.TOOLBAR_RANK[_toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.key]
143
+ }],
144
+ component: function component(_ref7) {
145
+ var children = _ref7.children;
146
+ return /*#__PURE__*/_react.default.createElement(_OverflowSection.OverflowSection, null, children);
147
+ }
148
+ }, {
149
+ type: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
150
+ key: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
151
+ parents: [{
152
+ type: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
153
+ key: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
154
+ rank: _toolbar.OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK[_toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.key]
155
+ }]
156
+ }, {
157
+ type: _toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
158
+ key: _toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
159
+ parents: [{
160
+ type: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
161
+ key: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
162
+ rank: _toolbar.OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK[_toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.key]
163
+ }],
164
+ component: function component(_ref8) {
165
+ var children = _ref8.children;
166
+ return /*#__PURE__*/_react.default.createElement(_OverflowMenu.OverflowMenu, null, children);
167
+ }
168
+ });
169
+ }
170
+ return components;
133
171
  };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarSection } from '@atlaskit/editor-toolbar';
4
+ export const OverflowSection = ({
5
+ children,
6
+ hasSeparator,
7
+ testId
8
+ }) => {
9
+ const {
10
+ editorAppearance
11
+ } = useEditorToolbar();
12
+ if (editorAppearance === 'full-page') {
13
+ return null;
14
+ }
15
+ return /*#__PURE__*/React.createElement(ToolbarSection, {
16
+ hasSeparator: hasSeparator,
17
+ testId: testId
18
+ }, children);
19
+ };
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
2
+ import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
3
  import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { SELECTION_TOOLBAR_LABEL } from './consts';
5
6
  import { OverflowMenu } from './OverflowMenu';
7
+ import { OverflowSection } from './OverflowSection';
6
8
  import { Section } from './Section';
7
9
  export const getToolbarComponents = (api, disableSelectionToolbar) => {
8
- return [{
10
+ const components = [{
9
11
  type: 'toolbar',
10
12
  key: TOOLBARS.INLINE_TEXT_TOOLBAR,
11
13
  component: ({
@@ -123,4 +125,42 @@ export const getToolbarComponents = (api, disableSelectionToolbar) => {
123
125
  rank: TOOLBAR_RANK[PIN_SECTION.key]
124
126
  }]
125
127
  }];
128
+ if (expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true)) {
129
+ components.push({
130
+ type: OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
131
+ key: OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
132
+ parents: [{
133
+ type: 'toolbar',
134
+ key: TOOLBARS.PRIMARY_TOOLBAR,
135
+ rank: TOOLBAR_RANK[OVERFLOW_SECTION_PRIMARY_TOOLBAR.key]
136
+ }],
137
+ component: ({
138
+ children
139
+ }) => {
140
+ return /*#__PURE__*/React.createElement(OverflowSection, null, children);
141
+ }
142
+ }, {
143
+ type: OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
144
+ key: OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
145
+ parents: [{
146
+ type: OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
147
+ key: OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
148
+ rank: OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK[OVERFLOW_GROUP_PRIMARY_TOOLBAR.key]
149
+ }]
150
+ }, {
151
+ type: OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
152
+ key: OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
153
+ parents: [{
154
+ type: OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
155
+ key: OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
156
+ rank: OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK[OVERFLOW_MENU_PRIMARY_TOOLBAR.key]
157
+ }],
158
+ component: ({
159
+ children
160
+ }) => {
161
+ return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
162
+ }
163
+ });
164
+ }
165
+ return components;
126
166
  };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarSection } from '@atlaskit/editor-toolbar';
4
+ export var OverflowSection = function OverflowSection(_ref) {
5
+ var children = _ref.children,
6
+ hasSeparator = _ref.hasSeparator,
7
+ testId = _ref.testId;
8
+ var _useEditorToolbar = useEditorToolbar(),
9
+ editorAppearance = _useEditorToolbar.editorAppearance;
10
+ if (editorAppearance === 'full-page') {
11
+ return null;
12
+ }
13
+ return /*#__PURE__*/React.createElement(ToolbarSection, {
14
+ hasSeparator: hasSeparator,
15
+ testId: testId
16
+ }, children);
17
+ };
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_SECTION, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
2
+ import { INSERT_BLOCK_SECTION, LINKING_SECTION, OVERFLOW_GROUP, OVERFLOW_GROUP_PRIMARY_TOOLBAR, OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK, OVERFLOW_GROUP_RANK, OVERFLOW_MENU, OVERFLOW_MENU_PRIMARY_TOOLBAR, OVERFLOW_SECTION, OVERFLOW_SECTION_PRIMARY_TOOLBAR, OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK, OVERFLOW_SECTION_RANK, PIN_SECTION, TEXT_SECTION, TOOLBAR_RANK, TOOLBARS } from '@atlaskit/editor-common/toolbar';
3
3
  import { PrimaryToolbar, Toolbar } from '@atlaskit/editor-toolbar';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { SELECTION_TOOLBAR_LABEL } from './consts';
5
6
  import { OverflowMenu } from './OverflowMenu';
7
+ import { OverflowSection } from './OverflowSection';
6
8
  import { Section } from './Section';
7
9
  export var getToolbarComponents = function getToolbarComponents(api, disableSelectionToolbar) {
8
- return [{
10
+ var components = [{
9
11
  type: 'toolbar',
10
12
  key: TOOLBARS.INLINE_TEXT_TOOLBAR,
11
13
  component: function component(_ref) {
@@ -123,4 +125,40 @@ export var getToolbarComponents = function getToolbarComponents(api, disableSele
123
125
  rank: TOOLBAR_RANK[PIN_SECTION.key]
124
126
  }]
125
127
  }];
128
+ if (expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true)) {
129
+ components.push({
130
+ type: OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
131
+ key: OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
132
+ parents: [{
133
+ type: 'toolbar',
134
+ key: TOOLBARS.PRIMARY_TOOLBAR,
135
+ rank: TOOLBAR_RANK[OVERFLOW_SECTION_PRIMARY_TOOLBAR.key]
136
+ }],
137
+ component: function component(_ref7) {
138
+ var children = _ref7.children;
139
+ return /*#__PURE__*/React.createElement(OverflowSection, null, children);
140
+ }
141
+ }, {
142
+ type: OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
143
+ key: OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
144
+ parents: [{
145
+ type: OVERFLOW_SECTION_PRIMARY_TOOLBAR.type,
146
+ key: OVERFLOW_SECTION_PRIMARY_TOOLBAR.key,
147
+ rank: OVERFLOW_SECTION_PRIMARY_TOOLBAR_RANK[OVERFLOW_GROUP_PRIMARY_TOOLBAR.key]
148
+ }]
149
+ }, {
150
+ type: OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
151
+ key: OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
152
+ parents: [{
153
+ type: OVERFLOW_GROUP_PRIMARY_TOOLBAR.type,
154
+ key: OVERFLOW_GROUP_PRIMARY_TOOLBAR.key,
155
+ rank: OVERFLOW_GROUP_PRIMARY_TOOLBAR_RANK[OVERFLOW_MENU_PRIMARY_TOOLBAR.key]
156
+ }],
157
+ component: function component(_ref8) {
158
+ var children = _ref8.children;
159
+ return /*#__PURE__*/React.createElement(OverflowMenu, null, children);
160
+ }
161
+ });
162
+ }
163
+ return components;
126
164
  };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const OverflowSection: ({ children, hasSeparator, testId, }: {
3
+ children: React.ReactNode;
4
+ hasSeparator?: boolean;
5
+ testId?: string;
6
+ }) => React.JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const OverflowSection: ({ children, hasSeparator, testId, }: {
3
+ children: React.ReactNode;
4
+ hasSeparator?: boolean;
5
+ testId?: string;
6
+ }) => React.JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,15 +34,15 @@
34
34
  "@atlaskit/editor-plugin-user-intent": "^1.1.0",
35
35
  "@atlaskit/editor-plugin-user-preferences": "^1.2.0",
36
36
  "@atlaskit/editor-prosemirror": "7.0.0",
37
- "@atlaskit/editor-toolbar": "^0.4.0",
37
+ "@atlaskit/editor-toolbar": "^0.5.0",
38
38
  "@atlaskit/editor-toolbar-model": "^0.1.0",
39
- "@atlaskit/tmp-editor-statsig": "^11.8.0",
39
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "bind-event-listener": "^3.0.0",
42
42
  "react-intl-next": "npm:react-intl@^5.18.1"
43
43
  },
44
44
  "peerDependencies": {
45
- "@atlaskit/editor-common": "^107.32.0",
45
+ "@atlaskit/editor-common": "^107.33.0",
46
46
  "react": "^18.2.0"
47
47
  },
48
48
  "techstack": {