diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 3d2f9a11f91a2..ec9e7b6952e08 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -501,7 +501,7 @@ Display a post's comments form. ([Source](https://github.com/WordPress/gutenberg - **Name:** core/post-comments-form - **Category:** theme - **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Attributes:** headingLevel, textAlign ## Post Comments Link diff --git a/packages/block-library/src/post-comments-form/block.json b/packages/block-library/src/post-comments-form/block.json index 47cc0a443baee..eeda9c1f68722 100644 --- a/packages/block-library/src/post-comments-form/block.json +++ b/packages/block-library/src/post-comments-form/block.json @@ -7,6 +7,10 @@ "description": "Display a post's comments form.", "textdomain": "default", "attributes": { + "headingLevel": { + "type": "number", + "default": 3 + }, "textAlign": { "type": "string" } diff --git a/packages/block-library/src/post-comments-form/edit.js b/packages/block-library/src/post-comments-form/edit.js index 56eab195b4a29..1283e7e312d4b 100644 --- a/packages/block-library/src/post-comments-form/edit.js +++ b/packages/block-library/src/post-comments-form/edit.js @@ -16,13 +16,14 @@ import { * Internal dependencies */ import CommentsForm from './form'; +import HeadingLevelDropdown from '../heading/heading-level-dropdown'; export default function PostCommentsFormEdit( { attributes, context, setAttributes, } ) { - const { textAlign } = attributes; + const { textAlign, headingLevel } = attributes; const { postId, postType } = context; const blockProps = useBlockProps( { @@ -40,9 +41,19 @@ export default function PostCommentsFormEdit( { setAttributes( { textAlign: nextAlign } ); } } /> + + setAttributes( { headingLevel: newHeadingLevel } ) + } + />
- +
); diff --git a/packages/block-library/src/post-comments-form/form.js b/packages/block-library/src/post-comments-form/form.js index a71f8231acafa..2307a91a9687a 100644 --- a/packages/block-library/src/post-comments-form/form.js +++ b/packages/block-library/src/post-comments-form/form.js @@ -17,13 +17,17 @@ import { useDisabled, useInstanceId } from '@wordpress/compose'; import { useEntityProp, store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; -const CommentsFormPlaceholder = () => { +const CommentsFormPlaceholder = ( { headingLevel } ) => { + const HeadingTagName = 'h' + headingLevel; + const disabledFormRef = useDisabled(); const instanceId = useInstanceId( CommentsFormPlaceholder ); return (
-

{ __( 'Leave a Reply' ) }

+ + { __( 'Leave a Reply' ) } +