@wordpress/block-library
Version:
Block library for the WordPress editor.
42 lines (41 loc) • 1.22 kB
JavaScript
// packages/block-library/src/terms-query/edit/terms-query-content.js
import { useCallback } from "@wordpress/element";
import { useBlockProps, useInnerBlocksProps } from "@wordpress/block-editor";
import TermsQueryInspectorControls from "./inspector-controls";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
var TEMPLATE = [["core/term-template"]];
function TermsQueryContent({
attributes,
setAttributes,
clientId,
context
}) {
const { tagName: TagName } = attributes;
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps(blockProps, {
template: TEMPLATE
});
const setQuery = useCallback(
(newQuery) => setAttributes((prevAttributes) => ({
termQuery: { ...prevAttributes.termQuery, ...newQuery }
})),
[setAttributes]
);
return /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(
TermsQueryInspectorControls,
{
attributes,
setQuery,
setAttributes,
clientId,
templateSlug: context?.templateSlug
}
),
/* @__PURE__ */ jsx(TagName, { ...innerBlocksProps })
] });
}
export {
TermsQueryContent as default
};
//# sourceMappingURL=terms-query-content.js.map