UNPKG

@atlaskit/editor-plugin-list

Version:

List plugin for @atlaskit/editor-core

38 lines 1.8 kB
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu'; import { createBulletedListBlockMenuItem } from './BulletedListBlockMenuItem'; import { createNumberedListBlockMenuItem } from './NumberedListBlockMenuItem'; const BULLET_LIST_NODE_NAME = 'bulletList'; const ORDERED_LIST_NODE_NAME = 'orderedList'; export const getListComponents = api => { return [{ type: 'block-menu-item', key: TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key, parent: { type: 'block-menu-section', key: TRANSFORM_STRUCTURE_MENU_SECTION.key, rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key] }, component: createBulletedListBlockMenuItem({ api }), isHidden: () => { var _api$blockMenu; return Boolean(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.isTransformOptionDisabled(BULLET_LIST_NODE_NAME)); } }, { type: 'block-menu-item', key: TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key, parent: { type: 'block-menu-section', key: TRANSFORM_STRUCTURE_MENU_SECTION.key, rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key] }, component: createNumberedListBlockMenuItem({ api }), isHidden: () => { var _api$blockMenu2; return Boolean(api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(ORDERED_LIST_NODE_NAME)); } }]; };