@gechiui/block-editor
Version:
40 lines (33 loc) • 879 B
JavaScript
/**
* External dependencies
*/
import { last } from 'lodash';
/**
* GeChiUI dependencies
*/
import { compose } from '@gechiui/compose';
import { withSelect } from '@gechiui/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, lastBlockClientId } ) => {
return (
<BaseDefaultBlockAppender
rootClientId={ clientId }
lastBlockClientId={ lastBlockClientId }
/>
);
};
export default compose( [
withClientId,
withSelect( ( select, { clientId } ) => {
const { getBlockOrder } = select( blockEditorStore );
const blockClientIds = getBlockOrder( clientId );
return {
lastBlockClientId: last( blockClientIds ),
};
} ),
] )( DefaultBlockAppender );