diff --git a/packages/block-editor/src/components/block-info-slot-fill/index.js b/packages/block-editor/src/components/block-info-slot-fill/index.js index bba49bc7cc637..db7919b6ef5ea 100644 --- a/packages/block-editor/src/components/block-info-slot-fill/index.js +++ b/packages/block-editor/src/components/block-info-slot-fill/index.js @@ -7,11 +7,18 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components'; * Internal dependencies */ import { unlock } from '../../lock-unlock'; +import useDisplayBlockControls from '../use-display-block-controls'; const { createPrivateSlotFill } = unlock( componentsPrivateApis ); const { Fill, Slot } = createPrivateSlotFill( 'BlockInformation' ); -const BlockInfo = ( props ) => ; +const BlockInfo = ( props ) => { + const isDisplayed = useDisplayBlockControls(); + if ( ! isDisplayed ) { + return null; + } + return ; +}; BlockInfo.Slot = ( props ) => ; export default BlockInfo; diff --git a/packages/block-library/src/query/hooks.js b/packages/block-library/src/query/hooks.js deleted file mode 100644 index 1f367e13d019f..0000000000000 --- a/packages/block-library/src/query/hooks.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * WordPress dependencies - */ -import { __ } from '@wordpress/i18n'; -import { createInterpolateElement } from '@wordpress/element'; -import { addQueryArgs } from '@wordpress/url'; -import { createHigherOrderComponent } from '@wordpress/compose'; -import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; - -/** - * Internal dependencies - */ -import { unlock } from '../private-apis'; - -const { BlockInfo } = unlock( blockEditorPrivateApis ); -const CreateNewPostLink = ( { - attributes: { query: { postType } = {} } = {}, -} ) => { - if ( ! postType ) return null; - const newPostUrl = addQueryArgs( 'post-new.php', { - post_type: postType, - } ); - return ( -
- { createInterpolateElement( - __( 'Add new post' ), - // eslint-disable-next-line jsx-a11y/anchor-has-content - { a: } - ) } -
- ); -}; - -/** - * Override the default edit UI to include layout controls - * - * @param {Function} BlockEdit Original component - * @return {Function} Wrapped component - */ -const queryTopBlockInfo = createHigherOrderComponent( - ( BlockEdit ) => ( props ) => { - const { name, isSelected } = props; - if ( name !== 'core/query' || ! isSelected ) { - return ; - } - - return ( - <> - - - - - - ); - }, - 'withBlockInfo' -); - -export default queryTopBlockInfo;