UNPKG

@wordpress/block-editor

Version:
46 lines (38 loc) 1.19 kB
import { createElement, Fragment } from "@wordpress/element"; /** * External dependencies */ import { View } from 'react-native'; /** * WordPress dependencies */ import { Children } from '@wordpress/element'; import { createSlotFill, BottomSheetConsumer } from '@wordpress/components'; /** * Internal dependencies */ import { useBlockEditContext } from '../block-edit/context'; import { BlockSettingsButton } from '../block-settings'; const { Fill, Slot } = createSlotFill('InspectorControls'); const FillWithSettingsButton = ({ children, ...props }) => { const { isSelected } = useBlockEditContext(); if (!isSelected) { return null; } return createElement(Fragment, null, createElement(Fill, props, createElement(BottomSheetConsumer, null, () => createElement(View, null, children))), Children.count(children) > 0 && createElement(BlockSettingsButton, null)); }; const InspectorControls = FillWithSettingsButton; InspectorControls.Slot = Slot; /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md */ export default InspectorControls; //# sourceMappingURL=index.native.js.map