-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
What problem does this address?
In my custom block, I'm trying to control the block layout by utilizing the core blocks, without introducing unnecessary complexity/nesting.
For now, I am using a Group block wrapper, which I am changing based on the block settings selected.
I wish I could utilize:
{
"supports": {
"layout": {
"default": {
"type": "flex",
"flexWrap": "nowrap"
}
}
}
}
and then just update the layout via edit.tsx in the same manner I'm doing with the Group block attributes:
const block = select( 'core/block-editor' ).getBlock( clientId );
block?.innerBlocks.forEach( ( innerBlock ) => {
if ( innerBlock.name === 'core/group' ) {
const updatedBlock = {
...innerBlock,
attributes: {
...innerBlock.attributes,
layout: setGroupAttributes( attributes.thumbnailsPosition ),
},
};
dispatch( 'core/block-editor' ).updateBlock(
innerBlock.clientId,
updatedBlock
);
}
} );
This would enable the same functionality, without the unnecessary Group block wrapper.
What is your proposed solution?
Expose the "supports": { "layout": {} } via block attributes proving a way to update them.
Metadata
Metadata
Assignees
Labels
[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
