From 03ab05ebfbe4e8bc2b775f4e655954900b85600c Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 5 Dec 2024 15:27:32 +0200 Subject: [PATCH] Remove words count in the multi-selection inspector (#67624) Co-authored-by: ntsekouras Co-authored-by: Mamaduka Co-authored-by: jasmussen Co-authored-by: t-hamano Co-authored-by: afercia --- .../multi-selection-inspector/index.js | 44 +++++++------------ .../multi-selection-inspector/style.scss | 12 ----- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/packages/block-editor/src/components/multi-selection-inspector/index.js b/packages/block-editor/src/components/multi-selection-inspector/index.js index f5e7f696347686..23d890d79fff4d 100644 --- a/packages/block-editor/src/components/multi-selection-inspector/index.js +++ b/packages/block-editor/src/components/multi-selection-inspector/index.js @@ -3,9 +3,8 @@ */ import { sprintf, _n } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; -import { serialize } from '@wordpress/blocks'; -import { count as wordCount } from '@wordpress/wordcount'; import { copy } from '@wordpress/icons'; +import { __experimentalHStack as HStack } from '@wordpress/components'; /** * Internal dependencies @@ -14,33 +13,24 @@ import BlockIcon from '../block-icon'; import { store as blockEditorStore } from '../../store'; export default function MultiSelectionInspector() { - const { blocks } = useSelect( ( select ) => { - const { getMultiSelectedBlocks } = select( blockEditorStore ); - return { - blocks: getMultiSelectedBlocks(), - }; - }, [] ); - const words = wordCount( serialize( blocks ), 'words' ); - + const selectedBlockCount = useSelect( + ( select ) => select( blockEditorStore ).getSelectedBlockCount(), + [] + ); return ( -
+ -
-
- { sprintf( - /* translators: %d: number of blocks */ - _n( '%d Block', '%d Blocks', blocks.length ), - blocks.length - ) } -
-
- { sprintf( - /* translators: %d: number of words */ - _n( '%d word selected.', '%d words selected.', words ), - words - ) } -
+
+ { sprintf( + /* translators: %d: number of blocks */ + _n( '%d Block', '%d Blocks', selectedBlockCount ), + selectedBlockCount + ) }
-
+
); } diff --git a/packages/block-editor/src/components/multi-selection-inspector/style.scss b/packages/block-editor/src/components/multi-selection-inspector/style.scss index 61bf5f8cdb3820..e37245d58f5dd5 100644 --- a/packages/block-editor/src/components/multi-selection-inspector/style.scss +++ b/packages/block-editor/src/components/multi-selection-inspector/style.scss @@ -1,25 +1,13 @@ .block-editor-multi-selection-inspector__card { - display: flex; - align-items: flex-start; padding: $grid-unit-20; } -.block-editor-multi-selection-inspector__card-content { - flex-grow: 1; -} - .block-editor-multi-selection-inspector__card-title { font-weight: 500; - margin-bottom: 5px; -} - -.block-editor-multi-selection-inspector__card-description { - font-size: $default-font-size; } .block-editor-multi-selection-inspector__card .block-editor-block-icon { margin-left: -2px; - margin-right: 10px; padding: 0 3px; width: $button-size; height: $button-size-small;