Skip to content

Commit 2a6518d

Browse files
committed
fix: substitute from the root, fixes CTA and feature design
1 parent f4a8059 commit 2a6518d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/block/design-library/edit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const createBlockWithAttributes = ( blockName, attributes, innerBlocks, design )
4646
const previousBlockName = block[ 0 ]
4747
block = substituteCoreIfDisabled( ...block, substitutionRules )
4848
isDisabled = block[ 0 ] in disabledBlocks && disabledBlocks[ block[ 0 ] ] === BLOCK_STATE.DISABLED
49+
4950
// If the previous block is different from the new block, substitution has been made
5051
if ( ! hasSubstituted && previousBlockName !== block[ 0 ] ) {
5152
hasSubstituted = true
@@ -64,7 +65,8 @@ const createBlockWithAttributes = ( blockName, attributes, innerBlocks, design )
6465
} )
6566
}
6667

67-
innerBlocks = traverseBlocksAndSubstitute( innerBlocks )
68+
// Substitute from the root of the design
69+
[ blockName, attributes, innerBlocks ] = traverseBlocksAndSubstitute( [ [ blockName, attributes, innerBlocks ] ] )[ 0 ]
6870

6971
if ( hasSubstituted ) {
7072
// eslint-disable-next-line no-alert

0 commit comments

Comments
 (0)