-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Closed
Copy link
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
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:
<HeadingToolbar minLevel={ 2 } maxLevel={ 5 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />And
<HeadingToolbar minLevel={ 1 } maxLevel={ 7 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />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 in attributes.content for Heading Block and generate the range of selectors based on that list.
I'm pushing a PR to demonstrate in a sec.
Metadata
Metadata
Assignees
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
