Skip to content

Commit

Permalink
add ability to show drop cap setting in paragraph block by default
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Nov 23, 2022
1 parent d98e24e commit ccafe49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
useBlockProps,
useSetting,
} from '@wordpress/block-editor';
import { createBlock } from '@wordpress/blocks';
import { createBlock, getBlockSupport } from '@wordpress/blocks';
import { formatLtr } from '@wordpress/icons';

/**
Expand Down Expand Up @@ -77,6 +77,11 @@ function ParagraphBlock( {
helpText = __( 'Toggle to show a large initial letter.' );
}

const defaultTypographyControls = getBlockSupport( name, [
'typography',
'__experimentalDefaultControls',
] );

return (
<>
<BlockControls group="block">
Expand Down Expand Up @@ -106,6 +111,7 @@ function ParagraphBlock( {
onDeselect={ () =>
setAttributes( { dropCap: undefined } )
}
isShownByDefault={ defaultTypographyControls?.dropCap }
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
>
Expand Down

0 comments on commit ccafe49

Please sign in to comment.