diff --git a/packages/block-library/src/post-comments-form/edit.js b/packages/block-library/src/post-comments-form/edit.js index 24e4599dd46bb7..4df12c2e848c5b 100644 --- a/packages/block-library/src/post-comments-form/edit.js +++ b/packages/block-library/src/post-comments-form/edit.js @@ -13,9 +13,11 @@ import { useBlockProps, store as blockEditorStore, } from '@wordpress/block-editor'; +import { Button } from '@wordpress/components'; import { useEntityProp, store as coreStore } from '@wordpress/core-data'; -import { __, sprintf } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; + /** * Internal dependencies */ @@ -28,7 +30,7 @@ export default function PostCommentsFormEdit( { } ) { const { textAlign } = attributes; const { postId, postType } = context; - const [ commentStatus ] = useEntityProp( + const [ commentStatus, setCommentStatus ] = useEntityProp( 'postType', postType, 'comment_status', @@ -55,6 +57,7 @@ export default function PostCommentsFormEdit( { ); let warning = false; + let actions; let showPlaceholder = true; if ( ! isSiteEditor && 'open' !== commentStatus ) { @@ -66,6 +69,18 @@ export default function PostCommentsFormEdit( { ), postType ); + actions = [ + , + ]; showPlaceholder = false; } else if ( ! postTypeSupportsComments ) { warning = sprintf( @@ -95,7 +110,9 @@ export default function PostCommentsFormEdit( { />
- { warning && { warning } } + { warning && ( + { warning } + ) } { showPlaceholder ? : null }
diff --git a/packages/block-library/src/post-comments-form/editor.scss b/packages/block-library/src/post-comments-form/editor.scss index 7bb2fb1eb3e150..6c62dfd2568385 100644 --- a/packages/block-library/src/post-comments-form/editor.scss +++ b/packages/block-library/src/post-comments-form/editor.scss @@ -1,3 +1,7 @@ .wp-block-post-comments-form * { pointer-events: none; + + &.block-editor-warning * { + pointer-events: auto; + } }