@gechiui/block-editor
Version:
49 lines (45 loc) • 1.47 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* GeChiUI dependencies
*/
import { sprintf, _n } from '@gechiui/i18n';
import { withSelect } from '@gechiui/data';
import { serialize } from '@gechiui/blocks';
import { count as wordCount } from '@gechiui/wordcount';
import { stack } from '@gechiui/icons';
/**
* Internal dependencies
*/
import BlockIcon from '../block-icon';
import { store as blockEditorStore } from '../../store';
function MultiSelectionInspector(_ref) {
let {
blocks
} = _ref;
const words = wordCount(serialize(blocks), 'words');
return createElement("div", {
className: "block-editor-multi-selection-inspector__card"
}, createElement(BlockIcon, {
icon: stack,
showColors: true
}), createElement("div", {
className: "block-editor-multi-selection-inspector__card-content"
}, createElement("div", {
className: "block-editor-multi-selection-inspector__card-title"
}, sprintf(
/* translators: %d: number of blocks */
_n('%d block', '%d blocks', blocks.length), blocks.length)), createElement("div", {
className: "block-editor-multi-selection-inspector__card-description"
}, sprintf(
/* translators: %d: number of words */
_n('%d word', '%d words', words), words))));
}
export default withSelect(select => {
const {
getMultiSelectedBlocks
} = select(blockEditorStore);
return {
blocks: getMultiSelectedBlocks()
};
})(MultiSelectionInspector);
//# sourceMappingURL=index.js.map