@atlaskit/editor-plugin-toolbar
Version:
Toolbar plugin for @atlaskit/editor-core
22 lines • 1.01 kB
JavaScript
import React from 'react';
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
import { PrimaryToolbar as PrimaryToolbarBase } from '@atlaskit/editor-toolbar/toolbar';
var isFullPage = function isFullPage(editorAppearance) {
return editorAppearance === 'full-page' || editorAppearance === 'full-width';
};
var getBreakpointPreset = function getBreakpointPreset(breakpointPreset, editorAppearance) {
if (breakpointPreset) {
return breakpointPreset;
}
return editorAppearance && isFullPage(editorAppearance) ? 'fullpage' : 'reduced';
};
export var PrimaryToolbar = function PrimaryToolbar(_ref) {
var children = _ref.children,
breakpointPreset = _ref.breakpointPreset;
var _useEditorToolbar = useEditorToolbar(),
editorAppearance = _useEditorToolbar.editorAppearance;
return /*#__PURE__*/React.createElement(PrimaryToolbarBase, {
testId: "editor-primary-toolbar",
breakpointPreset: getBreakpointPreset(breakpointPreset, editorAppearance)
}, children);
};