Skip to content

Commit

Permalink
Remove unnecessary code now that we use BlockTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Feb 3, 2021
1 parent a5e572f commit b1371d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions packages/block-editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
blockTitle,
} = useSelect(
( select ) => {
const {
getBlockRootClientId,
getBlockTransformItems,
__experimentalGetReusableBlockTitle,
} = select( blockEditorStore );
const { getBlockRootClientId, getBlockTransformItems } = select(
blockEditorStore
);

const { getBlockStyles, getBlockType } = select( blocksStore );
const rootClientId = getBlockRootClientId(
Expand All @@ -57,14 +55,8 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
const styles =
_isSingleBlockSelected && getBlockStyles( firstBlockName );
let _icon;
let reusableBlockTitle;
if ( _isSingleBlockSelected ) {
_icon = blockInformation?.icon; // Take into account active block variations.
reusableBlockTitle =
isReusableBlock( blocks[ 0 ] ) &&
__experimentalGetReusableBlockTitle(
blocks[ 0 ].attributes.ref
);
} else {
const isSelectionOfSameType =
uniq( blocks.map( ( { name } ) => name ) ).length === 1;
Expand All @@ -82,8 +74,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
),
hasBlockStyles: !! styles?.length,
icon: _icon,
blockTitle:
reusableBlockTitle || getBlockType( firstBlockName ).title,
blockTitle: getBlockType( firstBlockName ).title,
};
},
[ clientIds, blocks, blockInformation?.icon ]
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/template-part/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export { metadata, name };
export const settings = {
title: _x( 'Template Part', 'block title' ),
keywords: [ __( 'template part' ) ],
__experimentalLabel: ( { title: slug } ) => startCase( slug ),
__experimentalLabel: ( slug ) => startCase( slug ),
edit,
};

0 comments on commit b1371d0

Please sign in to comment.