UNPKG

@wordpress/block-library

Version:
70 lines (66 loc) 2 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = PostCommentsFormEdit; var _clsx = _interopRequireDefault(require("clsx")); var _blockEditor = require("@wordpress/block-editor"); var _components = require("@wordpress/components"); var _compose = require("@wordpress/compose"); var _i18n = require("@wordpress/i18n"); var _form = _interopRequireDefault(require("./form")); var _jsxRuntime = require("react/jsx-runtime"); /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function PostCommentsFormEdit({ attributes, context, setAttributes }) { const { textAlign } = attributes; const { postId, postType } = context; const instanceId = (0, _compose.useInstanceId)(PostCommentsFormEdit); const instanceIdDesc = (0, _i18n.sprintf)('comments-form-edit-%d-desc', instanceId); const blockProps = (0, _blockEditor.useBlockProps)({ className: (0, _clsx.default)({ [`has-text-align-${textAlign}`]: textAlign }), 'aria-describedby': instanceIdDesc }); return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, { group: "block", children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.AlignmentControl, { value: textAlign, onChange: nextAlign => { setAttributes({ textAlign: nextAlign }); } }) }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { ...blockProps, children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default, { postId: postId, postType: postType }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, { id: instanceIdDesc, children: (0, _i18n.__)('Comments form disabled in editor.') })] })] }); } //# sourceMappingURL=edit.js.map