UNPKG

@wordpress/block-editor

Version:
71 lines (70 loc) 1.86 kB
// packages/block-editor/src/components/inserter/library.js import { useSelect } from "@wordpress/data"; import { forwardRef } from "@wordpress/element"; import { PrivateInserterMenu } from "./menu.mjs"; import { store as blockEditorStore } from "../../store/index.mjs"; import { jsx } from "react/jsx-runtime"; var noop = () => { }; function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, __experimentalInitialTab, __experimentalInitialCategory, __experimentalFilterValue, onPatternCategorySelection, onSelect = noop, shouldFocusBlock = false, onClose }, ref) { const { destinationRootClientId } = useSelect( (select) => { const { getBlockRootClientId } = select(blockEditorStore); const _rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0; return { destinationRootClientId: _rootClientId }; }, [clientId, rootClientId] ); return /* @__PURE__ */ jsx( PrivateInserterMenu, { onSelect, rootClientId: destinationRootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks, __experimentalInsertionIndex, __experimentalFilterValue, onPatternCategorySelection, __experimentalInitialTab, __experimentalInitialCategory, shouldFocusBlock, ref, onClose } ); } var PrivateInserterLibrary = forwardRef(InserterLibrary); function PublicInserterLibrary(props, ref) { return /* @__PURE__ */ jsx( PrivateInserterLibrary, { ...props, onPatternCategorySelection: void 0, ref } ); } var library_default = forwardRef(PublicInserterLibrary); export { PrivateInserterLibrary, library_default as default }; //# sourceMappingURL=library.mjs.map