@wordpress/block-library
Version:
Block library for the WordPress editor.
47 lines (46 loc) • 1.55 kB
JavaScript
import clsx from "clsx";
import { RichText, useBlockProps } from "@wordpress/block-editor";
import metadata from "./block.json";
import { jsx, jsxs } from "react/jsx-runtime";
// packages/block-library/src/embed/deprecated.jsx
const { attributes: blockAttributes } = metadata;
const deprecated = [{
attributes: blockAttributes,
save({ attributes }) {
const { url, caption, type, providerNameSlug } = attributes;
if (!url) return null;
const className = clsx("wp-block-embed", {
[`is-type-${type}`]: type,
[`is-provider-${providerNameSlug}`]: providerNameSlug,
[`wp-block-embed-${providerNameSlug}`]: providerNameSlug
});
return /* @__PURE__ */ jsxs("figure", {
...useBlockProps.save({ className }),
children: [/* @__PURE__ */ jsx("div", {
className: "wp-block-embed__wrapper",
children: `\n${url}\n`
}), !RichText.isEmpty(caption) && /* @__PURE__ */ jsx(RichText.Content, {
tagName: "figcaption",
value: caption
})]
});
}
}, {
attributes: blockAttributes,
save({ attributes: { url, caption, type, providerNameSlug } }) {
if (!url) return null;
const embedClassName = clsx("wp-block-embed", {
[`is-type-${type}`]: type,
[`is-provider-${providerNameSlug}`]: providerNameSlug
});
return /* @__PURE__ */ jsxs("figure", {
className: embedClassName,
children: [`\n${url}\n`, !RichText.isEmpty(caption) && /* @__PURE__ */ jsx(RichText.Content, {
tagName: "figcaption",
value: caption
})]
});
}
}];
export { deprecated as default };
//# sourceMappingURL=deprecated.mjs.map