UNPKG

@wordpress/block-editor

Version:
73 lines (70 loc) 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.PrivateInserterLibrary = void 0; var _data = require("@wordpress/data"); var _element = require("@wordpress/element"); var _menu = require("./menu"); var _store = require("../../store"); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ /** * Internal dependencies */ const noop = () => {}; function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, __experimentalInitialTab, __experimentalInitialCategory, __experimentalFilterValue, onPatternCategorySelection, onSelect = noop, shouldFocusBlock = false, onClose }, ref) { const { destinationRootClientId } = (0, _data.useSelect)(select => { const { getBlockRootClientId } = select(_store.store); const _rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; return { destinationRootClientId: _rootClientId }; }, [clientId, rootClientId]); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_menu.PrivateInserterMenu, { onSelect: onSelect, rootClientId: destinationRootClientId, clientId: clientId, isAppender: isAppender, showInserterHelpPanel: showInserterHelpPanel, showMostUsedBlocks: showMostUsedBlocks, __experimentalInsertionIndex: __experimentalInsertionIndex, __experimentalFilterValue: __experimentalFilterValue, onPatternCategorySelection: onPatternCategorySelection, __experimentalInitialTab: __experimentalInitialTab, __experimentalInitialCategory: __experimentalInitialCategory, shouldFocusBlock: shouldFocusBlock, ref: ref, onClose: onClose }); } const PrivateInserterLibrary = exports.PrivateInserterLibrary = (0, _element.forwardRef)(InserterLibrary); function PublicInserterLibrary(props, ref) { return /*#__PURE__*/(0, _jsxRuntime.jsx)(PrivateInserterLibrary, { ...props, onPatternCategorySelection: undefined, ref: ref }); } var _default = exports.default = (0, _element.forwardRef)(PublicInserterLibrary); //# sourceMappingURL=library.js.map