@atlaskit/editor-plugin-toolbar-lists-indentation
Version:
Toolbar lists and indentation plugin for @atlaskit/editor-core
46 lines • 1.48 kB
JavaScript
import React from 'react';
import { BULLETED_LIST_BUTTON, BULLETED_LIST_BUTTON_GROUP, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_PRIMARY_TOOLBAR_RANK, useEditorToolbar } from '@atlaskit/editor-common/toolbar';
import { Show, ToolbarButtonGroup } from '@atlaskit/editor-toolbar';
import { BulletedListButton } from './BulletedListButton';
const BulletedListButtonGroup = ({
children
}) => {
const {
editorAppearance
} = useEditorToolbar();
if (editorAppearance === 'full-page') {
return /*#__PURE__*/React.createElement(Show, {
above: "xl"
}, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
}
};
export const getBulletedListButtonGroup = api => {
return [{
type: BULLETED_LIST_BUTTON_GROUP.type,
key: BULLETED_LIST_BUTTON_GROUP.key,
parents: [{
type: TEXT_SECTION_PRIMARY_TOOLBAR.type,
key: TEXT_SECTION_PRIMARY_TOOLBAR.key,
rank: TEXT_SECTION_PRIMARY_TOOLBAR_RANK[BULLETED_LIST_BUTTON_GROUP.key]
}],
component: ({
children
}) => {
return /*#__PURE__*/React.createElement(BulletedListButtonGroup, null, children);
}
}, {
type: BULLETED_LIST_BUTTON.type,
key: BULLETED_LIST_BUTTON.key,
parents: [{
type: BULLETED_LIST_BUTTON_GROUP.type,
key: BULLETED_LIST_BUTTON_GROUP.key,
rank: 100
}],
component: ({
parents
}) => /*#__PURE__*/React.createElement(BulletedListButton, {
api: api,
parents: parents
})
}];
};