Skip to content
Merged
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
13 changes: 0 additions & 13 deletions packages/block-library/src/buttons/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import clsx from 'clsx';
* WordPress dependencies
*/
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
import { useSelect } from '@wordpress/data';
import { store as blocksStore } from '@wordpress/blocks';

const DEFAULT_BLOCK = {
name: 'core/button',
Expand All @@ -32,20 +30,9 @@ function ButtonsEdit( { attributes, className } ) {
'has-custom-font-size': fontSize || style?.typography?.fontSize,
} ),
} );
const { hasButtonVariations } = useSelect( ( select ) => {
const buttonVariations = select( blocksStore ).getBlockVariations(
'core/button',
'inserter'
);
return {
hasButtonVariations: buttonVariations.length > 0,
};
}, [] );

const innerBlocksProps = useInnerBlocksProps( blockProps, {
defaultBlock: DEFAULT_BLOCK,
// This check should be handled by the `Inserter` internally to be consistent across all blocks that use it.
directInsert: ! hasButtonVariations,
template: [ [ 'core/button' ] ],
templateInsertUpdatesSelection: true,
orientation: layout?.orientation ?? 'horizontal',
Expand Down
Loading