UNPKG

@gechiui/block-editor

Version:
51 lines (46 loc) 1.31 kB
import { createElement } from "@gechiui/element"; /** * External dependencies */ import { noop } from 'lodash'; /** * GeChiUI dependencies */ import { useSelect } from '@gechiui/data'; /** * Internal dependencies */ import InserterMenu from './menu'; import { store as blockEditorStore } from '../../store'; function InserterLibrary(_ref) { let { rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, __experimentalFilterValue, onSelect = noop, shouldFocusBlock = false } = _ref; 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, __experimentalFilterValue: __experimentalFilterValue, shouldFocusBlock: shouldFocusBlock }); } export default InserterLibrary; //# sourceMappingURL=library.js.map