Skip to content

Commit

Permalink
List: disable nested list drop zone so dropping list items works (#45321
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ellatrix authored Nov 10, 2022
1 parent 3373e97 commit 9e4bc29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/block-editor/src/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ const ForwardedInnerBlocks = forwardRef( ( props, ref ) => {
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
*/
export function useInnerBlocksProps( props = {}, options = {} ) {
const { __unstableDisableLayoutClassNames } = options;
const { __unstableDisableLayoutClassNames, __unstableDisableDropZone } =
options;
const { clientId, __unstableLayoutClassNames: layoutClassNames = '' } =
useBlockEditContext();
const isSmallScreen = useViewportMatch( 'medium', '<' );
Expand Down Expand Up @@ -187,11 +188,13 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
[ clientId, isSmallScreen ]
);

const blockDropZoneRef = useBlockDropZone( {
rootClientId: clientId,
} );

const ref = useMergeRefs( [
props.ref,
useBlockDropZone( {
rootClientId: clientId,
} ),
__unstableDisableDropZone ? null : blockDropZoneRef,
] );

const innerBlocksProps = {
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 @@ -67,6 +67,7 @@ export default function ListItemEdit( {
const innerBlocksProps = useInnerBlocksProps( blockProps, {
allowedBlocks: [ 'core/list' ],
renderAppender: false,
__unstableDisableDropZone: true,
} );
const useEnterRef = useEnter( { content, clientId } );
const useSpaceRef = useSpace( clientId );
Expand Down

0 comments on commit 9e4bc29

Please sign in to comment.