UNPKG

@wordpress/block-library

Version:
66 lines (65 loc) • 3.16 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); // \0rolldown/runtime.js var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); let clsx = require("clsx"); clsx = __toESM(clsx); let _wordpress_block_editor = require("@wordpress/block-editor"); let _wordpress_i18n = require("@wordpress/i18n"); let _wordpress_components = require("@wordpress/components"); let __placeholder_jsx = require("./placeholder.cjs"); __placeholder_jsx = __toESM(__placeholder_jsx); let react_jsx_runtime = require("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__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Button, { __next40pxDefaultSize: true, onClick: () => void setAttributes({ legacy: false }), variant: "primary", children: (0, _wordpress_i18n.__)("Switch to editable mode") }, "convert")]; const blockProps = (0, _wordpress_block_editor.useBlockProps)({ className: (0, clsx.default)({ [`has-text-align-${textAlign}`]: textAlign }) }); return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.BlockControls, { group: "block", children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.AlignmentControl, { value: textAlign, onChange: (nextAlign) => { setAttributes({ textAlign: nextAlign }); } }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { ...blockProps, children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.Warning, { actions, children: (0, _wordpress_i18n.__)("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__ */ (0, react_jsx_runtime.jsx)(__placeholder_jsx.default, { postId, postType })] })] }); } exports.default = CommentsLegacy; //# sourceMappingURL=comments-legacy.cjs.map