Skip to content
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

Conversation

kapilpaul
Copy link
Contributor

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

06B64782-D2A9-4076-B18B-280E9B7D415D

Types of changes

Added Text styling option eg: bold, italic, strikethrough

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@kapilpaul kapilpaul requested a review from ajitbohra as a code owner May 1, 2021 17:59
@github-actions
Copy link

github-actions bot commented May 1, 2021

👋 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.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label May 1, 2021
@@ -12,7 +12,7 @@ import {
BlockControls,
InspectorControls,
useBlockProps,
PlainText,
RichText,
Copy link
Contributor

@priethor priethor May 3, 2021

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

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

@priethor priethor mentioned this pull request May 4, 2021
13 tasks
@skorasaurus
Copy link
Member

Hi,

Thanks for your contributions. Since your initial contribution, the issue has been fixed at #31117

@skorasaurus skorasaurus closed this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants