Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment: Expanded contentOnly / write mode List block editing #65836

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support indent and outdent
  • Loading branch information
talldan committed Oct 2, 2024
commit 9641814a629825ffa2b86431c46fd6bcb5ecc39f
11 changes: 8 additions & 3 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
@@ -1635,7 +1635,7 @@ const canInsertBlockTypeUnmemoized = (
}

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

@@ -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;
}

1 change: 1 addition & 0 deletions packages/block-library/src/list-item/edit.js
Original file line number Diff line number Diff line change
@@ -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 );
Loading