UNPKG

@wordpress/block-editor

Version:
30 lines (24 loc) 767 B
/** * WordPress dependencies */ import { compose } from '@wordpress/compose'; import { withSelect } from '@wordpress/data'; /** * Internal dependencies */ import BaseDefaultBlockAppender from '../default-block-appender'; import withClientId from './with-client-id'; import { store as blockEditorStore } from '../../store'; export const DefaultBlockAppender = ( { clientId } ) => { return <BaseDefaultBlockAppender rootClientId={ clientId } />; }; export default compose( [ withClientId, withSelect( ( select, { clientId } ) => { const { getBlockOrder } = select( blockEditorStore ); const blockClientIds = getBlockOrder( clientId ); return { lastBlockClientId: blockClientIds[ blockClientIds.length - 1 ], }; } ), ] )( DefaultBlockAppender );