Skip to content

Commit

Permalink
Combine select
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 14, 2023
1 parent dec4fc7 commit 27ae6ba
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/block-library/src/list-item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ import { convertToListItems } from './utils';
export function IndentUI( { clientId } ) {
const indentListItem = useIndentListItem( clientId );
const outdentListItem = useOutdentListItem();
const canIndent = useSelect(
( select ) => select( blockEditorStore ).getBlockIndex( clientId ) > 0,
[ clientId ]
);
const canOutdent = useSelect(
const { canIndent, canOutdent } = useSelect(
( select ) => {
const { getBlockRootClientId, getBlockName } =
const { getBlockIndex, getBlockRootClientId, getBlockName } =
select( blockEditorStore );
return (
getBlockName(
getBlockRootClientId( getBlockRootClientId( clientId ) )
) === 'core/list-item'
);
return {
canIndent: getBlockIndex( clientId ) > 0,
canOutdent:
getBlockName(
getBlockRootClientId( getBlockRootClientId( clientId ) )
) === 'core/list-item',
};
},
[ clientId ]
);
Expand Down

0 comments on commit 27ae6ba

Please sign in to comment.