UNPKG

@wordpress/block-editor

Version:
61 lines (50 loc) 1.44 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _element = require("@wordpress/element"); var _lodash = require("lodash"); var _data = require("@wordpress/data"); var _menu = _interopRequireDefault(require("./menu")); var _store = require("../../store"); /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function InserterLibrary({ rootClientId, clientId, isAppender, showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, onSelect = _lodash.noop, shouldFocusBlock = false }) { const destinationRootClientId = (0, _data.useSelect)(select => { const { getBlockRootClientId } = select(_store.store); return rootClientId || getBlockRootClientId(clientId) || undefined; }, [clientId, rootClientId]); return (0, _element.createElement)(_menu.default, { onSelect: onSelect, rootClientId: destinationRootClientId, clientId: clientId, isAppender: isAppender, showInserterHelpPanel: showInserterHelpPanel, showMostUsedBlocks: showMostUsedBlocks, __experimentalInsertionIndex: __experimentalInsertionIndex, shouldFocusBlock: shouldFocusBlock }); } var _default = InserterLibrary; exports.default = _default; //# sourceMappingURL=library.js.map