@atlaskit/editor-plugin-toolbar-lists-indentation
Version:
Toolbar lists and indentation plugin for @atlaskit/editor-core
51 lines • 2.24 kB
JavaScript
import React from 'react';
import { LISTS_INDENTATION_GROUP, LISTS_INDENTATION_GROUP_COLLAPSED, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_PRIMARY_TOOLBAR_RANK, useEditorToolbar } from '@atlaskit/editor-common/toolbar';
import { Show, ToolbarButtonGroup } from '@atlaskit/editor-toolbar';
var ListsIndentationGroup = function ListsIndentationGroup(_ref) {
var children = _ref.children;
var _useEditorToolbar = useEditorToolbar(),
editorAppearance = _useEditorToolbar.editorAppearance;
if (editorAppearance === 'full-page') {
return /*#__PURE__*/React.createElement(Show, {
above: "xl"
}, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
}
};
var ListsIndentationGroupCollapsed = function ListsIndentationGroupCollapsed(_ref2) {
var children = _ref2.children;
var _useEditorToolbar2 = useEditorToolbar(),
editorAppearance = _useEditorToolbar2.editorAppearance;
if (editorAppearance === 'full-page') {
return /*#__PURE__*/React.createElement(Show, {
below: "xl"
}, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
}
return /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children);
};
export var getListsIndentationGroupForPrimaryToolbar = function getListsIndentationGroupForPrimaryToolbar() {
return [{
type: LISTS_INDENTATION_GROUP.type,
key: LISTS_INDENTATION_GROUP.key,
parents: [{
type: TEXT_SECTION_PRIMARY_TOOLBAR.type,
key: TEXT_SECTION_PRIMARY_TOOLBAR.key,
rank: TEXT_SECTION_PRIMARY_TOOLBAR_RANK[LISTS_INDENTATION_GROUP.key]
}],
component: function component(_ref3) {
var children = _ref3.children;
return /*#__PURE__*/React.createElement(ListsIndentationGroup, null, children);
}
}, {
type: LISTS_INDENTATION_GROUP_COLLAPSED.type,
key: LISTS_INDENTATION_GROUP_COLLAPSED.key,
parents: [{
type: TEXT_SECTION_PRIMARY_TOOLBAR.type,
key: TEXT_SECTION_PRIMARY_TOOLBAR.key,
rank: TEXT_SECTION_PRIMARY_TOOLBAR_RANK[LISTS_INDENTATION_GROUP.key]
}],
component: function component(_ref4) {
var children = _ref4.children;
return /*#__PURE__*/React.createElement(ListsIndentationGroupCollapsed, null, children);
}
}];
};