Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Merge paragraph text settings into typography panel
  • Loading branch information
aaronrobertshaw committed Nov 15, 2021
commit 808e46c820d5c8e89d48ae853ff2afb1f6e78b2c
16 changes: 12 additions & 4 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import classnames from 'classnames';
import { __, _x, isRTL } from '@wordpress/i18n';
import {
ToolbarDropdownMenu,
PanelBody,
ToggleControl,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import {
AlignmentControl,
Expand Down Expand Up @@ -81,8 +81,16 @@ function ParagraphBlock( {
/>
</BlockControls>
{ isDropCapFeatureEnabled && (
<InspectorControls>
<PanelBody title={ __( 'Text settings' ) }>
<InspectorControls __experimentalGroup="typography">
<ToolsPanelItem
hasValue={ () => !! dropCap }
label={ __( 'Drop cap' ) }
onDeselect={ () =>
setAttributes( { dropCap: undefined } )
}
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
>
<ToggleControl
label={ __( 'Drop cap' ) }
checked={ !! dropCap }
Expand All @@ -97,7 +105,7 @@ function ParagraphBlock( {
)
}
/>
</PanelBody>
</ToolsPanelItem>
</InspectorControls>
) }
<RichText
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/tools-panel/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export const ToolsPanelItem = css`
/* Remove BaseControl components margins and leave spacing to grid layout */
&& ${ BaseControlWrapper } {
margin-bottom: 0;
/* The following allows controls with help text to maintain spacing. */
/* e.g. ToggleControls. */
display: flex;
flex-direction: column;
row-gap: ${ space( 3 ) };

${ BaseControlField } {
margin-bottom: 0;
Expand Down