Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowedBlocks attribute implementation at cover #31312

Closed
ajotka opened this issue Apr 29, 2021 · 0 comments
Closed

allowedBlocks attribute implementation at cover #31312

ajotka opened this issue Apr 29, 2021 · 0 comments
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image Needs Technical Feedback Needs testing from a developer perspective. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@ajotka
Copy link
Contributor

ajotka commented Apr 29, 2021

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',
		      } ],
	      ],
	],
  ];
  
@ajotka ajotka changed the title allowedBlock attribute implementation at cover allowedBlocks attribute implementation at cover Apr 29, 2021
@skorasaurus skorasaurus added [Status] In Progress Tracking issues with work in progress [Block] Cover Affects the Cover Block - used to display content laid over a background image Needs Technical Feedback Needs testing from a developer perspective. [Type] Enhancement A suggestion for improvement. labels May 3, 2021
mkaz pushed a commit that referenced this issue Oct 16, 2021
* Add allowedBlocks and templateLock attributes to Cover Block

Add an option to pass allowedBlocks to Cover Block.
Usage:
[ 'core/cover',
	  {
		allowedBlocks: ALLOWED_BLOCKS,
		templateLock: "insert",
	  },
	  []
],

Feature from #31312

* Add new attributes to edit.native

* Remove templatelock default

* Remove templatelock default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image Needs Technical Feedback Needs testing from a developer perspective. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants