Skip to content

Commit

Permalink
Paragraph: Update condition for rendering Drop Cap for a selected blo…
Browse files Browse the repository at this point in the history
…ck (#67111)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 0a6751c commit 8fa8506
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,24 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
}

return (
<ToolsPanelItem
hasValue={ () => !! dropCap }
label={ __( 'Drop cap' ) }
onDeselect={ () => setAttributes( { dropCap: undefined } ) }
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
>
<ToggleControl
__nextHasNoMarginBottom
<InspectorControls group="typography">
<ToolsPanelItem
hasValue={ () => !! dropCap }
label={ __( 'Drop cap' ) }
checked={ !! dropCap }
onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
help={ helpText }
disabled={ hasDropCapDisabled( align ) }
/>
</ToolsPanelItem>
onDeselect={ () => setAttributes( { dropCap: undefined } ) }
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Drop cap' ) }
checked={ !! dropCap }
onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
help={ helpText }
disabled={ hasDropCapDisabled( align ) }
/>
</ToolsPanelItem>
</InspectorControls>
);
}

Expand All @@ -96,6 +98,7 @@ function ParagraphBlock( {
onRemove,
setAttributes,
clientId,
isSelected: isSingleSelected,
} ) {
const { align, content, direction, dropCap, placeholder } = attributes;
const blockProps = useBlockProps( {
Expand Down Expand Up @@ -131,13 +134,13 @@ function ParagraphBlock( {
/>
</BlockControls>
) }
<InspectorControls group="typography">
{ isSingleSelected && (
<DropCapControl
clientId={ clientId }
attributes={ attributes }
setAttributes={ setAttributes }
/>
</InspectorControls>
) }
<RichText
identifier="content"
tagName="p"
Expand Down

1 comment on commit 8fa8506

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 8fa8506.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12006037191
📝 Reported issues:

Please sign in to comment.