Display heading levels dynamically in Heading Options when Heading block is selected #14688
Labels
[Block] Heading
Affects the Headings Block
[Feature] Extensibility
The ability to extend blocks or the editing experience
[Type] Enhancement
A suggestion for improvement.
So far, the heading levels are hardcoded in the Heading Edit component.
Here are the current lines of code in
public_html/wp-content/plugins/gutenberg/packages/block-library/src/heading
:And
However, under some circumstances, this selection could be limited by using
blocks.registerBlockType
filter to a reduced set of headings. Right now this is tricky due to the hardcoded numbers.Describe the solution you'd like
Dynamically, extract the level numbers from
selector
attribute inattributes.content
for Heading Block and generate the range of selectors based on that list.I'm pushing a PR to demonstrate in a sec.
The text was updated successfully, but these errors were encountered: