UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

24 lines 835 B
import React from 'react'; import { useEditorToolbar } from '@atlaskit/editor-common/toolbar'; import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar'; 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, { label: "Primary Toolbar", breakpointPreset: getBreakpointPreset(breakpointPreset, editorAppearance) }, children); };