@wordpress/block-library
Version:
Block library for the WordPress editor.
45 lines (42 loc) • 1.35 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = saveWithInnerBlocks;
var _clsx = _interopRequireDefault(require("clsx"));
var _blockEditor = require("@wordpress/block-editor");
var _jsxRuntime = require("react/jsx-runtime");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function saveWithInnerBlocks({
attributes
}) {
const {
caption,
columns,
imageCrop
} = attributes;
const className = (0, _clsx.default)('has-nested-images', {
[`columns-${columns}`]: columns !== undefined,
[`columns-default`]: columns === undefined,
'is-cropped': imageCrop
});
const blockProps = _blockEditor.useBlockProps.save({
className
});
const innerBlocksProps = _blockEditor.useInnerBlocksProps.save(blockProps);
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
...innerBlocksProps,
children: [innerBlocksProps.children, !_blockEditor.RichText.isEmpty(caption) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText.Content, {
tagName: "figcaption",
className: (0, _clsx.default)('blocks-gallery-caption', (0, _blockEditor.__experimentalGetElementClassName)('caption')),
value: caption
})]
});
}
//# sourceMappingURL=save.js.map
;