UNPKG

@gechiui/block-editor

Version:
35 lines (31 loc) 802 B
/** * GeChiUI dependencies */ import { useSelect } from '@gechiui/data'; /** * Internal dependencies */ import { useBlockEditContext } from '../block-edit/context'; import { store as blockEditorStore } from '../../store'; export default function useDisplayBlockControls() { const { isSelected, clientId, name } = useBlockEditContext(); return useSelect(select => { if (isSelected) { return true; } const { getBlockName, isFirstMultiSelectedBlock, getMultiSelectedBlockClientIds } = select(blockEditorStore); if (isFirstMultiSelectedBlock(clientId)) { return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name); } return false; }, [clientId, isSelected, name]); } //# sourceMappingURL=index.js.map