-
Notifications
You must be signed in to change notification settings - Fork 4k
/
index.js
41 lines (38 loc) · 1.27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* WordPress dependencies
*/
import { sprintf, __ } from '@wordpress/i18n';
import { withSelect } from '@wordpress/data';
import { serialize } from '@wordpress/blocks';
import { count as wordCount } from '@wordpress/wordcount';
import {
Path,
SVG,
} from '@wordpress/components';
/**
* Internal Dependencies
*/
import BlockIcon from '../block-icon';
function MultiSelectionInspector( { blocks } ) {
return (
<div className="editor-multi-selection-inspector__card">
<BlockIcon icon={
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><Path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z" /></SVG>
} showColors />
<div className="editor-multi-selection-inspector__card-content">
<div className="editor-multi-selection-inspector__card-title">
{ sprintf( __( '%d blocks' ), blocks.length ) }
</div>
<div className="editor-multi-selection-inspector__card-description">
{ sprintf( __( '%d words.' ), wordCount( serialize( blocks ), 'words' ) ) }
</div>
</div>
</div>
);
}
export default withSelect( ( select ) => {
const { getMultiSelectedBlocks } = select( 'core/editor' );
return {
blocks: getMultiSelectedBlocks(),
};
} )( MultiSelectionInspector );