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

Fix site editor rendering of Categories block #51329

Conversation

sunyatasattva
Copy link
Contributor

What?

The Categories block would not render properly within the site editor. Specifically:

  • Prefix and Suffix options were not shown when the block was selected.
  • Separator was not available in the advanced panel.
  • Alignment toolbar was not available in the toolbar.

Why?

#48940 reported the issue of missing the alignment toolbar. As I was investigating that, I found out a few more things were missing.

How?

The component was returning early in case no postId was found. Since no postId is present in the site editor, the early return was triggered. This PR makes sure that even in case we are in the site editor, we still output all the inspector controls, toolbars and prefix/suffix.

Testing Instructions

  1. Go to the Site Editor.
  2. Edit a Single Post template.
  3. Add the Categories block.
  4. Make sure that:
  5. Text alignment options are available in the toolbar.
  6. Prefix and suffix are available when the block is selected.
  7. Separator is available in the inspector controls (under “Advanced”).
  8. There is no loading state.
  9. Still shows the “Categories” placeholder.
  10. Go to the Post Editor.
  11. Add the Categories block.
  12. Make sure that:
  13. There is a loading state.
  14. Shows the correct categories.

The Categories block would not render properly within the site editor.
Specifically:

- Prefix and Suffix options were not shown when the block was selected.
- Separator was not available in the advanced panel.
- Alignment toolbar was not available in the toolbar.
Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well for me - it makes sense to move this logic into the main return statement with all the other conditional content.

Here is what I see in the Site Editor:

Before After
image image

I think we can bring this in! 🚢

@mikachan mikachan linked an issue Jun 8, 2023 that may be closed by this pull request
@mikachan mikachan added the [Block] Post Terms Affects the Post Terms Block label Jun 8, 2023
@mirka mirka requested a review from apeatling June 8, 2023 12:30
@sunyatasattva
Copy link
Contributor Author

Hello @mikachan @mirka and @apeatling I don't have merge authorization, so what can we do to bring this PR in?

@mikachan
Copy link
Member

I don't have merge authorization, so what can we do to bring this PR in?

I can merge this for you. Thank you for working on it! 🙇

@mikachan mikachan merged commit f173d64 into WordPress:trunk Jun 13, 2023
49 checks passed
@github-actions github-actions bot added this to the Gutenberg 16.1 milestone Jun 13, 2023
@mikachan mikachan added the [Type] Bug An existing feature does not function as intended label Jun 16, 2023
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
The Categories block would not render properly within the site editor.
Specifically:

- Prefix and Suffix options were not shown when the block was selected.
- Separator was not available in the advanced panel.
- Alignment toolbar was not available in the toolbar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Terms Affects the Post Terms Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Categories Block: No text alignment option
2 participants