UNPKG

@wordpress/block-editor

Version:
48 lines (43 loc) 1.2 kB
import { createElement } from "@wordpress/element"; /** * External dependencies */ import { noop } from 'lodash'; /** * WordPress dependencies */ import { useSelect } from '@wordpress/data'; /** * Internal dependencies */ import InserterMenu from './menu'; import { store as blockEditorStore } from '../../store'; function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, onSelect = noop, shouldFocusBlock = false }) { const destinationRootClientId = useSelect(select => { const { getBlockRootClientId } = select(blockEditorStore); return rootClientId || getBlockRootClientId(clientId) || undefined; }, [clientId, rootClientId]); return createElement(InserterMenu, { onSelect: onSelect, rootClientId: destinationRootClientId, clientId: clientId, isAppender: isAppender, showInserterHelpPanel: showInserterHelpPanel, showMostUsedBlocks: showMostUsedBlocks, __experimentalInsertionIndex: __experimentalInsertionIndex, shouldFocusBlock: shouldFocusBlock }); } export default InserterLibrary; //# sourceMappingURL=library.js.map