UNPKG

@gechiui/block-editor

Version:
66 lines (61 loc) 1.68 kB
import { createElement, Fragment } from "@gechiui/element"; /** * External dependencies */ import { orderBy } from 'lodash'; import classnames from 'classnames'; /** * GeChiUI dependencies */ import { __ } from '@gechiui/i18n'; import { ToolbarItem, DropdownMenu, Slot } from '@gechiui/components'; import { chevronDown } from '@gechiui/icons'; const POPOVER_PROPS = { position: 'bottom right', isAlternate: true }; const FormatToolbar = () => { return createElement(Fragment, null, ['bold', 'italic', 'link'].map(format => createElement(Slot, { name: `RichText.ToolbarControls.${format}`, key: format })), createElement(Slot, { name: "RichText.ToolbarControls" }, fills => { if (!fills.length) { return null; } const allProps = fills.map(_ref => { let [{ props }] = _ref; return props; }); const hasActive = allProps.some(_ref2 => { let { isActive } = _ref2; return isActive; }); return createElement(ToolbarItem, null, toggleProps => createElement(DropdownMenu, { icon: chevronDown /* translators: button label text should, if possible, be under 16 characters. */ , label: __('更多'), toggleProps: { ...toggleProps, className: classnames(toggleProps.className, { 'is-pressed': hasActive }), describedBy: __('显示更多块工具') }, controls: orderBy(fills.map(_ref3 => { let [{ props }] = _ref3; return props; }), 'title'), popoverProps: POPOVER_PROPS })); })); }; export default FormatToolbar; //# sourceMappingURL=index.js.map