-
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
Block editor: Controlling the Block Editor #20588
Comments
Is this coming to core soon ? |
I would also like to know, thanks in advance. I may have missed where I could find the timeline on when this feature would be released. |
It's in active development. The next major WordPress release (5.5) is scheduled around August this year and it's the earliest when it can be included. I hope to get some initial APIs exposed in Gutenberg plugin in late April. |
Thanks @gziolo for the update! Fingers crossed that the team would be able to expose the API by late April! I'm especially interested in the ability to remove/ disable inspector or toolbar controls using this feature. |
I talked to @youknowriad and he proposed using the following structure for {
"global": {
"color": "var( --my-palette-color-one )",
"background": "var( --my-palette-color-two)",
"font-size": "var( --my-font-size)"
},
"blocks": {
"h2": {
"font-size": "calc( var( --my-font-size) * 2 )"
}
},
"config": {
"color": {
"palette": [],
"allowCustomColors": true,
"gradientPalette": [],
"allowCustomGradients": true
},
"typography": {
"fontSizes": [],
"allowCustomFontSize": true,
"allowDropCap": true
},
"blocks": {
"core/paragraph": {
"color": {
"palette": [],
"allowCustomColors": false
}
}
}
},
"ui": {
"palette": true,
"custom": {
"--my-font-size": { "type": "fontsize" },
"--random-variable": { "type": "number" }
}
}
} |
This looks promising. I'm wondering whether the config is supposed to work as an allow- or deny-list. If there is a config in place what happens when new features or core blocks are introduced? Are they blocked by default or enabled with default settings? The second option would imply that theme authors need to closely track future changes to the editor to achieve a consistent experience. |
I'm starting extended leave later this week (3 months) and I won't be able to finish this task until I'm back. If anyone wants to take over this task, feel free to do so :) The current behavior is documented at https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/themes/theme-json.md#features. The most important missing features have their own issues created:
|
I'll take this over. |
We've progressed a good bit and when #25148 lands we'll have this shape for the {
"features": {
"typography": {
"dropCap": true
},
"color": {
"custom": true,
"link": true
},
"gradient": {
"custom": true
},
"fontSize": {
"custom": true
},
"lineHeight": {
"custom": false
}
}
} Note that we only define 6 settings here. There are a few things I don't like with the current approach: how verbose it is and that there's no conceptual clarity/hierarchy (ex: there's a typography section but also fontSize & lineHeigh; link color is within color, but gradient is not). These are some alternatives I can think of: -- Plain approach: {
"features": {
"customColor": true,
"customFontSize": true,
"customGradient": true,
"customLineHeight": true,
"dropCap": true,
"linkColor": true
}
} -- Group by categories, as we do in styles: {
"features": {
"typography": {
"customFontSize": true,
"customLineHeight": true,
"dropCap": true
},
"color": {
"customColor": true,
"customGradient": true,
"link": true
}
}
} A related question I have is what we're going to do with things like |
|
@youknowriad and I talked about this and we see two options:
{
"presets": {
"color": [],
"gradient": [],
"fontSize": []
},
"features": {
"typography": {
"customFontSize": true,
"customLineHeight": true,
"dropCap": true
},
"color": {
"customColor": true,
"customGradient": true,
"link": true
},
"spacing": {
"custom": false,
"units": ["px", "em", "rem", "vh", "vw"]
}
},
"styles": {
"typography": {
"fontSize": "value",
"lineHeight": "value"
},
"color": {
"text": "value",
"background": "value",
"gradient": "value"
}
}
}
{
"features": {
"typography": {
"dropCap": true
},
"color": {
"custom": true,
"link": true,
"preset": []
},
"gradient": {
"custom": true,
"preset": []
},
"fontSize": {
"custom": true,
"preset": []
},
"lineHeight": {
"custom": false,
"preset": []
},
"spacing": {
"custom": false,
"units": ["px", "em", "rem", "vh", "vw"],
"preset": []
}
},
"styles": {
"typography": {
"fontSize": "value",
"lineHeight": "value"
},
"color": {
"text": "value",
"background": "value",
"gradient": "value"
}
}
} |
Personally, I lean towards the first option. It's a bit of everything: conceptually, |
Has there been any consideration for how child themes would override portions of this configuration? It seems like the editor could just merge the parent/child files before applying them, but I also have zero knowledge of the implementation and how practical/impractical that idea is. |
I think most of the time font style presets should combine font size and line height into a single preset, since the two are closely connected. Do these formats account for that? Similarly, it would be good to be able to define preset color schemes. |
@cbirdsong child themes support was a low priority so far given that we're still stabilizing |
@nosolosw, let's close this one and open more targeted follow-up issues if they don't exist already. |
Would really appreciate to control other support options such as alignment (for any specific blocks) and others. I'm thinking of the heading level (disable ability to have H1s) or columns variation (theme support only for 50/50 - because of design specs). |
Related: #6023, #6941, #7806. #7931, #8732, #14110 #15450, #18892.
The full story was shared by @youknowriad over a month ago:
https://make.wordpress.org/core/2020/01/23/controlling-the-block-editor/
I'm including the most important bits below:
There is also an expectation to have more grained control over features – to be able to apply customizations on the block type level as well. It's going to be explored as part of this work taking into account many existing issues where such capability was requested.
Tasks
usePreset('colors')
hook or consolidate touseEditorFeature('color.preset')
.The text was updated successfully, but these errors were encountered: