diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js
index 01e725cc16cde6..f2c0c8576e7808 100644
--- a/packages/block-library/src/gallery/edit.js
+++ b/packages/block-library/src/gallery/edit.js
@@ -8,7 +8,6 @@ import clsx from 'clsx';
*/
import {
BaseControl,
- PanelBody,
SelectControl,
ToggleControl,
RangeControl,
@@ -16,6 +15,8 @@ import {
MenuGroup,
MenuItem,
ToolbarDropdownMenu,
+ __experimentalToolsPanel as ToolsPanel,
+ __experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import {
store as blockEditorStore,
@@ -560,84 +561,166 @@ export default function GalleryEdit( props ) {
return (
<>
-
+ {
+ setAttributes( {
+ columns: undefined,
+ imageCrop: true,
+ randomOrder: false,
+ linkTarget: undefined,
+ linkTo: 'none',
+ sizeSlug: 'large',
+ } );
+ } }
+ >
{ images.length > 1 && (
- !! columns }
+ onDeselect={ () =>
+ setAttributes( { columns: undefined } )
}
- onChange={ setColumnsNumber }
- min={ 1 }
- max={ Math.min( MAX_COLUMNS, images.length ) }
- { ...MOBILE_CONTROL_PROPS_RANGE_CONTROL }
- required
- __next40pxDefaultSize
- />
+ >
+
+
) }
+
{ imageSizeOptions?.length > 0 && (
-
+ hasValue={ () => ! ( sizeSlug === 'large' ) }
+ onDeselect={ () =>
+ // Pass the default value to the update function to reset the size.
+ setAttributes( { sizeSlug: 'large' } )
+ }
+ >
+
+
) }
+
{ Platform.isNative ? (
-
+ hasValue={ () => !! linkTo }
+ onDeselect={ () => {
+ setAttributes( { linkTo: undefined } );
+ } }
+ >
+
+
) : null }
-
- ! imageCrop }
+ onDeselect={ () =>
+ setAttributes( { imageCrop: true } )
+ }
+ >
+
+
+
+
- { hasLinkTo && (
+ hasValue={ () => !! randomOrder }
+ onDeselect={ () =>
+ setAttributes( { randomOrder: false } )
+ }
+ >
+
+
+ { hasLinkTo && (
+ !! linkTarget }
+ onDeselect={ () => {
+ setAttributes( { linkTarget: undefined } );
+ } }
+ >
+
+
) }
+
{ Platform.isWeb && ! imageSizeOptions && hasImageIds && (
- ! ( sizeSlug === 'large' ) }
+ onDeselect={ () => {
+ setAttributes( { sizeSlug: 'large' } );
+ } }
>
-
- { __( 'Resolution' ) }
-
-
-
- { __( 'Loading options…' ) }
-
-
+
+
+ { __( 'Resolution' ) }
+
+
+
+ { __( 'Loading options…' ) }
+
+
+
) }
-
+
{ Platform.isWeb ? (