Skip to content

Commit

Permalink
Use BlockDescription to format block.description in oik-block/blockinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Sep 21, 2022
1 parent 0a07eff commit d521422
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/oik-blockinfo/blockinfo.js
Expand Up @@ -9,7 +9,7 @@
import {BlockSupportsInserter, getBlockorVariation} from "../oik-blockicon/blockicons";
import {BlockVariations } from "../oik-blockicon/blockvariations";
import { BlockiconStyled } from '../oik-blockicon/blockicons.js';
import { BlockListItem } from '../oik-blocklist/blocklist';
import { BlockListItem, BlockDescription } from '../oik-blocklist/blocklist';

/**
*
Expand Down Expand Up @@ -43,7 +43,7 @@ function BlockinfoStyled( blocknamebarvariation, showBlockLink, showBlockIcon, s
//console.log( blockicon );
var blockTypeName = showBlockTypeName ? <div>{block.block_name} {block.name}</div> : null;
var blockTitle = showTitle ? <div>{block.title}</div> : null;
var blockDescription = showDescription ? <div>{block.description}</div> : null;
var blockDescription = showDescription ? BlockDescription( block.description ) : null;
var blockCategory = showCategory ? <div>{block.category}</div> : null;
var keywords = block.keywords ? block.keywords.join() : null;
var blockKeywords = showKeywords ? <div>{keywords}</div> : null;
Expand Down
8 changes: 6 additions & 2 deletions src/oik-blocklist/blocklist.js
Expand Up @@ -265,10 +265,14 @@ function BlockNoLink( block, component ) {
* @constructor
*/
function BlockDescription( description ) {
//console.log( description );
if ( typeof description === 'boolean') {
return( '' );
}
if ( typeof description === 'string' ) {
return(description);
} else {
//console.log( description );

var descFromFirstPara = 'TBC';
//descFromFirstPara = renderToString( <Fragment> {description} </Fragment>);
//console.log( descFromFirstPara);
Expand All @@ -280,4 +284,4 @@ function BlockDescription( description ) {
}
}

export { BlockListStyled, BlockListItem };
export { BlockListStyled, BlockListItem, BlockDescription };

0 comments on commit d521422

Please sign in to comment.