Skip to content

Commit

Permalink
Post Featured Image: Use the 'ResolutionTool' component (#68294)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
  • Loading branch information
3 people authored Dec 26, 2024
1 parent c0329d9 commit b7356af
Showing 1 changed file with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ import {
} from '@wordpress/components';
import {
useSettings,
privateApis as blockEditorPrivateApis,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { unlock } from '../lock-unlock';

const { ResolutionTool } = unlock( blockEditorPrivateApis );

const SCALE_OPTIONS = (
<>
<ToggleGroupControlOption
Expand Down Expand Up @@ -223,30 +231,19 @@ const DimensionControls = ( {
</ToolsPanelItem>
) }
{ !! imageSizeOptions.length && (
<ToolsPanelItem
hasValue={ () => !! sizeSlug }
label={ __( 'Resolution' ) }
onDeselect={ () =>
setAttributes( { sizeSlug: undefined } )
<ResolutionTool
panelId={ clientId }
value={ sizeSlug }
defaultValue={ DEFAULT_SIZE }
options={ imageSizeOptions }
onChange={ ( nextSizeSlug ) =>
setAttributes( { sizeSlug: nextSizeSlug } )
}
isShownByDefault={ false }
resetAllFilter={ () => ( {
sizeSlug: undefined,
sizeSlug: DEFAULT_SIZE,
} ) }
isShownByDefault={ false }
panelId={ clientId }
>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Resolution' ) }
value={ sizeSlug || DEFAULT_SIZE }
options={ imageSizeOptions }
onChange={ ( nextSizeSlug ) =>
setAttributes( { sizeSlug: nextSizeSlug } )
}
help={ __( 'Select the size of the source image.' ) }
/>
</ToolsPanelItem>
/>
) }
</>
);
Expand Down

1 comment on commit b7356af

@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 b7356af.
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/12500975843
📝 Reported issues:

Please sign in to comment.