Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove words count in the multi-selection inspector #67624

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,27 +19,20 @@ export default function MultiSelectionInspector() {
blocks: getMultiSelectedBlocks(),
ntsekouras marked this conversation as resolved.
Show resolved Hide resolved
};
}, [] );
const words = wordCount( serialize( blocks ), 'words' );

return (
<div className="block-editor-multi-selection-inspector__card">
<HStack
justify="flex-start"
spacing={ 2 }
className="block-editor-multi-selection-inspector__card"
>
<BlockIcon icon={ copy } showColors />
<div className="block-editor-multi-selection-inspector__card-content">
<div className="block-editor-multi-selection-inspector__card-title">
{ sprintf(
/* translators: %d: number of blocks */
_n( '%d Block', '%d Blocks', blocks.length ),
blocks.length
) }
</div>
<div className="block-editor-multi-selection-inspector__card-description">
{ sprintf(
/* translators: %d: number of words */
_n( '%d word selected.', '%d words selected.', words ),
words
) }
</div>
<div className="block-editor-multi-selection-inspector__card-title">
{ sprintf(
/* translators: %d: number of blocks */
_n( '%d Block', '%d Blocks', blocks.length ),
blocks.length
) }
</div>
</div>
</HStack>
);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading