Skip to content

Commit

Permalink
Support indent and outdent
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Oct 2, 2024
1 parent 62af365 commit 9641814
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ const canInsertBlockTypeUnmemoized = (
}

const _isSectionBlock = !! isSectionBlock( state, rootClientId );
if ( _isSectionBlock ) {
if ( _isSectionBlock && ! allowsContentOnlyInsertion ) {
return false;
}

Expand Down Expand Up @@ -1784,12 +1784,17 @@ export function canRemoveBlock( state, clientId ) {
}

const rootClientId = getBlockRootClientId( state, clientId );
if ( getTemplateLock( state, rootClientId ) ) {
const templateLock = getTemplateLock( state, rootClientId );
const parentBlockListSettings = getBlockListSettings( state, rootClientId );
const allowsContentOnlyInsertion =
templateLock === 'contentOnly' &&
!! parentBlockListSettings?.contentOnlyInsertion;
if ( templateLock && ! allowsContentOnlyInsertion ) {
return false;
}

const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
if ( isBlockWithinSection ) {
if ( isBlockWithinSection && ! allowsContentOnlyInsertion ) {
return false;
}

Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/list-item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default function ListItemEdit( {
const innerBlocksProps = useInnerBlocksProps( blockProps, {
renderAppender: false,
__unstableDisableDropZone: true,
contentOnlyInsertion: true,
} );
const useEnterRef = useEnter( { content, clientId } );
const useSpaceRef = useSpace( clientId );
Expand Down

0 comments on commit 9641814

Please sign in to comment.