@gechiui/block-editor
Version:
44 lines (39 loc) • 1.24 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* External dependencies
*/
import { isEmpty } from 'lodash';
/**
* GeChiUI dependencies
*/
import { __experimentalStyleProvider as StyleProvider, __experimentalToolbarContext as ToolbarContext, ToolbarGroup } from '@gechiui/components';
/**
* Internal dependencies
*/
import useBlockControlsFill from './hook';
export default function BlockControlsFill(_ref) {
let {
group = 'default',
controls,
children,
__experimentalShareWithChildBlocks = false
} = _ref;
const Fill = useBlockControlsFill(group, __experimentalShareWithChildBlocks);
if (!Fill) {
return null;
}
return createElement(StyleProvider, {
document: document
}, createElement(Fill, null, fillProps => {
// Children passed to BlockControlsFill will not have access to any
// React Context whose Provider is part of the BlockControlsSlot tree.
// So we re-create the Provider in this subtree.
const value = !isEmpty(fillProps) ? fillProps : null;
return createElement(ToolbarContext.Provider, {
value: value
}, group === 'default' && createElement(ToolbarGroup, {
controls: controls
}), children);
}));
}
//# sourceMappingURL=fill.js.map