@wordpress/block-editor
Version:
72 lines (59 loc) • 1.78 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _element = require("@wordpress/element");
var _data = require("@wordpress/data");
var _menu = _interopRequireDefault(require("./menu"));
var _store = require("../../store");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const noop = () => {};
function InserterLibrary({
rootClientId,
clientId,
isAppender,
showInserterHelpPanel,
showMostUsedBlocks = false,
__experimentalInsertionIndex,
__experimentalFilterValue,
onSelect = noop,
shouldFocusBlock = false
}, ref) {
const {
destinationRootClientId,
prioritizePatterns
} = (0, _data.useSelect)(select => {
const {
getBlockRootClientId,
getSettings
} = select(_store.store);
const _rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
return {
destinationRootClientId: _rootClientId,
prioritizePatterns: getSettings().__experimentalPreferPatternsOnRoot
};
}, [clientId, rootClientId]);
return (0, _element.createElement)(_menu.default, {
onSelect: onSelect,
rootClientId: destinationRootClientId,
clientId: clientId,
isAppender: isAppender,
showInserterHelpPanel: showInserterHelpPanel,
showMostUsedBlocks: showMostUsedBlocks,
__experimentalInsertionIndex: __experimentalInsertionIndex,
__experimentalFilterValue: __experimentalFilterValue,
shouldFocusBlock: shouldFocusBlock,
prioritizePatterns: prioritizePatterns,
ref: ref
});
}
var _default = (0, _element.forwardRef)(InserterLibrary);
exports.default = _default;
//# sourceMappingURL=library.js.map