From f55788bd50820b985ec0e9bb07934215ed8df9b0 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 19 Feb 2024 12:02:33 +0400 Subject: [PATCH 1/2] Gallery: Set the 'defaultBlock' setting for inner blocks --- packages/block-library/src/gallery/edit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 226e4da673d95..830d48501220f 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -73,6 +73,7 @@ const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative ? { type: 'stepper' } : {}; +const DEFAULT_BLOCK = { name: 'core/image' }; const EMPTY_ARRAY = []; function GalleryEdit( props ) { @@ -496,6 +497,7 @@ function GalleryEdit( props ) { }; const innerBlocksProps = useInnerBlocksProps( blockProps, { + defaultBlock: DEFAULT_BLOCK, orientation: 'horizontal', renderAppender: false, ...nativeInnerBlockProps, From 7c695ef8131aee9b9167f3032a0cc01ffc9d901e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 19 Feb 2024 15:32:34 +0400 Subject: [PATCH 2/2] Set 'directInsert' to true --- packages/block-library/src/gallery/edit.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 830d48501220f..0a9dd631dfe52 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -498,6 +498,7 @@ function GalleryEdit( props ) { const innerBlocksProps = useInnerBlocksProps( blockProps, { defaultBlock: DEFAULT_BLOCK, + directInsert: true, orientation: 'horizontal', renderAppender: false, ...nativeInnerBlockProps,