Open bobbingwide opened 4 years ago
Core embed blocks are now Variations of the core/embed
block.
You can use getBlockVariations( state, blockName, scope )
to get the block variations by block name.
The following blocks will need changing to support block variations.
oik-blocks/blockicon
oik-blocks/blockinfo
Show block link
toggle is on each variation should link to the defined blockoik-blocks/blocklist
oikwp oik-create-blocks.php
commandsAlso, the core BlockIcon should be displayed by passing icon={block.icon}
. Was icon={block.icon.src}
.
You can use
getBlockVariations( state, blockName, scope )
to get the block variations by block name.
That's the theory. In practice I didn't know how to do this because I was trying to use the wrong API.
In https://developer.wordpress.org/block-editor/packages/packages-blocks/
getBlockVariations
is documented as taking two parameters.
where scope is 'block' or 'inserter'.
In https://developer.wordpress.org/block-editor/data/data-core-blocks/ there's a different function with the same name.
This is used when working with select( 'core/blocks')
.
This is the stuff that I'm still struggling to understand.
Fortunately, I don't need to use this function; I just needed to use the right values for the parameters to the first.
The Show block description toggle can be removed
Do two things at the same time.
showDescription
toggle to showVariations
; to optionally display the Variations.
core-embed
is not available in Prefix select box. Why not?