diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index 0aec0c67911396..68e06da5d3e389 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 a2476fc0de97c6..0f445ac78424bc 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 08820d0c5526a1..04a46942f4816b 100644 --- a/packages/block-library/src/post-terms/block.json +++ b/packages/block-library/src/post-terms/block.json @@ -2,7 +2,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 04190056c787df..5f737d57497dff 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -2,7 +2,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 2bbe4dd29ccb58..e603c6149a41d3 100644 --- a/packages/block-library/src/site-logo/block.json +++ b/packages/block-library/src/site-logo/block.json @@ -2,7 +2,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 b048b873ef14f7..61428975ed8797 100644 --- a/packages/block-library/src/site-tagline/block.json +++ b/packages/block-library/src/site-tagline/block.json @@ -2,7 +2,7 @@ "apiVersion": 2, "name": "core/site-tagline", "title": "Site Tagline", - "category": "design", + "category": "theme", "description": "Describe in a few words what the website 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 a16d1c9f3b6449..7030ed68cf6e25 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -2,7 +2,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": {