Block Editor: Introduce experimental features API - #20623
Conversation
|
Size Change: +289 B (0%) Total Size: 904 kB
ℹ️ View Unchanged
|
| * | ||
| * @return {Object} The block editor feature object. | ||
| */ | ||
| export function __experimentalGetFeature( state, featureName ) { |
There was a problem hiding this comment.
What happens if we decide to introduce block based features in the future, do you think we can write this selector in a future proof way? I guess having an example in a block or something would help clarify things a bit.
There was a problem hiding this comment.
How about the following:
export function __experimentalGetFeature( state, featureName, blockName ) {I didn't want to cover the per block approach in the first iteration because of the legacy considerations with the block editor setting that needs to be addressed first.
How about we land an initial version and then I can branch and open two PRs:
- sync story for existing settings
- drop cap implementation that works also on a block type level?
There was a problem hiding this comment.
Yeah, that works for me if we keep things experimental.
export function __experimentalGetFeature( state, featureName, blockName )
Is the blockName the only thing that could affect the result? Maybe it is, just trying to think ahead.
There was a problem hiding this comment.
The one thing I'm not sure about is whether we always want to return an object with a feature's config.
I'd be interested to see the following as well:
const isDropCapAllowed = wp.data.select( 'core/block-editor' ).__experimentalGetFeature( 'typography.allowDropCap', 'core/paragraph' );I can't think about anything else at the moment.
There was a problem hiding this comment.
How about we land an initial version and then I can branch and open two PRs:
* sync story for existing settings * drop cap implementation that works also on a block type level?
Sounds good.
|
Really excited to see this land! ❤️ |
5870d99 to
13593c0
Compare
Description
Implements the ideas shared in https://make.wordpress.org/core/2020/01/23/controlling-the-block-editor/.
Part of #20588.
Related to: #21490, #20290.
Work in progress, all APIs are experimental.
How has this been tested?
Tests only at the moment.
Screenshots
Types of changes
Checklist: