UNPKG

@wordpress/block-library

Version:
37 lines (36 loc) • 1.39 kB
import { RichText, __experimentalGetDimensionsClassesAndStyles, __experimentalGetElementClassName, __experimentalGetShadowClassesAndStyles, useBlockProps } from "@wordpress/block-editor"; import Tracks from "./tracks.mjs"; import { jsx, jsxs } from "react/jsx-runtime"; // packages/block-library/src/video/save.jsx function save({ attributes }) { const { autoplay, caption, controls, loop, muted, poster, preload, src, playsInline, tracks, width, height } = attributes; const aspectRatio = width && height ? `${width} / ${height}` : void 0; const videoStyle = { ...aspectRatio && { aspectRatio }, ...__experimentalGetDimensionsClassesAndStyles(attributes).style, ...__experimentalGetShadowClassesAndStyles(attributes).style }; return /* @__PURE__ */ jsxs("figure", { ...useBlockProps.save(), children: [src && /* @__PURE__ */ jsx("video", { autoPlay: autoplay, controls, loop, muted, poster, preload: preload !== "metadata" ? preload : void 0, src, playsInline, width, height, style: Object.keys(videoStyle).length ? videoStyle : void 0, children: /* @__PURE__ */ jsx(Tracks, { tracks }) }), !RichText.isEmpty(caption) && /* @__PURE__ */ jsx(RichText.Content, { className: __experimentalGetElementClassName("caption"), tagName: "figcaption", value: caption })] }); } export { save as default }; //# sourceMappingURL=save.mjs.map