bobbingwide / oik-blocks

WordPress 5.0 blocks for oik shortcodes
https://oik-plugins.com/oik-plugins/oik-blocks
GNU General Public License v3.0
1 stars 0 forks source link

Since Gutenberg v8.8.0 oik-blocks doesn't list core-embed blocks #39

Open bobbingwide opened 4 years ago

bobbingwide commented 4 years ago

core-embedis not available in Prefix select box. Why not?

bobbingwide commented 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.

bobbingwide commented 4 years ago

Requirements

The following blocks will need changing to support block variations.

  1. oik-blocks/blockicon
  2. oik-blocks/blockinfo
  3. oik-blocks/blocklist

oik-blocks/blockicon

oik-blocks/blockinfo

oik-blocks/blocklist

Also, the core BlockIcon should be displayed by passing icon={block.icon}. Was icon={block.icon.src}.

bobbingwide commented 4 years ago

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.

  1. blockName string: Name of block (example: “core/columns”).
  2. scope [WPBlockVariationScope]: Block variation scope name.

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.

bobbingwide commented 2 years ago

The Show block description toggle can be removed

Do two things at the same time.