Skip to content

Commit

Permalink
Set the 'defaultBlock' setting for Columns & List blocks (#59196)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
  • Loading branch information
3 people authored Feb 21, 2024
1 parent c253751 commit 45c03ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ import {
toWidthPrecision,
} from './utils';

const DEFAULT_BLOCK = {
name: 'core/column',
};

function ColumnsEditContainer( { attributes, setAttributes, clientId } ) {
const { isStackedOnMobile, verticalAlignment, templateLock } = attributes;
const { count, canInsertColumnBlock, minCount } = useSelect(
Expand Down Expand Up @@ -90,6 +94,8 @@ function ColumnsEditContainer( { attributes, setAttributes, clientId } ) {
className: classes,
} );
const innerBlocksProps = useInnerBlocksProps( blockProps, {
defaultBlock: DEFAULT_BLOCK,
directInsert: true,
orientation: 'horizontal',
renderAppender: false,
templateLock,
Expand Down
5 changes: 5 additions & 0 deletions packages/block-library/src/list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import OrderedListSettings from './ordered-list-settings';
import { migrateToListV2 } from './utils';
import TagName from './tag-name';

const DEFAULT_BLOCK = {
name: 'core/list-item',
};
const TEMPLATE = [ [ 'core/list-item' ] ];
const NATIVE_MARGIN_SPACING = 8;

Expand Down Expand Up @@ -125,6 +128,8 @@ export default function Edit( { attributes, setAttributes, clientId, style } ) {
} );

const innerBlocksProps = useInnerBlocksProps( blockProps, {
defaultBlock: DEFAULT_BLOCK,
directInsert: true,
template: TEMPLATE,
templateLock: false,
templateInsertUpdatesSelection: true,
Expand Down

0 comments on commit 45c03ac

Please sign in to comment.