Skip to content

allowedBlocks attribute implementation at cover #31312

@ajotka

Description

@ajotka

What problem does this address?

It would be great to have an option to pass allowedBlocks to cover block.

A cover usually consists of a combination of the following blocks: heading, paragraph, list, and button. The ability to add other core blocks makes it easy for people to make frontend... bad.

I saw someone else PR of the same problem for the column, so I decided to apply for a cover block as well. 😃
(#18164, #25183, #25778)

Example

  const ALLOWED_BLOCKS = [
      "core/paragraph",
      "core/heading",
      "core/button",
  ];
  
  const TEMPLATE = [
	[ 'core/cover', 
	      {
		customOverlayColor: '#150F45',
		dimRatio: 100,
		allowedBlocks: ALLOWED_BLOCKS,
	      },
	      [
		      [ 'core/heading', {
			      level: 1,
			      content: __( 'Page Title' ),
			      align: 'left',
		      } ],
		      [ 'core/paragraph', {
			      content: __( 'Lorem ipsum dolor sit amet' ),
			      align: 'left',
		      } ],
	      ],
	],
  ];
  

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Technical FeedbackNeeds testing from a developer perspective.[Block] CoverAffects the Cover Block - used to display content laid over a background image[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions