From 2b1b80ea98de13ccd28b537cfaadee0cd601647c Mon Sep 17 00:00:00 2001 From: Ella <4710635+ellatrix@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:01:58 +0200 Subject: [PATCH] useBlockProps: remove dead code (#61133) Co-authored-by: ellatrix Co-authored-by: youknowriad --- .../use-block-moving-mode-class-names.js | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 packages/block-editor/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js b/packages/block-editor/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js deleted file mode 100644 index 686e719196f982..00000000000000 --- a/packages/block-editor/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * External dependencies - */ -import classnames from 'classnames'; - -/** - * WordPress dependencies - */ -import { useSelect } from '@wordpress/data'; - -/** - * Internal dependencies - */ -import { store as blockEditorStore } from '../../../store'; - -/** - * Returns the class names used for block moving mode. - * - * @param {string} clientId The block client ID to insert above. - * - * @return {string} The class names. - */ -export function useBlockMovingModeClassNames( clientId ) { - return useSelect( - ( select ) => { - const { - hasBlockMovingClientId, - canInsertBlockType, - getBlockName, - getBlockRootClientId, - isBlockSelected, - } = select( blockEditorStore ); - - // The classes are only relevant for the selected block. Avoid - // re-rendering all blocks! - if ( ! isBlockSelected( clientId ) ) { - return; - } - - const movingClientId = hasBlockMovingClientId(); - - if ( ! movingClientId ) { - return; - } - - return classnames( 'is-block-moving-mode', { - 'can-insert-moving-block': canInsertBlockType( - getBlockName( movingClientId ), - getBlockRootClientId( clientId ) - ), - } ); - }, - [ clientId ] - ); -}