-
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
[Mobile] Refactor is container related function #31625
Conversation
Size Change: +666 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
if ( | ||
blockType?.parent?.some( ( parent ) => { | ||
const blockTypeParent = getBlockType( parent ); | ||
const blockAlignParent = blockTypeParent?.supports?.align; | ||
return Array.isArray( blockAlignParent ) && blockAlignParent.includes( 'full' ); | ||
} ) | ||
) { | ||
return true; | ||
} | ||
|
||
return false; | ||
}; |
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.
NP: We can return the condition itself here.
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.
good catch! I split the function into 2 so that it is a bit easier to understand what is going on
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!
This PR refactor the current is_container_related function.
Description
It used the block's meta data to figure out is a container is related and removed the need to manage a whitelist. That needs to get updated every time we add support for a nested block.
This change was done so that it will be easier to add the full-width feature to other blocks.
How has this been tested?
Types of changes
Refactor
Checklist:
*.native.js
files for terms that need renaming or removal).