-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Try: Allow format configuration for Paragraph and Heading blocks #69738
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +33 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
Flaky tests detected in 4c59cf9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/14122925879
|
cc @WordPress/gutenberg-core |
Cool idea. What was the reason you preferred adding a new attribute over putting it as another property for |
No particular reason, but I like the idea, and Thanks for the suggestion, @gziolo! I'm going to update the implementation. |
Updated to use the |
This is probably an edge case. I don't think we should enable this setting for every block; text blocks like Paragraph/Heading make more sense than design blocks like Search, IMO. |
Can we add an instruction either before or after this section? P.S. Perhaps we should have added |
I know we have a precedent for this in the The problem with this approach is that it makes something that should be dynamic and updatable static and fixed. When using an attribute what happens when the user installs a new plugin that comes with a richTextFormat? There is no way to update already inserted blocks to also allow this format type to be inserted. This was part of the reason why we moved the I'm not saying this isn't useful. I created an issue about it a while back (#46551). So I'm all for new ways to solve it and since we already have precedent for it I won't block this PR. Just wanted to share my concerns about it's limitations :) |
What?
Closes #43084.
PR introduces a new
metadata.allowedFormats
attribute for Heading and Paragraph blocks, which allows the user to control the formats displayed for individual blocks.The implementation is similar to the
allowedBlocks
attribute for container blocks, but configuration is part of themetadata
attribute, which, as its name suggests, is more appropriate for similar settings.Note
I'm only adding this new attribute to the most widely used RichText blocks; the remaining blocks can be updated as needed, so there's no need to rush the process.
Why?
Gives consumers more granular control when creating patterns or custom container blocks.
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast