@wordpress/block-library
Version:
Block library for the WordPress editor.
38 lines (37 loc) • 1.63 kB
JavaScript
import clsx from "clsx";
import { AlignmentControl, BlockControls, Warning, useBlockProps } from "@wordpress/block-editor";
import { __ } from "@wordpress/i18n";
import { Button } from "@wordpress/components";
import Placeholder from "./placeholder.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
// packages/block-library/src/comments/edit/comments-legacy.jsx
function CommentsLegacy({ attributes, setAttributes, context: { postType, postId } }) {
const { textAlign } = attributes;
const actions = [/* @__PURE__ */ jsx(Button, {
__next40pxDefaultSize: true,
onClick: () => void setAttributes({ legacy: false }),
variant: "primary",
children: __("Switch to editable mode")
}, "convert")];
const blockProps = useBlockProps({ className: clsx({ [`has-text-align-${textAlign}`]: textAlign }) });
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockControls, {
group: "block",
children: /* @__PURE__ */ jsx(AlignmentControl, {
value: textAlign,
onChange: (nextAlign) => {
setAttributes({ textAlign: nextAlign });
}
})
}), /* @__PURE__ */ jsxs("div", {
...blockProps,
children: [/* @__PURE__ */ jsx(Warning, {
actions,
children: __("Comments block: You’re currently using the legacy version of the block. The following is just a placeholder - the final styling will likely look different. For a better representation and more customization options, switch the block to its editable mode.")
}), /* @__PURE__ */ jsx(Placeholder, {
postId,
postType
})]
})] });
}
export { CommentsLegacy as default };
//# sourceMappingURL=comments-legacy.mjs.map