UNPKG

@atlaskit/editor-plugin-quick-insert

Version:

Quick insert plugin for @atlaskit/editor-core

28 lines 1.41 kB
import React, { useCallback } from 'react'; import { useIntl } from 'react-intl'; import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages'; import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item'; import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal'; export var QuickInsertMenuFooterItem = function QuickInsertMenuFooterItem(_ref) { var api = _ref.api; var _useIntl = useIntl(), formatMessage = _useIntl.formatMessage; var onSelect = useCallback(function (_ref2) { var _api$quickInsert$comm, _api$quickInsert; var insert = _ref2.insert; var tr = insert(undefined); return (_api$quickInsert$comm = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.commands.openElementBrowser()({ tr: tr })) !== null && _api$quickInsert$comm !== void 0 ? _api$quickInsert$comm : tr; }, [api]); return /*#__PURE__*/React.createElement(QuickInsertMenuItem, { ariaLabel: formatMessage(toolbarInsertBlockMessages.viewMoreAriaLabel), iconBefore: /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, { label: "" }), isDisabled: !(api !== null && api !== void 0 && api.quickInsert), onSelect: onSelect, shouldWrapIcon: false, title: formatMessage(toolbarInsertBlockMessages.viewMore) }); };