import React from 'react'; import { EditorView } from 'prosemirror-view'; import { OnInsert } from '../../../../ui/ElementBrowser/types'; import { BlockInsertElementBrowser } from './block-insert-element-browser'; import { BlockInsertMenuLegacy } from './block-insert-menu-legacy'; import { BlockMenuItem } from './create-items'; import { DropDownButton } from './dropdown-button'; export interface BlockInsertMenuProps { disabled: boolean; editorView: EditorView; items: BlockMenuItem[]; label: string; open: boolean; plusButtonRef?: HTMLElement; popupsBoundariesElement?: HTMLElement; popupsMountPoint?: HTMLElement; popupsScrollableElement?: HTMLElement; replacePlusMenuWithElementBrowser: boolean; spacing: 'none' | 'default'; onRef(el: HTMLElement): void; onPlusButtonRef(el: HTMLElement): void; onClick: React.MouseEventHandler; onItemActivated(attrs: any): void; onInsert: OnInsert; onOpenChange(attrs: any): void; togglePlusMenuVisibility(): void; } export const BlockInsertMenu: React.FC = (props) => { if (props.items.length === 0) { return null; } if (props.disabled) { return (
); } if (props.replacePlusMenuWithElementBrowser) { return ( ); } return ( ); };