Block Types Data Edit

Namespace: core/blocks.

Selectors Selectors

# getBlockStyles

Returns block styles by block name.

Parameters

  • state Object: Data state.
  • name string: Block type name.

Returns

  • ?Array: Block Styles.

# getBlockSupport

Returns the block support value for a feature, if defined.

Parameters

  • state Object: Data state.
  • nameOrType (string|Object): Block name or type object
  • feature string: Feature to retrieve
  • defaultSupports *: Default value to return if not explicitly defined

Returns

  • ?*: Block support value

# getBlockType

Returns a block type by name.

Parameters

  • state Object: Data state.
  • name string: Block type name.

Returns

  • ?Object: Block Type.

# getBlockTypes

Returns all the available block types.

Parameters

  • state Object: Data state.

Returns

  • Array: Block Types.

# getCategories

Returns all the available categories.

Parameters

  • state Object: Data state.

Returns

  • Array: Categories list.

# getChildBlockNames

Returns an array with the child blocks of a given block.

Parameters

  • state Object: Data state.
  • blockName string: Block type name.

Returns

  • Array: Array of child block names.

# getDefaultBlockName

Returns the name of the default block name.

Parameters

  • state Object: Data state.

Returns

  • ?string: Default block name.

# getFreeformFallbackBlockName

Returns the name of the block for handling non-block content.

Parameters

  • state Object: Data state.

Returns

  • ?string: Name of the block for handling non-block content.

# getUnregisteredFallbackBlockName

Returns the name of the block for handling unregistered blocks.

Parameters

  • state Object: Data state.

Returns

  • ?string: Name of the block for handling unregistered blocks.

# hasBlockSupport

Returns true if the block defines support for a feature, or false otherwise.

Parameters

  • state Object: Data state.
  • nameOrType (string|Object): Block name or type object.
  • feature string: Feature to test.
  • defaultSupports boolean: Whether feature is supported by default if not explicitly defined.

Returns

  • boolean: Whether block supports feature.

# hasChildBlocks

Returns a boolean indicating if a block has child blocks or not.

Parameters

  • state Object: Data state.
  • blockName string: Block type name.

Returns

  • boolean: True if a block contains child blocks and false otherwise.

# hasChildBlocksWithInserterSupport

Returns a boolean indicating if a block has at least one child block with inserter support.

Parameters

  • state Object: Data state.
  • blockName string: Block type name.

Returns

  • boolean: True if a block contains at least one child blocks with inserter support and false otherwise.

# isMatchingSearchTerm

Returns true if the block type by the given name or object value matches a
search term, or false otherwise.

Parameters

  • state Object: Blocks state.
  • nameOrType (string|Object): Block name or type object.
  • searchTerm string: Search term by which to filter.

Returns

  • Array<Object>: Wheter block type matches search term.

Top ↑

Actions Actions

# addBlockStyles

Returns an action object used in signalling that new block styles have been added.

Parameters

  • blockName string: Block name.
  • styles (Array|Object): Block styles.

Returns

  • Object: Action object.

# addBlockTypes

Returns an action object used in signalling that block types have been added.

Parameters

  • blockTypes (Array|Object): Block types received.

Returns

  • Object: Action object.

# removeBlockStyles

Returns an action object used in signalling that block styles have been removed.

Parameters

  • blockName string: Block name.
  • styleNames (Array|string): Block style names.

Returns

  • Object: Action object.

# removeBlockTypes

Returns an action object used to remove a registered block type.

Parameters

  • names (string|Array): Block name.

Returns

  • Object: Action object.

# setCategories

Returns an action object used to set block categories.

Parameters

  • categories Array<Object>: Block categories.

Returns

  • Object: Action object.

# setDefaultBlockName

Returns an action object used to set the default block name.

Parameters

  • name string: Block name.

Returns

  • Object: Action object.

# setFreeformFallbackBlockName

Returns an action object used to set the name of the block used as a fallback
for non-block content.

Parameters

  • name string: Block name.

Returns

  • Object: Action object.

# setUnregisteredFallbackBlockName

Returns an action object used to set the name of the block used as a fallback
for unregistered blocks.

Parameters

  • name string: Block name.

Returns

  • Object: Action object.

# updateCategory

Returns an action object used to update a category.

Parameters

  • slug string: Block category slug.
  • category Object: Object containing the category properties that should be updated.

Returns

  • Object: Action object.