-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add layout default value support for blocks #34194
Conversation
Size Change: +16 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
const { | ||
allowSwitching: canBlockSwitchLayout, | ||
default: defaultBlockLayout, | ||
} = getBlockSupport( blockName, layoutBlockSupportKey ) || {}; |
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.
I think we should have a flag to disable all layout UI: Basically you should be able to choose a default layout but do not allow changes by the user.
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.
I add an allowEditing = true
flag and one more allowInheriting
for displaying the respective control. Seems like many flags are needed.. Do you have any thoughts if we can simplify these?
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.
I'm not sure yet but yes, it's something we need to think about while it's still experimental.
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.
This is looking good. Should we add
__experimentalLayout: {
default: { type: 'flow' },
allowEditing: false
}
to all the Core blocks like "Cover", "Media & Text", "Post Template"... (all the container blocks that are vertical/flow) in order to support the "block gap" theme.json config properly?
mmm tried testing a bit here while it works well for post-template, it seems to break the design for cover an media & text. So I guess these two blocks will have to wait for another PR (potentially trying to find a way to apply the layout styles to the right wrapper), for now we should remove the |
Description
Based on this comment: #34189 (comment)
This PR adds support for layout default value for a block. This will be later used for blocks like
Social Icons
(see first explorations WIP) where currently 'hack' theflex
layout styles instead of actually making it a declarative layout.A couple more flags were added:
allowSwitching
- it will show thelayout switcher
. This will probably be augmented in future explorations with a possiblesupportedLayouts
in a block.allowInheriting
- shows theinherit
toggleallowEditing
- hides completely all thelayout
Example for
block.json
insupports
: