@wordpress/block-editor
Version:
40 lines (37 loc) • 981 B
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { last } from 'lodash';
/**
* 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,
lastBlockClientId
}) => {
return createElement(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);
//# sourceMappingURL=default-block-appender.js.map