From 7d8e7943b7e60b8022662b81bef6de37cdcdfcf4 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 9 Nov 2022 20:11:50 +0400 Subject: [PATCH 1/2] Cover: Avoid content loss when the templateLock value is all or contentOnly --- packages/block-library/src/cover/edit/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/cover/edit/index.js b/packages/block-library/src/cover/edit/index.js index 4d7aba03dc7fa3..fe453cfe2842c3 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -188,7 +188,7 @@ function CoverEdit( { className: 'wp-block-cover__inner-container', }, { - template: innerBlocksTemplate, + template: ! hasInnerBlocks ? innerBlocksTemplate : undefined, templateInsertUpdatesSelection: true, allowedBlocks, templateLock, From d13b73fef08455747db6a591508316ec2924d380 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 10 Nov 2022 09:10:49 +0400 Subject: [PATCH 2/2] Add inline comment --- packages/block-library/src/cover/edit/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-library/src/cover/edit/index.js b/packages/block-library/src/cover/edit/index.js index fe453cfe2842c3..88f97297a5d93d 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -188,6 +188,8 @@ function CoverEdit( { className: 'wp-block-cover__inner-container', }, { + // Avoid template sync when the `templateLock` value is `all` or `contentOnly`. + // See: https://github.com/WordPress/gutenberg/pull/45632 template: ! hasInnerBlocks ? innerBlocksTemplate : undefined, templateInsertUpdatesSelection: true, allowedBlocks,