@wordpress/block-editor
Version:
39 lines (33 loc) • 1.04 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { Popover, ToolbarGroup } from '@wordpress/components';
/**
* Internal dependencies
*/
import BlockControls from '../block-controls';
import FormatToolbar from './format-toolbar';
const FormatToolbarContainer = ({
inline,
anchorRef
}) => {
if (inline) {
// Render in popover
return createElement(Popover, {
noArrow: true,
position: "top center",
focusOnMount: false,
anchorRef: anchorRef,
className: "block-editor-rich-text__inline-format-toolbar",
__unstableSlotName: "block-toolbar"
}, createElement("div", {
className: "block-editor-rich-text__inline-format-toolbar-group"
}, createElement(ToolbarGroup, null, createElement(FormatToolbar, null))));
} // Render regular toolbar
return createElement(BlockControls, {
group: "inline"
}, createElement(FormatToolbar, null));
};
export default FormatToolbarContainer;
//# sourceMappingURL=format-toolbar-container.js.map