UNPKG

@gechiui/block-editor

Version:
34 lines (28 loc) 895 B
/** * GeChiUI dependencies */ import { useContext } from '@gechiui/element'; import { Disabled } from '@gechiui/components'; import deprecated from '@gechiui/deprecated'; /** * Internal dependencies */ import InsertionPoint, { InsertionPointOpenRef } from './insertion-point'; import BlockPopover from './block-popover'; export default function BlockToolsBackCompat( { children } ) { const openRef = useContext( InsertionPointOpenRef ); const isDisabled = useContext( Disabled.Context ); // If context is set, `BlockTools` is a parent component. if ( openRef || isDisabled ) { return children; } deprecated( 'gc.components.Popover.Slot name="block-toolbar"', { alternative: 'gc.blockEditor.BlockTools', } ); return ( <InsertionPoint __unstablePopoverSlot="block-toolbar"> <BlockPopover __unstablePopoverSlot="block-toolbar" /> { children } </InsertionPoint> ); }