@atlaskit/editor-plugin-toolbar-lists-indentation
Version:
Toolbar lists and indentation plugin for @atlaskit/editor-core
57 lines • 1.92 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';
const ListsIndentationGroup = ({
children
}) => {
const {
editorAppearance
} = useEditorToolbar();
if (editorAppearance === 'full-page') {
return /*#__PURE__*/React.createElement(Show, {
above: "xl"
}, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
}
};
const ListsIndentationGroupCollapsed = ({
children
}) => {
const {
editorAppearance
} = useEditorToolbar();
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 const 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: ({
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: ({
children
}) => {
return /*#__PURE__*/React.createElement(ListsIndentationGroupCollapsed, null, children);
}
}];
};