Skip to content

Commit 52ebc7e

Browse files
authored
fix: text block - text to icon list transformation (#3686)
* fix: use "text" to also get text from stackable blocks * fix: add additional guard for parentUniqueId to sync its value with context
1 parent 0facd9f commit 52ebc7e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/block/icon-list-item/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const Edit = props => {
156156
openEvenIfUnselected={ true }
157157
hasLinearGradient={ false }
158158
/> }
159-
{ ! ordered && ! icon &&
159+
{ ! ordered && ! icon && parentUniqueId &&
160160
<Icon
161161
value={ getUseSvgDef( `#stk-icon-list__icon-svg-def-${ parentUniqueId }` ) }
162162
openEvenIfUnselected={ true }

src/block/icon-list/transforms.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ const transforms = {
5353
transform: blockAttributes => {
5454
let childBlocks = []
5555
if ( blockAttributes.length > 1 ) {
56-
childBlocks = blockAttributes.map( ( { content } ) => {
57-
return createBlock( 'stackable/icon-list-item', { text: content } )
56+
childBlocks = blockAttributes.map( ( { content, text } ) => {
57+
return createBlock( 'stackable/icon-list-item', { text: content ?? text ?? '' } )
5858
} )
5959
} else if ( blockAttributes.length === 1 ) {
6060
const value = create( {
61-
html: blockAttributes[ 0 ].content,
61+
html: blockAttributes[ 0 ].content ?? blockAttributes[ 0 ].text ?? '',
6262
} )
6363
childBlocks = split( value, '\n' ).map( result => {
6464
return createBlock( 'stackable/icon-list-item', {

0 commit comments

Comments
 (0)