-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments Query Loop: Update default template #40165
Conversation
The fontSize prop default is set to 'small'. The isLink prop is set to true. Blocks with changes are: - Comment Author Name - Comment Date - Comment Edit Link - Comment Reply Link
Size Change: +107 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the user experience, it looks better to me 🙂 Thanks for the PR David!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👍
I'm happy to approve it already as the suggestions are non-blocking and can be done in a follow-up PR.
(the video got cut-off in a weird way, sorry about that)
2022-04-07_17-57-12.mp4
@@ -27,6 +27,9 @@ function render_block_core_comment_author_name( $attributes, $content, $block ) | |||
if ( isset( $attributes['textAlign'] ) ) { | |||
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] ); | |||
} | |||
if ( isset( $attributes['fontSize'] ) ) { | |||
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to escape the attributes here, they are already escaped in get_block_wrapper_attributes()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we don't use the get_block_wrapper_attributes()
function to display that class, I guess that's the reason why we have it there.
$wrapper_attributes = get_block_wrapper_attributes(); | ||
$classes = ''; | ||
if ( isset( $attributes['fontSize'] ) ) { | ||
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to escape the attributes here, they are already escaped in get_block_wrapper_attributes()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there an issue created for this? It has not been solved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @carolinan, you're right; there's no issue created. 😅 Feel free to open one and address it.
@@ -31,6 +31,9 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) { | |||
if ( isset( $attributes['textAlign'] ) ) { | |||
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] ); | |||
} | |||
if ( isset( $attributes['fontSize'] ) ) { | |||
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to escape the attributes here, they are already escaped in get_block_wrapper_attributes()
.
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] ); | ||
} | ||
if ( isset( $attributes['fontSize'] ) ) { | ||
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to escape the attributes here, they are already escaped in get_block_wrapper_attributes()
.
To clarify the columns comment: if the avatar block had a percentage width and scaled to its column, the columns block is arguably the right one to use. It's mainly that there are multiple widths you need to update in order to change the avatar size, that's a bit of a challenge at the moment. |
Thanks, @michalczaplinski, and @jasmussen for your useful feedback. I'll work on the suggested changes in a follow-up PR. 😁 |
@@ -160,7 +163,7 @@ function test_rendering_comment_template_nested() { | |||
|
|||
$this->assertEquals( | |||
gutenberg_render_block_core_comment_template( null, null, $block ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected value should go first here as well.
What?
Changes the default template to make it more aesthetic. Also, it modifies the default values of some block attributes.
Why?
To let editor users have a first good structure for the Comments Query Loop inner blocks.
How?
innerBlocks
for the Comments Query Loop block.isLink
andfontSize
attributes ofTesting Instructions
Screenshots or screencast