UNPKG

@atlaskit/editor-plugin-block-menu

Version:

BlockMenu plugin for @atlaskit/editor-core

24 lines 831 B
import React, { useMemo } from 'react'; import { BlockMenuComponents } from './BlockMenuComponents'; import { BLOCK_MENU_FALLBACKS } from './fallbacks'; import { buildChildrenMap, getSortedTopLevelSections } from './utils'; /** * BlockMenuRenderer orchestrates the rendering of the entire block menu hierarchy */ export const BlockMenuRenderer = ({ allRegisteredComponents, fallbacks = BLOCK_MENU_FALLBACKS }) => { const { childrenMap, topLevelSections } = useMemo(() => ({ childrenMap: buildChildrenMap(allRegisteredComponents), topLevelSections: getSortedTopLevelSections(allRegisteredComponents) }), [allRegisteredComponents]); return /*#__PURE__*/React.createElement(BlockMenuComponents, { registeredComponents: topLevelSections, childrenMap: childrenMap, fallbacks: fallbacks }); };