UNPKG

@wordpress/editor

Version:
23 lines (20 loc) 832 B
import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { useSelect } from '@wordpress/data'; import { _x } from '@wordpress/i18n'; import { count as wordCount } from '@wordpress/wordcount'; export default function WordCount() { const content = useSelect(select => select('core/editor').getEditedPostAttribute('content')); /* * translators: If your word count is based on single characters (e.g. East Asian characters), * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. * Do not translate into your own language. */ const wordCountType = _x('words', 'Word count type. Do not translate!'); return createElement("span", { className: "word-count" }, wordCount(content, wordCountType)); } //# sourceMappingURL=index.js.map