-
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
[Block: Post comment author]: Add link settings and block supports #35595
[Block: Post comment author]: Add link settings and block supports #35595
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @c4rl0sbr4v0! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
As the task is quite similar to #30573, and @carolinan and @gziolo both worked on that. |
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 had some questions but overall this looks great. It’s very similar to the PR you linked 👍
<PanelBody title={ __( 'Link settings' ) }> | ||
<ToggleControl | ||
label={ __( 'Link to authors URL' ) } | ||
onChange={ () => setAttributes( { isLink: ! isLink } ) } |
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.
Should it also reset the link target when link gets disabled?
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 copied that attribute from Post Title block. There is no reset when you enable/disable the link.
Of course I can add a reset, but maybe we could create an issue to unify on all blocks with the same attribute to have the same behaviour?
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.
New issue for unification sounds like a good plan 👍
) } | ||
</PanelBody> | ||
</InspectorControls> | ||
<div { ...blockProps }>{ displayAuthor }</div> |
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 HTML generated doesn’t use <p>
tag anymore. Is that intentional?
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.
It was, but now that you mention, I will edit in order to have it again.
Is there any guide about how a block html structure should be?
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.
My best answer would be to ask theme experts @carolinan and @aristath for advice 😃
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 put the p
tag anyway 🙂
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.
Sure, we can iterate on it since we don't save the HTML output in the post/theme content, but use render_callback
on the server.
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.
It looks like there is no <p>
on the frontend when there is no link, so let's remove it here, too.
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.
If we remove the p on the editor the comments are all misaligned due to padding issues.
What would be a better approach?
- Leave as it was before this PR. This means no
<p>
on frontend, but<p>
on editor. - Add
<p>
on frontend, to have it both ways the same. - Remove
<p>
in both, use CSS to add a padding (personally I don't like this one really much). - Add an option so users can choose what they want to show on frontend
<p>, <span>, nothing, <div>
All feedback will be appreciated! I will leave by the moment as first option, as it was previously.
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.
Let's leave the old behavior and address it seperately.
This is very useful. Thank you for including. In this type of PRs it would be helpful to show also source code generated on the frontend. |
1be5200
to
4527237
Compare
4527237
to
f9c26e4
Compare
Update: everything is correct. It read the URL from the user's profile. When I added another user and a comment it links to the URL is set in the profile 👍🏻 |
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.
Everything looks good in my testing. The only thing that would be nice to unify between the frontend and the editor is the <p>
tag used when there is no link as noted in https://github.com/WordPress/gutenberg/pull/35595/files#r731835989.
Description
Closes #30572.
Used #30573 as a reference.
How has this been tested?
Screenshots
Loom with a summary:
https://www.loom.com/share/924ffd9e1d9d469ea4bbba6fe6529219
Source code generated on the frontend:
Types of changes
Enhancement
Checklist:
*.native.js
files for terms that need renaming or removal).