@atlaskit/editor-plugin-block-type 20.1.5 → 20.1.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,20 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 20.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`68342e8a23fec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/68342e8a23fec) -
8
+ Group text transforms under the renamed Text formatting section in the block menu behind the
9
+ `platform_editor_block_menu_small_text` experiment.
10
+ - Updated dependencies
11
+
12
+ ## 20.1.6
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 20.1.5
4
19
 
5
20
  ### Patch Changes
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
12
  var _editorToolbar = require("@atlaskit/editor-toolbar");
13
13
  var _textParagraph = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-paragraph"));
14
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
14
15
  var NODE_NAME = 'paragraph';
15
16
  var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
16
17
  var api = _ref.api,
@@ -40,7 +41,7 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
40
41
  label: "",
41
42
  size: "small"
42
43
  })
43
- }, formatMessage(_messages.blockMenuMessages.paragraph));
44
+ }, formatMessage((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_menu_small_text') ? _messages.blockMenuMessages.normalText : _messages.blockMenuMessages.paragraph));
44
45
  };
45
46
  var createParagraphBlockMenuItem = exports.createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
46
47
  var api = _ref3.api;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getBlockTypeComponents = void 0;
7
7
  var _blockMenu = require("@atlaskit/editor-common/block-menu");
8
+ var _rank = require("@atlaskit/editor-common/block-menu/rank");
9
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
8
10
  var _HeadingBlockMenuItem = require("./HeadingBlockMenuItem");
9
11
  var _ParagraphBlockMenuItem = require("./ParagraphBlockMenuItem");
10
12
  var _QuoteBlockMenuItem = require("./QuoteBlockMenuItem");
@@ -12,6 +14,8 @@ var HEADING_NODE_NAME = 'heading';
12
14
  var QUOTE_NODE_NAME = 'blockquote';
13
15
  var PARAGRAPH_NODE_NAME = 'paragraph';
14
16
  var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockTypeComponents(api) {
17
+ var isSmallTextExperimentEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_menu_small_text');
18
+ var textFormattingRank = isSmallTextExperimentEnabled ? _rank.TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK : _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK;
15
19
  var isTransformHeadingDisabled = function isTransformHeadingDisabled(level) {
16
20
  var _api$blockMenu;
17
21
  return Boolean(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.isTransformOptionDisabled(HEADING_NODE_NAME, {
@@ -24,7 +28,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
24
28
  parent: {
25
29
  type: 'block-menu-section',
26
30
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
27
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
31
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
28
32
  },
29
33
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
30
34
  level: 1,
@@ -39,7 +43,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
39
43
  parent: {
40
44
  type: 'block-menu-section',
41
45
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
42
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
46
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
43
47
  },
44
48
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
45
49
  level: 2,
@@ -54,7 +58,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
54
58
  parent: {
55
59
  type: 'block-menu-section',
56
60
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
57
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
61
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
58
62
  },
59
63
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
60
64
  level: 3,
@@ -69,7 +73,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
69
73
  parent: {
70
74
  type: 'block-menu-section',
71
75
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
72
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
76
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
73
77
  },
74
78
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
75
79
  level: 4,
@@ -84,7 +88,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
84
88
  parent: {
85
89
  type: 'block-menu-section',
86
90
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
87
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
91
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
88
92
  },
89
93
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
90
94
  level: 5,
@@ -99,7 +103,7 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
99
103
  parent: {
100
104
  type: 'block-menu-section',
101
105
  key: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key,
102
- rank: _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION_RANK[_blockMenu.TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
106
+ rank: textFormattingRank[_blockMenu.TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
103
107
  },
104
108
  component: (0, _HeadingBlockMenuItem.createHeadingBlockMenuItem)({
105
109
  level: 6,
@@ -113,8 +117,8 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
113
117
  key: _blockMenu.TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key,
114
118
  parent: {
115
119
  type: 'block-menu-section',
116
- key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
117
- rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
120
+ key: isSmallTextExperimentEnabled ? _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
121
+ rank: isSmallTextExperimentEnabled ? _rank.TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key] : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
118
122
  },
119
123
  component: (0, _QuoteBlockMenuItem.createQuoteBlockMenuItem)({
120
124
  api: api
@@ -128,8 +132,8 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
128
132
  key: _blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
129
133
  parent: {
130
134
  type: 'block-menu-section',
131
- key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
132
- rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
135
+ key: isSmallTextExperimentEnabled ? _blockMenu.TRANSFORM_HEADINGS_MENU_SECTION.key : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
136
+ rank: isSmallTextExperimentEnabled ? _rank.TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key] : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
133
137
  },
134
138
  component: (0, _ParagraphBlockMenuItem.createParagraphBlockMenuItem)({
135
139
  api: api
@@ -4,6 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
5
5
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
7
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
8
  const NODE_NAME = 'paragraph';
8
9
  const ParagraphBlockMenuItem = ({
9
10
  api,
@@ -36,7 +37,7 @@ const ParagraphBlockMenuItem = ({
36
37
  label: "",
37
38
  size: "small"
38
39
  })
39
- }, formatMessage(blockMenuMessages.paragraph));
40
+ }, formatMessage(isExperimentEnabled('platform_editor_block_menu_small_text') ? blockMenuMessages.normalText : blockMenuMessages.paragraph));
40
41
  };
41
42
  export const createParagraphBlockMenuItem = ({
42
43
  api
@@ -1,4 +1,6 @@
1
- import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
1
+ import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
2
+ import { TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu/rank';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
4
  import { createHeadingBlockMenuItem } from './HeadingBlockMenuItem';
3
5
  import { createParagraphBlockMenuItem } from './ParagraphBlockMenuItem';
4
6
  import { createQuoteBlockMenuItem } from './QuoteBlockMenuItem';
@@ -6,6 +8,8 @@ const HEADING_NODE_NAME = 'heading';
6
8
  const QUOTE_NODE_NAME = 'blockquote';
7
9
  const PARAGRAPH_NODE_NAME = 'paragraph';
8
10
  export const getBlockTypeComponents = api => {
11
+ const isSmallTextExperimentEnabled = isExperimentEnabled('platform_editor_block_menu_small_text');
12
+ const textFormattingRank = isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK : TRANSFORM_HEADINGS_MENU_SECTION_RANK;
9
13
  const isTransformHeadingDisabled = level => {
10
14
  var _api$blockMenu;
11
15
  return Boolean(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.isTransformOptionDisabled(HEADING_NODE_NAME, {
@@ -18,7 +22,7 @@ export const getBlockTypeComponents = api => {
18
22
  parent: {
19
23
  type: 'block-menu-section',
20
24
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
21
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
25
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
22
26
  },
23
27
  component: createHeadingBlockMenuItem({
24
28
  level: 1,
@@ -31,7 +35,7 @@ export const getBlockTypeComponents = api => {
31
35
  parent: {
32
36
  type: 'block-menu-section',
33
37
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
34
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
38
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
35
39
  },
36
40
  component: createHeadingBlockMenuItem({
37
41
  level: 2,
@@ -44,7 +48,7 @@ export const getBlockTypeComponents = api => {
44
48
  parent: {
45
49
  type: 'block-menu-section',
46
50
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
47
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
51
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
48
52
  },
49
53
  component: createHeadingBlockMenuItem({
50
54
  level: 3,
@@ -57,7 +61,7 @@ export const getBlockTypeComponents = api => {
57
61
  parent: {
58
62
  type: 'block-menu-section',
59
63
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
60
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
64
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
61
65
  },
62
66
  component: createHeadingBlockMenuItem({
63
67
  level: 4,
@@ -70,7 +74,7 @@ export const getBlockTypeComponents = api => {
70
74
  parent: {
71
75
  type: 'block-menu-section',
72
76
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
73
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
77
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
74
78
  },
75
79
  component: createHeadingBlockMenuItem({
76
80
  level: 5,
@@ -83,7 +87,7 @@ export const getBlockTypeComponents = api => {
83
87
  parent: {
84
88
  type: 'block-menu-section',
85
89
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
86
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
90
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
87
91
  },
88
92
  component: createHeadingBlockMenuItem({
89
93
  level: 6,
@@ -95,8 +99,8 @@ export const getBlockTypeComponents = api => {
95
99
  key: TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key,
96
100
  parent: {
97
101
  type: 'block-menu-section',
98
- key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
99
- rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
102
+ key: isSmallTextExperimentEnabled ? TRANSFORM_HEADINGS_MENU_SECTION.key : TRANSFORM_STRUCTURE_MENU_SECTION.key,
103
+ rank: isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key] : TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
100
104
  },
101
105
  component: createQuoteBlockMenuItem({
102
106
  api
@@ -110,8 +114,8 @@ export const getBlockTypeComponents = api => {
110
114
  key: TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
111
115
  parent: {
112
116
  type: 'block-menu-section',
113
- key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
114
- rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
117
+ key: isSmallTextExperimentEnabled ? TRANSFORM_HEADINGS_MENU_SECTION.key : TRANSFORM_STRUCTURE_MENU_SECTION.key,
118
+ rank: isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key] : TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
115
119
  },
116
120
  component: createParagraphBlockMenuItem({
117
121
  api
@@ -4,6 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
5
5
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
7
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
8
  var NODE_NAME = 'paragraph';
8
9
  var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
9
10
  var api = _ref.api,
@@ -33,7 +34,7 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
33
34
  label: "",
34
35
  size: "small"
35
36
  })
36
- }, formatMessage(blockMenuMessages.paragraph));
37
+ }, formatMessage(isExperimentEnabled('platform_editor_block_menu_small_text') ? blockMenuMessages.normalText : blockMenuMessages.paragraph));
37
38
  };
38
39
  export var createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
39
40
  var api = _ref3.api;
@@ -1,4 +1,6 @@
1
- import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
1
+ import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
2
+ import { TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu/rank';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
4
  import { createHeadingBlockMenuItem } from './HeadingBlockMenuItem';
3
5
  import { createParagraphBlockMenuItem } from './ParagraphBlockMenuItem';
4
6
  import { createQuoteBlockMenuItem } from './QuoteBlockMenuItem';
@@ -6,6 +8,8 @@ var HEADING_NODE_NAME = 'heading';
6
8
  var QUOTE_NODE_NAME = 'blockquote';
7
9
  var PARAGRAPH_NODE_NAME = 'paragraph';
8
10
  export var getBlockTypeComponents = function getBlockTypeComponents(api) {
11
+ var isSmallTextExperimentEnabled = isExperimentEnabled('platform_editor_block_menu_small_text');
12
+ var textFormattingRank = isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK : TRANSFORM_HEADINGS_MENU_SECTION_RANK;
9
13
  var isTransformHeadingDisabled = function isTransformHeadingDisabled(level) {
10
14
  var _api$blockMenu;
11
15
  return Boolean(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.isTransformOptionDisabled(HEADING_NODE_NAME, {
@@ -18,7 +22,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
18
22
  parent: {
19
23
  type: 'block-menu-section',
20
24
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
21
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
25
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H1_MENU_ITEM.key]
22
26
  },
23
27
  component: createHeadingBlockMenuItem({
24
28
  level: 1,
@@ -33,7 +37,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
33
37
  parent: {
34
38
  type: 'block-menu-section',
35
39
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
36
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
40
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H2_MENU_ITEM.key]
37
41
  },
38
42
  component: createHeadingBlockMenuItem({
39
43
  level: 2,
@@ -48,7 +52,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
48
52
  parent: {
49
53
  type: 'block-menu-section',
50
54
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
51
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
55
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H3_MENU_ITEM.key]
52
56
  },
53
57
  component: createHeadingBlockMenuItem({
54
58
  level: 3,
@@ -63,7 +67,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
63
67
  parent: {
64
68
  type: 'block-menu-section',
65
69
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
66
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
70
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H4_MENU_ITEM.key]
67
71
  },
68
72
  component: createHeadingBlockMenuItem({
69
73
  level: 4,
@@ -78,7 +82,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
78
82
  parent: {
79
83
  type: 'block-menu-section',
80
84
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
81
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
85
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H5_MENU_ITEM.key]
82
86
  },
83
87
  component: createHeadingBlockMenuItem({
84
88
  level: 5,
@@ -93,7 +97,7 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
93
97
  parent: {
94
98
  type: 'block-menu-section',
95
99
  key: TRANSFORM_HEADINGS_MENU_SECTION.key,
96
- rank: TRANSFORM_HEADINGS_MENU_SECTION_RANK[TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
100
+ rank: textFormattingRank[TRANSFORM_HEADINGS_H6_MENU_ITEM.key]
97
101
  },
98
102
  component: createHeadingBlockMenuItem({
99
103
  level: 6,
@@ -107,8 +111,8 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
107
111
  key: TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key,
108
112
  parent: {
109
113
  type: 'block-menu-section',
110
- key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
111
- rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
114
+ key: isSmallTextExperimentEnabled ? TRANSFORM_HEADINGS_MENU_SECTION.key : TRANSFORM_STRUCTURE_MENU_SECTION.key,
115
+ rank: isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key] : TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key]
112
116
  },
113
117
  component: createQuoteBlockMenuItem({
114
118
  api: api
@@ -122,8 +126,8 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
122
126
  key: TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
123
127
  parent: {
124
128
  type: 'block-menu-section',
125
- key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
126
- rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
129
+ key: isSmallTextExperimentEnabled ? TRANSFORM_HEADINGS_MENU_SECTION.key : TRANSFORM_STRUCTURE_MENU_SECTION.key,
130
+ rank: isSmallTextExperimentEnabled ? TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key] : TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
127
131
  },
128
132
  component: createParagraphBlockMenuItem({
129
133
  api: api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "20.1.5",
3
+ "version": "20.1.7",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "atlaskit:src": "src/index.ts",
23
23
  "dependencies": {
24
- "@atlaskit/adf-schema": "^57.2.0",
24
+ "@atlaskit/adf-schema": "^57.3.0",
25
25
  "@atlaskit/css": "^1.1.0",
26
26
  "@atlaskit/editor-plugin-analytics": "^16.1.0",
27
27
  "@atlaskit/editor-plugin-block-menu": "^15.1.0",
@@ -37,20 +37,20 @@
37
37
  "@atlaskit/editor-toolbar": "^2.6.0",
38
38
  "@atlaskit/editor-toolbar-model": "^1.2.0",
39
39
  "@atlaskit/icon": "^37.6.0",
40
- "@atlaskit/icon-lab": "^7.7.0",
40
+ "@atlaskit/icon-lab": "^7.8.0",
41
41
  "@atlaskit/platform-feature-experiments": "^0.3.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.2.0",
43
43
  "@atlaskit/primitives": "^22.5.0",
44
44
  "@atlaskit/prosemirror-history": "^1.2.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^173.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^174.0.0",
47
47
  "@atlaskit/tokens": "^16.11.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@compiled/react": "^1.0.2",
50
50
  "@emotion/react": "^11.7.1"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^120.11.0",
53
+ "@atlaskit/editor-common": "^120.15.0",
54
54
  "react": "^18.2.0 || ^19.2.0",
55
55
  "react-dom": "^18.2.0 || ^19.2.0",
56
56
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"