Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function MultiSelectionInspector( { blocks } ) {
const words = wordCount( serialize( blocks ), 'words' );
return (
<div>
</div>
calculateReadingTime() {
const { content, blocks } = this.props;
const words = wordcount( content, 'words', {} );
let estimated = ( words / 275 ) * 60; //get time on seconds
if ( blocks ) {
let i = 12;
map( blocks, ( block ) => {
if ( mediaBlocks.includes( block.name ) || hasBlockSupport( block.name, 'editorsKitWordCount' ) ) {
estimated = estimated + i;
if ( i > 3 ) {
i--;
}
}
} );
}
estimated = estimated / 60; //convert to minutes
//do not show zero
function WordCount( { 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 (
<span>{ wordCount( content, wordCountType ) }</span>
);
}