From 46b853b8c3c58134b1da37552c465b2c52ad5626 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 17 Jan 2024 15:15:10 +0800 Subject: [PATCH 1/3] Add image block support for pattern overrides --- packages/patterns/src/constants.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/patterns/src/constants.js b/packages/patterns/src/constants.js index 4a9f769658b2ec..5fa9ec44f4e3aa 100644 --- a/packages/patterns/src/constants.js +++ b/packages/patterns/src/constants.js @@ -28,4 +28,9 @@ export const PARTIAL_SYNCING_SUPPORTED_BLOCKS = { text: __( 'Text' ), url: __( 'URL' ), }, + 'core/image': { + url: __( 'URL' ), + title: __( 'Title' ), + alt: __( 'Alt Text' ), + }, }; From 2cf4c3cc71831139dec2fea4ad72c1a8995eed1f Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 17 Jan 2024 15:18:25 +0800 Subject: [PATCH 2/3] Hide the crop controls in content only mode --- packages/block-library/src/image/image.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index d8788fde4844f6..97783411b0c474 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -331,7 +331,11 @@ export default function Image( { }, [ isSelected ] ); const canEditImage = id && naturalWidth && naturalHeight && imageEditing; - const allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage; + const allowCrop = + ! multiImageSelection && + canEditImage && + ! isEditingImage && + hasNonContentControls; function switchToCover() { replaceBlocks( From 733eeb8104a9d9cff532a10f8f2e6d4f5cda3db2 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 17 Jan 2024 15:20:46 +0800 Subject: [PATCH 3/3] Revert "Hide the crop controls in content only mode" This reverts commit 2cf4c3cc71831139dec2fea4ad72c1a8995eed1f. --- packages/block-library/src/image/image.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index 97783411b0c474..d8788fde4844f6 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -331,11 +331,7 @@ export default function Image( { }, [ isSelected ] ); const canEditImage = id && naturalWidth && naturalHeight && imageEditing; - const allowCrop = - ! multiImageSelection && - canEditImage && - ! isEditingImage && - hasNonContentControls; + const allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage; function switchToCover() { replaceBlocks(