Partially locked template wrongly shows notice about template mismatch #44231
Labels
[Feature] Block Locking
The API allowing for the ability to lock/unlock blocks
[Type] Enhancement
A suggestion for improvement.
Description
If a template of a post is only partially locked only the locked sections should be compared with the template for mismatches.
An example:
We have a custom post type with a template and a locked root via
'template_lock' => 'all'
. But a group block inside that post is unlocked by e.g. setting'templateLock' => false
.As soon as another block is added inside that group the block editor thinks the content doesn't match the locked template and shows this notice:
But if a template intentionally makes some inner block areas editable changes to that area should be fine.
The problems seems to be that on the top level unlocked templates are considered.
gutenberg/packages/block-editor/src/store/actions.js
Lines 86 to 87 in c1cf175
But this same behavior is not implemented in nested blocks.
I'd assume that at this point
gutenberg/packages/blocks/src/api/templates.js
Lines 26 to 29 in c1cf175
additional checks for unlocked blocks (e.g. for
block.attributes.templateLock === false
) should be added, ignoring everything inside unlocked blocks.Step-by-step reproduction instructions
template_lock
set toall
core/group
) inside the template by setting'templateLock' => false
on itScreenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: