Add allowedBlocks and TemplateLock attributes in Cover Block #31326
+14
−0
Conversation
Add an option to pass allowedBlocks to Cover Block. Usage: [ 'core/cover', { allowedBlocks: ALLOWED_BLOCKS, templateLock: "insert", }, [] ], Feature from #31312
If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
@@ -306,6 +306,8 @@ function CoverEdit( { | |||
minHeightUnit, | |||
style: styleAttribute, | |||
url, | |||
allowedBlocks, | |||
templateLock = false, |
jorgefilipecosta
Apr 30, 2021
Member
Setting a default here explicitly removes the locking even if the attribute is unset causing a behavior change. I think we should not include the default here.
Setting a default here explicitly removes the locking even if the attribute is unset causing a behavior change. I think we should not include the default here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Description
According to #31312 request, I added allowedBlocks attribute for Cover Block.
How has this been tested? And Screenshots
Tested manually.
With
allowedBlocks = [ 'core/paragraph', 'core/heading', 'core/button' ]
Expectations: Possibility to add only Paragraph, Heading and/or Button
![image (3)](https://webcf.waybackmachine.org/web/20210503184122im_/https://user-images.githubusercontent.com/15144546/116533294-7e990e80-a8e1-11eb-8410-5728dadb54f9.png)
With templateLock
Expectations: No 'add block' button and no possibility to add block
![image (11)](https://webcf.waybackmachine.org/web/20210503184122im_/https://user-images.githubusercontent.com/15144546/116533365-9375a200-a8e1-11eb-9ee1-2e07235fb778.png)
Types of changes
block.json
false
) attributes to edit.jsChecklist:
*.native.js
files for terms that need renaming or removal).