CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
PostTypeSupportCheck: Handle support keys sub-features #71723
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
PostTypeSupportCheck: Handle support keys sub-features #71723
Conversation
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.
Pull Request Overview
This PR enhances the PostTypeSupportCheck
component to handle sub-feature support keys using dot notation (e.g., "editor.block-comments"). The component can now check for nested support properties in addition to top-level support keys.
- Adds a new
checkSupport
helper function to handle both top-level and sub-feature support checks - Updates the component to use the new helper function for support validation
- Adds comprehensive test coverage for the new sub-feature functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
packages/editor/src/components/post-type-support-check/index.js | Implements the core sub-feature support logic with new helper function |
packages/editor/src/components/post-type-support-check/test/index.js | Adds test cases for sub-feature support validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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. |
const [ subProperties ] = Array.isArray( supports[ topKey ] ) | ||
? supports[ topKey ] | ||
: []; |
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.
Need to add a comment here to mention the odd shape support value when using sub-features.
Example
{
"title": true,
"editor": true,
"author": true,
"test1": [
[
"block-comments"
]
],
"test2": [
{
"block-comments": true
}
],
}
Size Change: +61 B (0%) Total Size: 1.95 MB
ℹ️ View Unchanged
|
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.
Looks good, thanks!
c5a0875
to
3dbee33
Compare
Thanks for testing, @adamsilverstein! I've updated the PR description to include more details. |
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.
LGTM! Deep nesting is weird, but we need to maintain the current specification for backward compatibility 😅
Flaky tests detected in 3dbee33. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17856755771
|
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
What?
Related #71682 (comment).
Updates
PostTypeSupportCheck
component to handle support keys sub-feature checks.Note: Currently, it only supports one level of nesting for simplicity. Technically, we could support more complex paths, but sub-properties can have different shapes.
Why?
Some new editor features rely on these sub-properties.
Testing Instructions
PR has unit tests.
Testing Instructions for Keyboard
Same.