@wordpress/block-editor
Version:
96 lines (94 loc) • 3 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/block-editor/src/components/inserter/library.js
var library_exports = {};
__export(library_exports, {
PrivateInserterLibrary: () => PrivateInserterLibrary,
default: () => library_default
});
module.exports = __toCommonJS(library_exports);
var import_data = require("@wordpress/data");
var import_element = require("@wordpress/element");
var import_menu = require("./menu");
var import_store = require("../../store");
var import_jsx_runtime = require("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 } = (0, import_data.useSelect)(
(select) => {
const { getBlockRootClientId } = select(import_store.store);
const _rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0;
return {
destinationRootClientId: _rootClientId
};
},
[clientId, rootClientId]
);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_menu.PrivateInserterMenu,
{
onSelect,
rootClientId: destinationRootClientId,
clientId,
isAppender,
showInserterHelpPanel,
showMostUsedBlocks,
__experimentalInsertionIndex,
__experimentalFilterValue,
onPatternCategorySelection,
__experimentalInitialTab,
__experimentalInitialCategory,
shouldFocusBlock,
ref,
onClose
}
);
}
var PrivateInserterLibrary = (0, import_element.forwardRef)(InserterLibrary);
function PublicInserterLibrary(props, ref) {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
PrivateInserterLibrary,
{
...props,
onPatternCategorySelection: void 0,
ref
}
);
}
var library_default = (0, import_element.forwardRef)(PublicInserterLibrary);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PrivateInserterLibrary
});
//# sourceMappingURL=library.js.map