diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 0aec0c6791139..68e06da5d3e38 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -1643,22 +1643,19 @@ export const getInserterItems = createSelector( ? getReusableBlocks( state ).map( buildReusableBlockInserterItem ) : []; - // Exclude any block type item that is to be replaced by a default - // variation. - const visibleBlockTypeInserterItems = blockTypeInserterItems.filter( - ( { variations = [] } ) => - ! variations.some( ( { isDefault } ) => isDefault ) - ); - - const blockVariations = []; - // Show all available blocks with variations - for ( const item of blockTypeInserterItems ) { + const items = blockTypeInserterItems.reduce( ( accumulator, item ) => { const { variations = [] } = item; + // Exclude any block type item that is to be replaced by a default variation + if ( ! variations.some( ( { isDefault } ) => isDefault ) ) { + accumulator.push( item ); + } if ( variations.length ) { const variationMapper = getItemFromVariation( state, item ); - blockVariations.push( ...variations.map( variationMapper ) ); + accumulator.push( ...variations.map( variationMapper ) ); } - } + return accumulator; + }, [] ); + // Ensure core blocks are prioritized in the returned results, // because third party blocks can be registered earlier than // the core blocks (usually by using the `init` action), @@ -1671,20 +1668,11 @@ export const getInserterItems = createSelector( type.push( block ); return blocks; }; - const items = visibleBlockTypeInserterItems.reduce( groupByType, { - core: [], - noncore: [], - } ); - const variations = blockVariations.reduce( groupByType, { - core: [], - noncore: [], - } ); - const sortedBlockTypes = [ - ...items.core, - ...variations.core, - ...items.noncore, - ...variations.noncore, - ]; + const { + core: coreItems, + noncore: nonCoreItems, + } = items.reduce( groupByType, { core: [], noncore: [] } ); + const sortedBlockTypes = [ ...coreItems, ...nonCoreItems ]; return [ ...sortedBlockTypes, ...reusableBlockInserterItems ]; }, ( state, rootClientId ) => [ diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index a2476fc0de97c..0f445ac78424b 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -149,53 +149,55 @@ export const __experimentalGetCoreBlocks = () => [ html, latestComments, latestPosts, - logInOut, mediaText, missing, more, - navigation, - navigationLink, - navigationSubmenu, nextpage, pageList, pattern, - postAuthor, - postComments, - postContent, - postDate, - postExcerpt, - postFeaturedImage, - postNavigationLink, - postTemplate, - postTerms, - postTitle, preformatted, pullquote, - query, - queryPagination, - queryPaginationNext, - queryPaginationNumbers, - queryPaginationPrevious, - queryTitle, reusableBlock, rss, search, separator, shortcode, - siteLogo, - siteTagline, - siteTitle, socialLink, socialLinks, spacer, table, // tableOfContents, tagCloud, - templatePart, - termDescription, textColumns, verse, video, + + // theme blocks + navigation, + navigationLink, + navigationSubmenu, + siteLogo, + siteTitle, + siteTagline, + query, + templatePart, + postTitle, + postExcerpt, + postFeaturedImage, + postContent, + postAuthor, + postDate, + postTerms, + postNavigationLink, + postTemplate, + queryPagination, + queryPaginationNext, + queryPaginationNumbers, + queryPaginationPrevious, + postComments, + logInOut, + termDescription, + queryTitle, ]; /** diff --git a/packages/block-library/src/post-terms/block.json b/packages/block-library/src/post-terms/block.json index 2ca14e6a92dbe..0f24ef9643f7c 100644 --- a/packages/block-library/src/post-terms/block.json +++ b/packages/block-library/src/post-terms/block.json @@ -3,7 +3,7 @@ "apiVersion": 2, "name": "core/post-terms", "title": "Post Terms", - "category": "design", + "category": "theme", "description": "Post terms.", "textdomain": "default", "attributes": { diff --git a/packages/block-library/src/query-title/block.json b/packages/block-library/src/query-title/block.json index a5298bc89c2a7..0dd85c2425b5e 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -3,7 +3,7 @@ "apiVersion": 2, "name": "core/query-title", "title": "Query Title", - "category": "design", + "category": "theme", "description": "Display the query title.", "textdomain": "default", "attributes": { diff --git a/packages/block-library/src/site-logo/block.json b/packages/block-library/src/site-logo/block.json index 33e4f415c17a7..798917ff7cb87 100644 --- a/packages/block-library/src/site-logo/block.json +++ b/packages/block-library/src/site-logo/block.json @@ -3,7 +3,7 @@ "apiVersion": 2, "name": "core/site-logo", "title": "Site Logo", - "category": "layout", + "category": "theme", "description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.", "textdomain": "default", "attributes": { diff --git a/packages/block-library/src/site-tagline/block.json b/packages/block-library/src/site-tagline/block.json index c9e00d1047856..451a777ee9dec 100644 --- a/packages/block-library/src/site-tagline/block.json +++ b/packages/block-library/src/site-tagline/block.json @@ -3,7 +3,7 @@ "apiVersion": 2, "name": "core/site-tagline", "title": "Site Tagline", - "category": "design", + "category": "theme", "description": "Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.", "keywords": [ "description" ], "textdomain": "default", diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index efd951b0e09c6..1408067751ee1 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -3,7 +3,7 @@ "apiVersion": 2, "name": "core/site-title", "title": "Site Title", - "category": "design", + "category": "theme", "description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.", "textdomain": "default", "attributes": {