-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
post-title: add text styling options #31400
post-title: add text styling options #31400
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @kapilpaul! 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. |
@@ -12,7 +12,7 @@ import { | |||
BlockControls, | |||
InspectorControls, | |||
useBlockProps, | |||
PlainText, | |||
RichText, |
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.
Hi @kapilpaul, thanks for attempting this PR as a first contribution 🎉
However, simply changing the block's component from PlainText to RichText has a number of unexpected effects in other places that use the post title, as it currently is not expected to contain rich text and the new HTML added by the RichText is displayed as content, like in the example below:
Grabacion.de.pantalla.2021-05-03.a.las.18.03.21.mov
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.
Hi @priethor Thanks for reviewing it. I understand this will cause a lot of issues. So in that case, how can I achieve this feature? Do you have anything in mind? Can you please guide me?
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.
Achieving fine-grained styling options that require markup inside the post title content would require quite some architectural changes, so a better approach would be adding styles that affect the whole block rather than the content in a similar way Font Size and Line Height work.
Users won't be able to make "Hello" bold and "world" italic, for example, which I would say is a very specific and not-so-common use case, but the whole block would be bold and/or italic. As these would be saved as block attributes and not inside the post title as markup, other uses of the post title like get_the_title()
won't be impacted.
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.
Exactly that comes to my mind. I will look deeper into it. Thanks for the guidance. I will work on it :)
Hi, Thanks for your contributions. Since your initial contribution, the issue has been fixed at #31117 |
Description
Currently, the Post Title block does not have any text styling options, like bold (or make the text normal weight if bold is the theme default), italics. So added a text styling options for creating more interesting blog pages.
issue: #31117
How has this been tested?
Added a Post Title block and put text in it. Then change the style to Bold/italic or others, it's working fine.
Screenshots
Types of changes
Added Text styling option eg: bold, italic, strikethrough
Checklist:
*.native.js
files for terms that need renaming or removal).