UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

26 lines 1.14 kB
import React from 'react'; import { useEditorToolbar } from '@atlaskit/editor-common/toolbar'; import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar'; import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals'; const isFullPage = editorAppearance => { return editorAppearance === 'full-page' || editorAppearance === 'full-width'; }; const getBreakpointPreset = (breakpointPreset, editorAppearance) => { if (breakpointPreset) { return breakpointPreset; } return editorAppearance && isFullPage(editorAppearance) ? 'fullpage' : 'reduced'; }; export const PrimaryToolbar = ({ children, breakpointPreset }) => { const { editorAppearance } = useEditorToolbar(); return /*#__PURE__*/React.createElement(PrimaryToolbarBase, { testId: expValEquals('editor_a11y__primary-toolbar-aria-label_fy27', 'isEnabled', true) ? 'editor-primary-toolbar' : undefined, label: expValEquals('editor_a11y__primary-toolbar-aria-label_fy27', 'isEnabled', true) ? undefined : 'Primary Toolbar', breakpointPreset: getBreakpointPreset(breakpointPreset, editorAppearance) }, children); };