UNPKG

@wordpress/block-library

Version:
51 lines (47 loc) 1.41 kB
import { createElement, Fragment } from "@wordpress/element"; /** * External dependencies */ import classnames from 'classnames'; /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { AlignmentControl, BlockControls, useBlockProps } from '@wordpress/block-editor'; /** * Renders the `core/comment-reply-link` block on the editor. * * @param {Object} props React props. * @param {Object} props.setAttributes Callback for updating block attributes. * @param {Object} props.attributes Block attributes. * @param {string} props.attributes.textAlign The `textAlign` attribute. * * @return {JSX.Element} React element. */ function Edit(_ref) { let { setAttributes, attributes: { textAlign } } = _ref; const blockProps = useBlockProps({ className: classnames({ [`has-text-align-${textAlign}`]: textAlign }) }); const blockControls = createElement(BlockControls, { group: "block" }, createElement(AlignmentControl, { value: textAlign, onChange: newAlign => setAttributes({ textAlign: newAlign }) })); return createElement(Fragment, null, blockControls, createElement("div", blockProps, createElement("a", { href: "#comment-reply-pseudo-link", onClick: event => event.preventDefault() }, __('Reply')))); } export default Edit; //# sourceMappingURL=edit.js.map