@@ -29,7 +29,6 @@ import BlockTransformationsMenu from './block-transformations-menu';
2929import { useBlockVariationTransforms } from './block-variation-transformations' ;
3030import BlockStylesMenu from './block-styles-menu' ;
3131import PatternTransformationsMenu from './pattern-transformations-menu' ;
32- import useBlockDisplayTitle from '../block-title/use-block-display-title' ;
3332import { unlock } from '../../lock-unlock' ;
3433
3534function BlockSwitcherDropdownMenuContents ( {
@@ -200,6 +199,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
200199 isTemplate,
201200 isDisabled,
202201 isSectionInSelection,
202+ blockTitle,
203203 } = useSelect (
204204 ( select ) => {
205205 const {
@@ -223,6 +223,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
223223
224224 let _icon ;
225225 let _hasTemplateLock ;
226+ let _blockTitle ;
226227 if ( _isSingleBlockSelected ) {
227228 const match = getActiveBlockVariation (
228229 firstBlockName ,
@@ -232,6 +233,15 @@ export const BlockSwitcher = ( { clientIds } ) => {
232233 _icon = match ?. icon || blockType . icon ;
233234 _hasTemplateLock =
234235 getTemplateLock ( clientIds [ 0 ] ) === 'contentOnly' ;
236+
237+ // For BlockSwitcher, we only show the block type or variation name
238+ // We don't need custom labels (metadata.name) - those are only for list view
239+ _blockTitle = match ?. title || blockType . title ;
240+
241+ // Truncate if needed (max 35 chars)
242+ if ( _blockTitle && _blockTitle . length > 35 ) {
243+ _blockTitle = _blockTitle . slice ( 0 , 34 ) + '…' ;
244+ }
235245 } else {
236246 const isSelectionOfSameType =
237247 new Set ( _blocks . map ( ( { name } ) => name ) ) . size === 1 ;
@@ -241,6 +251,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
241251 // When selection consists of blocks of multiple types, display an
242252 // appropriate icon to communicate the non-uniformity.
243253 _icon = isSelectionOfSameType ? blockType . icon : copy ;
254+ _blockTitle = null ; // Not used for multiple blocks
244255 }
245256
246257 const _isSectionInSelection = clientIds . some ( ( id ) =>
@@ -260,14 +271,11 @@ export const BlockSwitcher = ( { clientIds } ) => {
260271 hasContentOnlyLocking : _hasTemplateLock ,
261272 isDisabled : editingMode !== 'default' ,
262273 isSectionInSelection : _isSectionInSelection ,
274+ blockTitle : _blockTitle ,
263275 } ;
264276 } ,
265277 [ clientIds ]
266278 ) ;
267- const blockTitle = useBlockDisplayTitle ( {
268- clientId : clientIds ?. [ 0 ] ,
269- maximumLength : 35 ,
270- } ) ;
271279 const showIconLabels = useSelect (
272280 ( select ) =>
273281 select ( preferencesStore ) . get ( 'core' , 'showIconLabels' ) ,
0 commit comments