@gechiui/block-editor
Version:
30 lines (25 loc) • 613 B
JavaScript
/**
* GeChiUI dependencies
*/
import { useSelect } from '@gechiui/data';
/**
* Internal dependencies
*/
import { store as blockEditorStore } from '../../store';
export default function useListViewClientIds( blocks ) {
return useSelect(
( select ) => {
const {
getDraggedBlockClientIds,
getSelectedBlockClientIds,
__unstableGetClientIdsTree,
} = select( blockEditorStore );
return {
selectedClientIds: getSelectedBlockClientIds(),
draggedClientIds: getDraggedBlockClientIds(),
clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree(),
};
},
[ blocks ]
);
}