@wordpress/block-library
Version:
Block library for the WordPress editor.
38 lines (37 loc) • 1.12 kB
JavaScript
// packages/block-library/src/gallery/save.js
import clsx from "clsx";
import {
RichText,
useBlockProps,
useInnerBlocksProps,
__experimentalGetElementClassName
} from "@wordpress/block-editor";
import { jsx, jsxs } from "react/jsx-runtime";
function saveWithInnerBlocks({ attributes }) {
const { caption, columns, imageCrop } = attributes;
const className = clsx("has-nested-images", {
[`columns-${columns}`]: columns !== void 0,
[`columns-default`]: columns === void 0,
"is-cropped": imageCrop
});
const blockProps = useBlockProps.save({ className });
const innerBlocksProps = useInnerBlocksProps.save(blockProps);
return /* @__PURE__ */ jsxs("figure", { ...innerBlocksProps, children: [
innerBlocksProps.children,
!RichText.isEmpty(caption) && /* @__PURE__ */ jsx(
RichText.Content,
{
tagName: "figcaption",
className: clsx(
"blocks-gallery-caption",
__experimentalGetElementClassName("caption")
),
value: caption
}
)
] });
}
export {
saveWithInnerBlocks as default
};
//# sourceMappingURL=save.js.map