diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js index 398016728c499c..eb5abe9c24d98f 100644 --- a/packages/block-library/src/query/edit/inspector-controls/index.js +++ b/packages/block-library/src/query/edit/inspector-controls/index.js @@ -12,10 +12,7 @@ import { __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { - InspectorControls, - privateApis as blockEditorPrivateApis, -} from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; import { debounce } from '@wordpress/compose'; import { useEffect, useState, useCallback } from '@wordpress/element'; @@ -138,156 +135,150 @@ export default function QueryInspectorControls( props ) { { showSettingsPanel && ( - - - { showInheritControl && ( - - setQuery( { inherit: !! value } ) - } - /> - ) } - { showPostTypeControl && ( - + { showInheritControl && ( + + setQuery( { inherit: !! value } ) + } + /> + ) } + { showPostTypeControl && ( + + ) } + { showColumnsControl && ( + <> + - ) } - { showColumnsControl && ( - <> - - setDisplayLayout( { - columns: value, - } ) - } - min={ 2 } - max={ Math.max( 6, displayLayout.columns ) } - /> - { displayLayout.columns > 6 && ( - - { __( - 'This column count exceeds the recommended amount and may cause visual breakage.' - ) } - - ) } - - ) } - { showOrderControl && ( - - ) } - { showStickyControl && ( - - setQuery( { sticky: value } ) + setDisplayLayout( { + columns: value, + } ) } + min={ 2 } + max={ Math.max( 6, displayLayout.columns ) } /> - ) } - 6 && ( + + { __( + 'This column count exceeds the recommended amount and may cause visual breakage.' + ) } + + ) } + + ) } + { showOrderControl && ( + + ) } + { showStickyControl && ( + + setQuery( { sticky: value } ) + } /> - - + ) } + + ) } { ! inherit && showFiltersPanel && ( - - { - setQuery( { - author: '', - parents: [], - search: '', - taxQuery: null, - } ); - setQuerySearch( '' ); - } } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } - > - { showTaxControl && ( - - Object.values( taxQuery || {} ).some( - ( terms ) => !! terms.length - ) - } - onDeselect={ () => - setQuery( { taxQuery: null } ) - } - > - - - ) } - { showAuthorControl && ( - !! authorIds } - label={ __( 'Authors' ) } - onDeselect={ () => setQuery( { author: '' } ) } - > - - - ) } - { showSearchControl && ( - !! querySearch } + { + setQuery( { + author: '', + parents: [], + search: '', + taxQuery: null, + } ); + setQuerySearch( '' ); + } } + dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + > + { showTaxControl && ( + + Object.values( taxQuery || {} ).some( + ( terms ) => !! terms.length + ) + } + onDeselect={ () => setQuery( { taxQuery: null } ) } + > + + + ) } + { showAuthorControl && ( + !! authorIds } + label={ __( 'Authors' ) } + onDeselect={ () => setQuery( { author: '' } ) } + > + + + ) } + { showSearchControl && ( + !! querySearch } + label={ __( 'Keyword' ) } + onDeselect={ () => setQuerySearch( '' ) } + > + setQuerySearch( '' ) } - > - - - ) } - { showParentControl && ( - !! parents?.length } - label={ __( 'Parents' ) } - onDeselect={ () => setQuery( { parents: [] } ) } - > - - - ) } - - + value={ querySearch } + onChange={ setQuerySearch } + /> + + ) } + { showParentControl && ( + !! parents?.length } + label={ __( 'Parents' ) } + onDeselect={ () => setQuery( { parents: [] } ) } + > + + + ) } + ) } ); diff --git a/packages/block-library/src/query/edit/query-content.js b/packages/block-library/src/query/edit/query-content.js index 4d9b8885cb15ea..77f9fb211e335b 100644 --- a/packages/block-library/src/query/edit/query-content.js +++ b/packages/block-library/src/query/edit/query-content.js @@ -112,13 +112,15 @@ export default function QueryContent( { setAttributes={ setAttributes } clientId={ clientId } /> - + + + + <> { isEntityAvailable && ( <> ) } - + ); } diff --git a/packages/block-library/src/template-part/edit/index.js b/packages/block-library/src/template-part/edit/index.js index 888f767635924f..ec92996978bd6f 100644 --- a/packages/block-library/src/template-part/edit/index.js +++ b/packages/block-library/src/template-part/edit/index.js @@ -9,6 +9,7 @@ import { store as blockEditorStore, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, + InspectorControls, } from '@wordpress/block-editor'; import { Spinner, Modal, MenuItem } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; @@ -159,14 +160,16 @@ export default function TemplatePartEdit( { return ( <> - 0 } - /> + + 0 } + /> + { isPlaceholder && ( - { - linkProps.onClick( event ); - } } - > - { __( 'Edit' ) } - - + { + linkProps.onClick( event ); + } } + > + { __( 'Edit' ) } + ); } @@ -72,9 +70,11 @@ export const withEditBlockControls = createHigherOrderComponent( return ( <> - + { isDisplayed && ( - + + + ) } );