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