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.
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.
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.
I'm not sure yet but yes, it's something we need to think about while it's still experimental.
youknowriad
left a comment
There was a problem hiding this comment.
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' theflexlayout 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 possiblesupportedLayoutsin a block.allowInheriting- shows theinherittoggleallowEditing- hides completely all thelayoutExample for
block.jsoninsupports: