@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
34 lines • 1.33 kB
JavaScript
import React from 'react';
import { TOOLBARS } from '@atlaskit/editor-common/toolbar';
import { isToolbar } from '../../../utils/toolbar';
import { ToolbarNext } from '../../Toolbar/Toolbar';
/**
* Primary toolbar driven by components registered by `editor-plugin-toolbar`, introduced in `platform_editor_toolbar_aifc`.
*/
export const CommentToolbar = ({
editorAPI,
editorView,
editorAppearance,
disabled,
popupsBoundariesElement,
popupsMountPoint,
popupsScrollableElement
}) => {
var _editorAPI$toolbar;
const components = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$toolbar = editorAPI.toolbar) === null || _editorAPI$toolbar === void 0 ? void 0 : _editorAPI$toolbar.actions.getComponents();
const toolbar = components === null || components === void 0 ? void 0 : components.find(component => component.key === TOOLBARS.PRIMARY_TOOLBAR);
if (!components || !isToolbar(toolbar)) {
return null;
}
return /*#__PURE__*/React.createElement(ToolbarNext, {
toolbar: toolbar,
components: components,
editorView: editorView,
editorAPI: editorAPI,
editorAppearance: editorAppearance,
isDisabled: disabled,
popupsBoundariesElement: popupsBoundariesElement,
popupsScrollableElement: popupsScrollableElement,
popupsMountPoint: popupsMountPoint
});
};