@wordpress/block-library
Version:
Block library for the WordPress editor.
75 lines (74 loc) • 1.67 kB
JavaScript
// packages/block-library/src/verse/deprecated.js
import clsx from "clsx";
import { RichText, useBlockProps } from "@wordpress/block-editor";
import migrateFontFamily from "../utils/migrate-font-family";
import { jsx } from "react/jsx-runtime";
var v1 = {
attributes: {
content: {
type: "string",
source: "html",
selector: "pre",
default: ""
},
textAlign: {
type: "string"
}
},
save({ attributes }) {
const { textAlign, content } = attributes;
return /* @__PURE__ */ jsx(
RichText.Content,
{
tagName: "pre",
style: { textAlign },
value: content
}
);
}
};
var v2 = {
attributes: {
content: {
type: "string",
source: "html",
selector: "pre",
default: "",
__unstablePreserveWhiteSpace: true,
role: "content"
},
textAlign: {
type: "string"
}
},
supports: {
anchor: true,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
__experimentalFontFamily: true
},
spacing: {
padding: true
}
},
save({ attributes }) {
const { textAlign, content } = attributes;
const className = clsx({
[`has-text-align-${textAlign}`]: textAlign
});
return /* @__PURE__ */ jsx("pre", { ...useBlockProps.save({ className }), children: /* @__PURE__ */ jsx(RichText.Content, { value: content }) });
},
migrate: migrateFontFamily,
isEligible({ style }) {
return style?.typography?.fontFamily;
}
};
var deprecated_default = [v2, v1];
export {
deprecated_default as default
};
//# sourceMappingURL=deprecated.js.map