@atlaskit/editor-plugin-toolbar-lists-indentation
Version:
Toolbar lists and indentation plugin for @atlaskit/editor-core
61 lines (60 loc) • 2.84 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getListsIndentationGroupForPrimaryToolbar = void 0;
var _react = _interopRequireDefault(require("react"));
var _context = require("@atlaskit/editor-common/toolbar/context");
var _keys = require("@atlaskit/editor-common/toolbar/keys");
var _rank = require("@atlaskit/editor-common/toolbar/rank");
var _show = require("@atlaskit/editor-toolbar/show");
var _toolbarButtonGroup = require("@atlaskit/editor-toolbar/toolbar-button-group");
var ListsIndentationGroup = function ListsIndentationGroup(_ref) {
var children = _ref.children;
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
editorAppearance = _useEditorToolbar.editorAppearance;
if (editorAppearance === 'full-page') {
return /*#__PURE__*/_react.default.createElement(_show.Show, {
above: "xl"
}, /*#__PURE__*/_react.default.createElement(_toolbarButtonGroup.ToolbarButtonGroup, null, children));
}
};
var ListsIndentationGroupCollapsed = function ListsIndentationGroupCollapsed(_ref2) {
var children = _ref2.children;
var _useEditorToolbar2 = (0, _context.useEditorToolbar)(),
editorAppearance = _useEditorToolbar2.editorAppearance;
if (editorAppearance === 'full-page') {
return /*#__PURE__*/_react.default.createElement(_show.Show, {
below: "xl"
}, /*#__PURE__*/_react.default.createElement(_toolbarButtonGroup.ToolbarButtonGroup, null, children));
}
return /*#__PURE__*/_react.default.createElement(_toolbarButtonGroup.ToolbarButtonGroup, null, children);
};
var getListsIndentationGroupForPrimaryToolbar = exports.getListsIndentationGroupForPrimaryToolbar = function getListsIndentationGroupForPrimaryToolbar() {
return [{
type: _keys.LISTS_INDENTATION_GROUP.type,
key: _keys.LISTS_INDENTATION_GROUP.key,
parents: [{
type: _keys.TEXT_SECTION_PRIMARY_TOOLBAR.type,
key: _keys.TEXT_SECTION_PRIMARY_TOOLBAR.key,
rank: _rank.TEXT_SECTION_PRIMARY_TOOLBAR_RANK[_keys.LISTS_INDENTATION_GROUP.key]
}],
component: function component(_ref3) {
var children = _ref3.children;
return /*#__PURE__*/_react.default.createElement(ListsIndentationGroup, null, children);
}
}, {
type: _keys.LISTS_INDENTATION_GROUP_COLLAPSED.type,
key: _keys.LISTS_INDENTATION_GROUP_COLLAPSED.key,
parents: [{
type: _keys.TEXT_SECTION_PRIMARY_TOOLBAR.type,
key: _keys.TEXT_SECTION_PRIMARY_TOOLBAR.key,
rank: _rank.TEXT_SECTION_PRIMARY_TOOLBAR_RANK[_keys.LISTS_INDENTATION_GROUP.key]
}],
component: function component(_ref4) {
var children = _ref4.children;
return /*#__PURE__*/_react.default.createElement(ListsIndentationGroupCollapsed, null, children);
}
}];
};