Skip to content

Commit

Permalink
Show Letter Spacing in Global Styles -> Typography -> Headings (#44142)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks authored Sep 16, 2022
1 parent ce37fe9 commit 556408f
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ function useHasAppearanceControl( name ) {
return hasFontStyles || hasFontWeights;
}

function useHasLetterSpacingControl( name ) {
function useHasLetterSpacingControl( name, element ) {
const setting = useSetting( 'typography.letterSpacing', name )[ 0 ];
if ( ! setting ) {
return false;
}
if ( ! name && element === 'heading' ) {
return true;
}
const supports = getSupportedGlobalStylesPanels( name );
return (
useSetting( 'typography.letterSpacing', name )[ 0 ] &&
supports.includes( 'letterSpacing' )
);
return supports.includes( 'letterSpacing' );
}

export default function TypographyPanel( { name, element } ) {
Expand All @@ -84,7 +88,7 @@ export default function TypographyPanel( { name, element } ) {
supports.includes( 'fontWeight' );
const hasLineHeightEnabled = useHasLineHeightControl( name );
const hasAppearanceControl = useHasAppearanceControl( name );
const hasLetterSpacingControl = useHasLetterSpacingControl( name );
const hasLetterSpacingControl = useHasLetterSpacingControl( name, element );

/* Disable font size controls when the option to style all headings is selected. */
let hasFontSizeEnabled = supports.includes( 'fontSize' );
Expand Down

0 comments on commit 556408f

Please sign in to comment.