UNPKG

@atlaskit/editor-plugin-insert-block

Version:

Insert block plugin for @atlaskit/editor-core

42 lines 1.75 kB
import React from 'react'; import { Popup } from '@atlaskit/editor-common/ui'; import InsertMenu, { DEFAULT_HEIGHT } from '../ElementBrowser/InsertMenu'; import { DropDownButton } from './dropdown-button'; // This determines how the popup should fit. We prefer the insert menu // opening on the bottom as we have a search bar and should only open on // top if there is more than sufficient room. const FIT_HEIGHT_BUFFER = 100; export const BlockInsertElementBrowser = props => { return /*#__PURE__*/React.createElement(React.Fragment, null, props.open && /*#__PURE__*/React.createElement(Popup, { target: props.plusButtonRef, fitHeight: DEFAULT_HEIGHT + FIT_HEIGHT_BUFFER, fitWidth: 350 // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed) , offset: [0, 3], mountTo: props.popupsMountPoint, boundariesElement: props.popupsBoundariesElement, scrollableElement: props.popupsScrollableElement, preventOverflow: true, alignX: "right" }, /*#__PURE__*/React.createElement(InsertMenu, { editorView: props.editorView, dropdownItems: props.items, onInsert: props.onInsert, toggleVisiblity: props.togglePlusMenuVisibility, showElementBrowserLink: props.showElementBrowserLink, pluginInjectionApi: props.pluginInjectionApi, isFullPageAppearance: props.isFullPageAppearance })), /*#__PURE__*/React.createElement(DropDownButton, { "aria-expanded": props.open, "aria-haspopup": true, handleRef: props.onRef, selected: props.open, disabled: props.disabled, onClick: props.onClick, onKeyDown: props.onKeyDown, spacing: props.spacing, label: props.label, "aria-keyshortcuts": "/" })); };