UNPKG

@wordpress/block-library

Version:
43 lines (36 loc) 959 B
/** * WordPress dependencies */ import { useBlockProps, useInnerBlocksProps, store as blockEditorStore, } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; /** * Internal dependencies */ import AddTabToolbarControl from '../tab-panel/add-tab-toolbar-control'; import RemoveTabToolbarControl from '../tab-panel/remove-tab-toolbar-control'; function Edit( { clientId } ) { const tabsClientId = useSelect( ( select ) => select( blockEditorStore ).getBlockRootClientId( clientId ), [ clientId ] ); const blockProps = useBlockProps(); const innerBlocksProps = useInnerBlocksProps( blockProps, { allowedBlocks: [ 'core/tab' ], orientation: 'horizontal', templateLock: false, renderAppender: false, } ); return ( <> <AddTabToolbarControl tabsClientId={ tabsClientId } /> <RemoveTabToolbarControl tabsClientId={ tabsClientId } /> <div { ...innerBlocksProps } /> </> ); } export default Edit;