UNPKG

@atlaskit/editor-plugin-block-menu

Version:

BlockMenu plugin for @atlaskit/editor-core

35 lines 1.21 kB
import React from 'react'; import { useIntl } from 'react-intl'; import { blockMenuMessages } from '@atlaskit/editor-common/messages'; import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar'; import ChevronRightIcon from '@atlaskit/icon/core/chevron-right'; const FallbackNestedMenu = ({ children }) => { const { formatMessage } = useIntl(); return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, { elemBefore: undefined, elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, { label: "", size: "small" }), text: formatMessage(blockMenuMessages.fallbackNestedMenu), enableMaxHeight: true, shouldFitContainer: true }, children); }; const FallbackMenuItem = () => { const { formatMessage } = useIntl(); return /*#__PURE__*/React.createElement(ToolbarDropdownItem, null, formatMessage(blockMenuMessages.fallbackMenuItem)); }; export const BLOCK_MENU_FALLBACKS = { 'block-menu-nested': FallbackNestedMenu, 'block-menu-section': ({ children }) => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children), 'block-menu-item': FallbackMenuItem };