@wordpress/block-library
Version:
Block library for the WordPress editor.
49 lines (46 loc) • 1.07 kB
JavaScript
import { createElement, Fragment } from "@wordpress/element";
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { AlignmentControl, BlockControls, useBlockProps } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import CommentsForm from './form';
export default function PostCommentsFormEdit(_ref) {
let {
attributes,
context,
setAttributes
} = _ref;
const {
textAlign
} = attributes;
const {
postId,
postType
} = context;
const blockProps = useBlockProps({
className: classnames({
[`has-text-align-${textAlign}`]: textAlign
})
});
return createElement(Fragment, null, createElement(BlockControls, {
group: "block"
}, createElement(AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), createElement("div", blockProps, createElement(CommentsForm, {
postId: postId,
postType: postType
})));
}
//# sourceMappingURL=edit.js.map