Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
index: getBlockIndex( clientId, rootClientId ),
mode: getBlockMode( clientId ),
name: blockName,
blockTitle: getBlockType( blockName ).title,
blockTitle: getBlockType( blockName )?.title,
isPartOfSelection: isSelected || isPartOfMultiSelection,
adjustScrolling:
isSelected || isFirstMultiSelectedBlock( clientId ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ export function useBlockClassNames( clientId ) {
const activeEntityBlockId = getActiveBlockIdByBlockNames(
spotlightEntityBlocks
);
const blockType = getBlockType( name );
return classnames( {
'is-selected': isSelected,
'is-highlighted': isBlockHighlighted( clientId ),
'is-multi-selected': isBlockMultiSelected( clientId ),
'is-reusable': isReusableBlock( getBlockType( name ) ),
'is-reusable': blockType && isReusableBlock( blockType ),
'is-dragging': isDragging,
'has-child-selected': isAncestorOfSelectedBlock,
'has-active-entity': activeEntityBlockId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ export function useBlockCustomClassName( clientId ) {
const { getBlockName, getBlockAttributes } = select(
blockEditorStore
);
const { className } = getBlockAttributes( clientId );

const { className } = getBlockAttributes( clientId ) || {};
if ( ! className ) {
return;
}

const blockType = getBlockType( getBlockName( clientId ) );
if ( ! blockType ) {
return;
}

const hasLightBlockWrapper =
blockType.apiVersion > 1 ||
hasBlockSupport( blockType, 'lightBlockWrapper', false );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export function useBlockDefaultClassName( clientId ) {
( select ) => {
const name = select( blockEditorStore ).getBlockName( clientId );
const blockType = getBlockType( name );
if ( ! blockType ) {
return;
}

const hasLightBlockWrapper =
blockType.apiVersion > 1 ||
hasBlockSupport( blockType, 'lightBlockWrapper', false );
Expand Down