@wordpress/block-editor 8.0.2 → 8.0.6

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.
Files changed (58) hide show
  1. package/build/components/block-preview/auto.js +1 -0
  2. package/build/components/block-preview/auto.js.map +1 -1
  3. package/build/components/colors/with-colors.js +6 -4
  4. package/build/components/colors/with-colors.js.map +1 -1
  5. package/build/components/colors-gradients/control.js +4 -2
  6. package/build/components/colors-gradients/control.js.map +1 -1
  7. package/build/components/colors-gradients/panel-color-gradient-settings.js +29 -25
  8. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  9. package/build/components/gradients/use-gradient.js +7 -6
  10. package/build/components/gradients/use-gradient.js.map +1 -1
  11. package/build/components/use-setting/index.js +1 -1
  12. package/build/components/use-setting/index.js.map +1 -1
  13. package/build/hooks/color.js +29 -21
  14. package/build/hooks/color.js.map +1 -1
  15. package/build/hooks/typography.js +3 -0
  16. package/build/hooks/typography.js.map +1 -1
  17. package/build/hooks/use-color-props.js +13 -4
  18. package/build/hooks/use-color-props.js.map +1 -1
  19. package/build/store/selectors.js +37 -43
  20. package/build/store/selectors.js.map +1 -1
  21. package/build-module/components/block-preview/auto.js +1 -0
  22. package/build-module/components/block-preview/auto.js.map +1 -1
  23. package/build-module/components/colors/with-colors.js +6 -4
  24. package/build-module/components/colors/with-colors.js.map +1 -1
  25. package/build-module/components/colors-gradients/control.js +4 -2
  26. package/build-module/components/colors-gradients/control.js.map +1 -1
  27. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +30 -26
  28. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  29. package/build-module/components/gradients/use-gradient.js +8 -6
  30. package/build-module/components/gradients/use-gradient.js.map +1 -1
  31. package/build-module/components/use-setting/index.js +1 -1
  32. package/build-module/components/use-setting/index.js.map +1 -1
  33. package/build-module/hooks/color.js +30 -22
  34. package/build-module/hooks/color.js.map +1 -1
  35. package/build-module/hooks/typography.js +1 -2
  36. package/build-module/hooks/typography.js.map +1 -1
  37. package/build-module/hooks/use-color-props.js +11 -3
  38. package/build-module/hooks/use-color-props.js.map +1 -1
  39. package/build-module/store/selectors.js +37 -43
  40. package/build-module/store/selectors.js.map +1 -1
  41. package/build-style/style-rtl.css +72 -68
  42. package/build-style/style.css +72 -68
  43. package/package.json +3 -3
  44. package/src/components/block-list-appender/style.scss +0 -42
  45. package/src/components/block-preview/auto.js +3 -0
  46. package/src/components/block-preview/style.scss +5 -0
  47. package/src/components/button-block-appender/style.scss +0 -17
  48. package/src/components/colors/with-colors.js +11 -5
  49. package/src/components/colors-gradients/control.js +2 -0
  50. package/src/components/colors-gradients/panel-color-gradient-settings.js +58 -25
  51. package/src/components/default-block-appender/style.scss +90 -16
  52. package/src/components/gradients/use-gradient.js +16 -7
  53. package/src/components/inner-blocks/style.scss +4 -10
  54. package/src/components/use-setting/index.js +2 -2
  55. package/src/hooks/color.js +58 -26
  56. package/src/hooks/typography.js +1 -1
  57. package/src/hooks/use-color-props.js +23 -4
  58. package/src/store/selectors.js +14 -26
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Default block appender.
3
+ *
4
+ * This component shows up in 3 places:
5
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
6
+ * - on the right, inside empty paragraphs
7
+ * - absolute positioned and blue inside nesting containers
8
+ */
9
+
1
10
  .block-editor-default-block-appender {
2
11
  clear: both; // The appender doesn't scale well to sit next to floats, so clear them.
3
12
 
@@ -23,32 +32,97 @@
23
32
  }
24
33
  }
25
34
 
26
- // Empty / default block side inserter.
27
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter, // Empty paragraph, needs specificity to override inherited popover styles.
28
- .block-editor-default-block-appender .block-editor-inserter { // Empty appender.
35
+ // The black plus that shows up on the right side of an empty paragraph block, or the initial appender
36
+ // that exists only on empty documents.
37
+ .block-editor-default-block-appender .block-editor-inserter,
38
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter { // This needs specificity to override inherited popover styles.
29
39
  position: absolute;
30
40
  top: 0;
31
- height: $button-size-small + $grid-unit-10;
41
+ right: 0;
42
+ line-height: 0;
32
43
 
33
- .block-editor-inserter__toggle {
34
- margin-right: 0;
44
+ &:disabled {
45
+ display: none;
35
46
  }
36
47
  }
37
48
 
38
- // Left side.
39
- .block-editor-block-list__empty-block-inserter,
40
- .block-editor-default-block-appender .block-editor-inserter {
41
- @include break-small {
42
- display: flex;
43
- height: 100%;
49
+
50
+ /**
51
+ * Fixed position appender.
52
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
53
+ */
54
+
55
+ .block-editor-block-list__block .block-list-appender {
56
+ position: absolute;
57
+ list-style: none;
58
+ padding: 0;
59
+ z-index: z-index(".block-editor-block-list__block .block-list-appender");
60
+ bottom: 0;
61
+ right: 0;
62
+
63
+ // These rules needs extra specificity as it's affected by DOM rules.
64
+ &.block-list-appender {
65
+ margin: 0;
66
+ line-height: 0;
44
67
  }
45
68
 
46
- &:disabled {
69
+ .block-editor-default-block-appender {
70
+ height: $button-size-small;
71
+ }
72
+
73
+ // @todo: these are currently two separate components. Since we're now
74
+ // treating them the same, one or both can be retired.
75
+ .block-editor-inserter__toggle.components-button.has-icon,
76
+ .block-list-appender__toggle {
77
+ flex-direction: row;
78
+ box-shadow: none;
79
+ height: $button-size-small;
80
+ width: $button-size-small;
81
+
82
+ // Hide by default, then we unhide it when the selected block is a direct ancestor.
83
+ display: none;
84
+
85
+ // Important to override styles form Button component.
86
+ padding: 0 !important;
87
+
88
+ // Basic look
89
+ background: $gray-900;
90
+ color: $white;
91
+
92
+ &:hover {
93
+ color: $white;
94
+ background: var(--wp-admin-theme-color);
95
+ }
96
+ }
97
+
98
+ // This content only shows up inside the empty appender.
99
+ .block-editor-default-block-appender__content {
47
100
  display: none;
48
101
  }
102
+
103
+ // These could be avoided by employing a :not(:only-child) on the parent,
104
+ // but this should be more performant.
105
+ // @todo: These styles can almost certainly be refactored away we refactor
106
+ // the markup and classes of the component itself. The rules provide some
107
+ // baseline styles for when the block is the only one inside.
108
+ &:only-child {
109
+ position: relative;
110
+ right: auto;
111
+ align-self: center;
112
+ list-style: none;
113
+ line-height: inherit;
114
+
115
+ .block-editor-default-block-appender__content {
116
+ display: block;
117
+ }
118
+ }
49
119
  }
50
120
 
51
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
52
- .block-editor-block-list__empty-block-inserter {
53
- right: 0;
121
+ // Unhide the inserter when you're in the exact container.
122
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender,
123
+ .block-editor-block-list__block.is-selected > .block-list-appender {
124
+ .block-editor-inserter__toggle.components-button.has-icon,
125
+ .block-list-appender__toggle {
126
+ display: flex;
127
+ }
54
128
  }
@@ -6,7 +6,7 @@ import { find } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useCallback } from '@wordpress/element';
9
+ import { useCallback, useMemo } from '@wordpress/element';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
11
 
12
12
  /**
@@ -16,8 +16,6 @@ import { useBlockEditContext } from '../block-edit';
16
16
  import useSetting from '../use-setting';
17
17
  import { store as blockEditorStore } from '../../store';
18
18
 
19
- const EMPTY_ARRAY = [];
20
-
21
19
  export function __experimentalGetGradientClass( gradientSlug ) {
22
20
  if ( ! gradientSlug ) {
23
21
  return undefined;
@@ -67,7 +65,15 @@ export function __experimentalUseGradient( {
67
65
  } = {} ) {
68
66
  const { clientId } = useBlockEditContext();
69
67
 
70
- const gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;
68
+ const { gradients: gradientsPerOrigin } = useSetting( 'color' ) || {};
69
+ const allGradients = useMemo(
70
+ () => [
71
+ ...( gradientsPerOrigin?.custom || [] ),
72
+ ...( gradientsPerOrigin?.theme || [] ),
73
+ ...( gradientsPerOrigin?.default || [] ),
74
+ ],
75
+ [ gradientsPerOrigin ]
76
+ );
71
77
  const { gradient, customGradient } = useSelect(
72
78
  ( select ) => {
73
79
  const { getBlockAttributes } = select( blockEditorStore );
@@ -83,7 +89,10 @@ export function __experimentalUseGradient( {
83
89
  const { updateBlockAttributes } = useDispatch( blockEditorStore );
84
90
  const setGradient = useCallback(
85
91
  ( newGradientValue ) => {
86
- const slug = getGradientSlugByValue( gradients, newGradientValue );
92
+ const slug = getGradientSlugByValue(
93
+ allGradients,
94
+ newGradientValue
95
+ );
87
96
  if ( slug ) {
88
97
  updateBlockAttributes( clientId, {
89
98
  [ gradientAttribute ]: slug,
@@ -96,13 +105,13 @@ export function __experimentalUseGradient( {
96
105
  [ customGradientAttribute ]: newGradientValue,
97
106
  } );
98
107
  },
99
- [ gradients, clientId, updateBlockAttributes ]
108
+ [ allGradients, clientId, updateBlockAttributes ]
100
109
  );
101
110
 
102
111
  const gradientClass = __experimentalGetGradientClass( gradient );
103
112
  let gradientValue;
104
113
  if ( gradient ) {
105
- gradientValue = getGradientValueBySlug( gradients, gradient );
114
+ gradientValue = getGradientValueBySlug( allGradients, gradient );
106
115
  } else {
107
116
  gradientValue = customGradient;
108
117
  }
@@ -4,16 +4,10 @@
4
4
  &::after {
5
5
  content: "";
6
6
  position: absolute;
7
- top: -$block-padding;
8
- right: -$block-padding;
9
- bottom: -$block-padding;
10
- left: -$block-padding;
7
+ top: 0;
8
+ right: 0;
9
+ bottom: 0;
10
+ left: 0;
11
11
  z-index: z-index(".block-editor-block-list__layout.has-overlay::after");
12
12
  }
13
13
  }
14
-
15
- // On fullwide blocks, don't go beyond the canvas.
16
- [data-align="full"] .has-overlay::after {
17
- right: 0;
18
- left: 0;
19
- }
@@ -117,9 +117,9 @@ export default function useSetting( path ) {
117
117
  if ( experimentalFeaturesResult !== undefined ) {
118
118
  if ( PATHS_WITH_MERGE[ normalizedPath ] ) {
119
119
  return (
120
- experimentalFeaturesResult.user ??
120
+ experimentalFeaturesResult.custom ??
121
121
  experimentalFeaturesResult.theme ??
122
- experimentalFeaturesResult.core
122
+ experimentalFeaturesResult.default
123
123
  );
124
124
  }
125
125
  return experimentalFeaturesResult;
@@ -10,7 +10,7 @@ import { isObject, setWith, clone } from 'lodash';
10
10
  import { addFilter } from '@wordpress/hooks';
11
11
  import { getBlockSupport } from '@wordpress/blocks';
12
12
  import { __ } from '@wordpress/i18n';
13
- import { useRef, useEffect, Platform } from '@wordpress/element';
13
+ import { useRef, useEffect, useMemo, Platform } from '@wordpress/element';
14
14
  import { createHigherOrderComponent } from '@wordpress/compose';
15
15
 
16
16
  /**
@@ -31,7 +31,6 @@ import ColorPanel from './color-panel';
31
31
  import useSetting from '../components/use-setting';
32
32
 
33
33
  export const COLOR_SUPPORT_KEY = 'color';
34
- const EMPTY_ARRAY = [];
35
34
 
36
35
  const hasColorSupport = ( blockType ) => {
37
36
  const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
@@ -217,13 +216,43 @@ function immutableSet( object, path, value ) {
217
216
  */
218
217
  export function ColorEdit( props ) {
219
218
  const { name: blockName, attributes } = props;
220
- const solids = useSetting( 'color.palette' ) || EMPTY_ARRAY;
221
- const gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;
222
- const areCustomSolidsEnabled = useSetting( 'color.custom' );
223
- const areCustomGradientsEnabled = useSetting( 'color.customGradient' );
224
- const isLinkEnabled = useSetting( 'color.link' );
225
- const isTextEnabled = useSetting( 'color.text' );
226
- const isBackgroundEnabled = useSetting( 'color.background' );
219
+ const {
220
+ palette: solidsPerOrigin,
221
+ gradients: gradientsPerOrigin,
222
+ customGradient: areCustomGradientsEnabled,
223
+ custom: areCustomSolidsEnabled,
224
+ text: isTextEnabled,
225
+ background: isBackgroundEnabled,
226
+ link: isLinkEnabled,
227
+ } = useSetting( 'color' ) || {};
228
+
229
+ const solidsEnabled =
230
+ areCustomSolidsEnabled ||
231
+ ! solidsPerOrigin?.theme ||
232
+ solidsPerOrigin?.theme?.length > 0;
233
+
234
+ const gradientsEnabled =
235
+ areCustomGradientsEnabled ||
236
+ ! gradientsPerOrigin?.theme ||
237
+ gradientsPerOrigin?.theme?.length > 0;
238
+
239
+ const allSolids = useMemo(
240
+ () => [
241
+ ...( solidsPerOrigin?.custom || [] ),
242
+ ...( solidsPerOrigin?.theme || [] ),
243
+ ...( solidsPerOrigin?.default || [] ),
244
+ ],
245
+ [ solidsPerOrigin ]
246
+ );
247
+
248
+ const allGradients = useMemo(
249
+ () => [
250
+ ...( gradientsPerOrigin?.custom || [] ),
251
+ ...( gradientsPerOrigin?.theme || [] ),
252
+ ...( gradientsPerOrigin?.default || [] ),
253
+ ],
254
+ [ gradientsPerOrigin ]
255
+ );
227
256
 
228
257
  // Shouldn't be needed but right now the ColorGradientsPanel
229
258
  // can trigger both onChangeColor and onChangeBackground
@@ -239,20 +268,15 @@ export function ColorEdit( props ) {
239
268
  }
240
269
 
241
270
  const hasLinkColor =
242
- hasLinkColorSupport( blockName ) &&
243
- isLinkEnabled &&
244
- ( solids.length > 0 || areCustomSolidsEnabled );
271
+ hasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;
245
272
  const hasTextColor =
246
- hasTextColorSupport( blockName ) &&
247
- isTextEnabled &&
248
- ( solids.length > 0 || areCustomSolidsEnabled );
273
+ hasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;
249
274
  const hasBackgroundColor =
250
275
  hasBackgroundColorSupport( blockName ) &&
251
276
  isBackgroundEnabled &&
252
- ( solids.length > 0 || areCustomSolidsEnabled );
277
+ solidsEnabled;
253
278
  const hasGradientColor =
254
- hasGradientSupport( blockName ) &&
255
- ( gradients.length > 0 || areCustomGradientsEnabled );
279
+ hasGradientSupport( blockName ) && gradientsEnabled;
256
280
 
257
281
  if (
258
282
  ! hasLinkColor &&
@@ -266,13 +290,13 @@ export function ColorEdit( props ) {
266
290
  const { style, textColor, backgroundColor, gradient } = attributes;
267
291
  let gradientValue;
268
292
  if ( hasGradientColor && gradient ) {
269
- gradientValue = getGradientValueBySlug( gradients, gradient );
293
+ gradientValue = getGradientValueBySlug( allGradients, gradient );
270
294
  } else if ( hasGradientColor ) {
271
295
  gradientValue = style?.color?.gradient;
272
296
  }
273
297
 
274
298
  const onChangeColor = ( name ) => ( value ) => {
275
- const colorObject = getColorObjectByColorValue( solids, value );
299
+ const colorObject = getColorObjectByColorValue( allSolids, value );
276
300
  const attributeName = name + 'Color';
277
301
  const newStyle = {
278
302
  ...localAttributes.current.style,
@@ -296,7 +320,7 @@ export function ColorEdit( props ) {
296
320
  };
297
321
 
298
322
  const onChangeGradient = ( value ) => {
299
- const slug = getGradientSlugByValue( gradients, value );
323
+ const slug = getGradientSlugByValue( allGradients, value );
300
324
  let newAttributes;
301
325
  if ( slug ) {
302
326
  const newStyle = {
@@ -331,7 +355,7 @@ export function ColorEdit( props ) {
331
355
  };
332
356
 
333
357
  const onChangeLinkColor = ( value ) => {
334
- const colorObject = getColorObjectByColorValue( solids, value );
358
+ const colorObject = getColorObjectByColorValue( allSolids, value );
335
359
  const newLinkColorValue = colorObject?.slug
336
360
  ? `var:preset|color|${ colorObject.slug }`
337
361
  : value;
@@ -360,7 +384,7 @@ export function ColorEdit( props ) {
360
384
  label: __( 'Text color' ),
361
385
  onColorChange: onChangeColor( 'text' ),
362
386
  colorValue: getColorObjectByAttributeValues(
363
- solids,
387
+ allSolids,
364
388
  textColor,
365
389
  style?.color?.text
366
390
  ).color,
@@ -375,7 +399,7 @@ export function ColorEdit( props ) {
375
399
  ? onChangeColor( 'background' )
376
400
  : undefined,
377
401
  colorValue: getColorObjectByAttributeValues(
378
- solids,
402
+ allSolids,
379
403
  backgroundColor,
380
404
  style?.color?.background
381
405
  ).color,
@@ -392,7 +416,7 @@ export function ColorEdit( props ) {
392
416
  label: __( 'Link Color' ),
393
417
  onColorChange: onChangeLinkColor,
394
418
  colorValue: getLinkColorFromAttributeValue(
395
- solids,
419
+ allSolids,
396
420
  style?.elements?.link?.color?.text
397
421
  ),
398
422
  clearable: !! style?.elements?.link?.color
@@ -417,7 +441,15 @@ export const withColorPaletteStyles = createHigherOrderComponent(
417
441
  ( BlockListBlock ) => ( props ) => {
418
442
  const { name, attributes } = props;
419
443
  const { backgroundColor, textColor } = attributes;
420
- const colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;
444
+ const { palette: solidsPerOrigin } = useSetting( 'color' ) || {};
445
+ const colors = useMemo(
446
+ () => [
447
+ ...( solidsPerOrigin?.custom || [] ),
448
+ ...( solidsPerOrigin?.theme || [] ),
449
+ ...( solidsPerOrigin?.default || [] ),
450
+ ],
451
+ [ solidsPerOrigin ]
452
+ );
421
453
  if ( ! hasColorSupport( name ) || shouldSkipSerialization( name ) ) {
422
454
  return <BlockListBlock { ...props } />;
423
455
  }
@@ -231,7 +231,7 @@ export function TypographyPanel( props ) {
231
231
  );
232
232
  }
233
233
 
234
- const hasTypographySupport = ( blockName ) => {
234
+ export const hasTypographySupport = ( blockName ) => {
235
235
  return TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>
236
236
  hasBlockSupport( blockName, key )
237
237
  );
@@ -3,6 +3,11 @@
3
3
  */
4
4
  import classnames from 'classnames';
5
5
 
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useMemo } from '@wordpress/element';
10
+
6
11
  /**
7
12
  * Internal dependencies
8
13
  */
@@ -24,8 +29,6 @@ import useSetting from '../components/use-setting';
24
29
  // block support is being skipped for a block but the color related CSS classes
25
30
  // & styles still need to be generated so they can be applied to inner elements.
26
31
 
27
- const EMPTY_ARRAY = [];
28
-
29
32
  /**
30
33
  * Provides the CSS class names and inline styles for a block's color support
31
34
  * attributes.
@@ -84,8 +87,24 @@ export function getColorClassesAndStyles( attributes ) {
84
87
  export function useColorProps( attributes ) {
85
88
  const { backgroundColor, textColor, gradient } = attributes;
86
89
 
87
- const colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;
88
- const gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;
90
+ const { palette: solidsPerOrigin, gradients: gradientsPerOrigin } =
91
+ useSetting( 'color' ) || {};
92
+ const colors = useMemo(
93
+ () => [
94
+ ...( solidsPerOrigin?.custom || [] ),
95
+ ...( solidsPerOrigin?.theme || [] ),
96
+ ...( solidsPerOrigin?.default || [] ),
97
+ ],
98
+ [ solidsPerOrigin ]
99
+ );
100
+ const gradients = useMemo(
101
+ () => [
102
+ ...( gradientsPerOrigin?.custom || [] ),
103
+ ...( gradientsPerOrigin?.theme || [] ),
104
+ ...( gradientsPerOrigin?.default || [] ),
105
+ ],
106
+ [ gradientsPerOrigin ]
107
+ );
89
108
 
90
109
  const colorProps = getColorClassesAndStyles( attributes );
91
110
 
@@ -1643,22 +1643,19 @@ export const getInserterItems = createSelector(
1643
1643
  ? getReusableBlocks( state ).map( buildReusableBlockInserterItem )
1644
1644
  : [];
1645
1645
 
1646
- // Exclude any block type item that is to be replaced by a default
1647
- // variation.
1648
- const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(
1649
- ( { variations = [] } ) =>
1650
- ! variations.some( ( { isDefault } ) => isDefault )
1651
- );
1652
-
1653
- const blockVariations = [];
1654
- // Show all available blocks with variations
1655
- for ( const item of blockTypeInserterItems ) {
1646
+ const items = blockTypeInserterItems.reduce( ( accumulator, item ) => {
1656
1647
  const { variations = [] } = item;
1648
+ // Exclude any block type item that is to be replaced by a default variation
1649
+ if ( ! variations.some( ( { isDefault } ) => isDefault ) ) {
1650
+ accumulator.push( item );
1651
+ }
1657
1652
  if ( variations.length ) {
1658
1653
  const variationMapper = getItemFromVariation( state, item );
1659
- blockVariations.push( ...variations.map( variationMapper ) );
1654
+ accumulator.push( ...variations.map( variationMapper ) );
1660
1655
  }
1661
- }
1656
+ return accumulator;
1657
+ }, [] );
1658
+
1662
1659
  // Ensure core blocks are prioritized in the returned results,
1663
1660
  // because third party blocks can be registered earlier than
1664
1661
  // the core blocks (usually by using the `init` action),
@@ -1671,20 +1668,11 @@ export const getInserterItems = createSelector(
1671
1668
  type.push( block );
1672
1669
  return blocks;
1673
1670
  };
1674
- const items = visibleBlockTypeInserterItems.reduce( groupByType, {
1675
- core: [],
1676
- noncore: [],
1677
- } );
1678
- const variations = blockVariations.reduce( groupByType, {
1679
- core: [],
1680
- noncore: [],
1681
- } );
1682
- const sortedBlockTypes = [
1683
- ...items.core,
1684
- ...variations.core,
1685
- ...items.noncore,
1686
- ...variations.noncore,
1687
- ];
1671
+ const {
1672
+ core: coreItems,
1673
+ noncore: nonCoreItems,
1674
+ } = items.reduce( groupByType, { core: [], noncore: [] } );
1675
+ const sortedBlockTypes = [ ...coreItems, ...nonCoreItems ];
1688
1676
  return [ ...sortedBlockTypes, ...reusableBlockInserterItems ];
1689
1677
  },
1690
1678
  ( state, rootClientId ) => [