File "editor-utils.ts"

Full Path: /home/warrior1/public_html/languages/wp-content-20241001222009/plugins/woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/editor-utils.ts
File size: 526 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * External dependencies
 */
import { getBlockTypes } from '@wordpress/blocks';

// List of core block types to allow in inner block areas.
const coreBlockTypes = [ 'core/paragraph', 'core/image', 'core/separator' ];

/**
 * Gets a list of allowed blocks types under a specific parent block type.
 */
export const getAllowedBlocks = ( block: string ): string[] => [
	...getBlockTypes()
		.filter( ( blockType ) =>
			( blockType?.parent || [] ).includes( block )
		)
		.map( ( { name } ) => name ),
	...coreBlockTypes,
];