Site Editor: Add new Post Comment Content block #35183
Conversation
If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Commenting here but we should transfer to the general tracking issue — the "Post" prefix is a bit pointless, we should simplify the naming of all these blocks to be "Comment Content", "Comment Author" etc. |
"lineHeight": true | ||
}, | ||
"html": false, | ||
"__experimentalLayout": true |
I think we will not need to add the __experimentalLayout
for this block. Layout is for container blocks that enables controlling width/height
.
Thanks, @ntsekouras. I did that because @SantosGuillamot suggested adding that specific setting. I'll talk with him to clarify that.
I suggested adding that because it's something supported in the Post Content block, and I thought it could be a good idea to follow a similar pattern. It seemed to me that it would add more flexibility for editing the layout, but I don't have a strong opinion here, so no problem if you feel it's better to change it
@scruffian @MaggieCabrera @jffng curious what has come up in themes as uses here.
I've not seen a real life use case where we'd want to use this outside of a post comment block.
I think layout
would make more sense in the parent blocks like Comment Loop
Correct. Example: editing the single post template in isolation, with no post data.
I presume you're referring to this interface in the current "Post Comment" block: I don't think we should offer this functionality in the Comment Content block since it is strictly a template-only block, IE it will always have an ID passed to it by the queried post.
Perfect! Here's the SVG:
Good point, these should probably be omitted :) |
I agree with @jameskoster , but let's change this when we have the |
Edit: I understand now. Imo we should update the Post Comment block to check the ID when the user adds it, and throw an "comment not found" error (or similar) if they input a bad ID. |
Makes completely sense, I'll do that. Thanks for all your feedback, guys. |
Settings are: * Typography and color settings (same as the Paragraph block) * Layout settings (same as Post Content block)
const commentContent = ( | ||
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> | ||
<Path | ||
fill-rule="evenodd" |
You have to change these props to fillRule
and clipRule
as Path
is a React component. This way it produces React Invalid DOM property
warnings.
@@ -15,13 +24,23 @@ export default function Edit( { context: { commentId } } ) { | |||
'content', | |||
commentId | |||
); | |||
|
|||
// Show a placeholder when there is no context. | |||
if ( ! commentId ) { |
If no commentId
exists the message should be something like no comment exists
.
If content
is undefined
has two cases:
- still loading
- comment doesn't exist (this can be handled in a separate PR though and has to do with
useEntityProp
)
The below if ( ! content?.rendered )
check (I had hastily added yesterday) is not correct as it should be shown when the comment exists and there is no content.
Description
This PR continues the implementation of the Post Comment Content block that already existed. It works inside the Post Comment block, using the
commentId
that it receives via context.Related to issue #30574.
Currently, it's WIP.
How has this been tested?
I'm using the following environment:
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).The text was updated successfully, but these errors were encountered: