UNPKG

@atlaskit/editor-plugin-list

Version:

List plugin for @atlaskit/editor-core

50 lines (49 loc) • 2.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getListComponents = void 0; var _blockMenu = require("@atlaskit/editor-common/block-menu"); var _key = require("@atlaskit/editor-common/block-menu/key"); var _rank = require("@atlaskit/editor-common/block-menu/rank"); var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled"); var _BulletedListBlockMenuItem = require("./BulletedListBlockMenuItem"); var _NumberedListBlockMenuItem = require("./NumberedListBlockMenuItem"); var BULLET_LIST_NODE_NAME = 'bulletList'; var ORDERED_LIST_NODE_NAME = 'orderedList'; var getListComponents = exports.getListComponents = function getListComponents(api) { var isSmallTextExperimentEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_menu_small_text'); var parentKey = isSmallTextExperimentEnabled ? _key.TRANSFORM_TEXTFORMATTING_MENU_SECTION.key : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key; var rank = isSmallTextExperimentEnabled ? _rank.TRANSFORM_TEXT_FORMATTING_MENU_SECTION_RANK : _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK; return [{ type: 'block-menu-item', key: _blockMenu.TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key, parent: { type: 'block-menu-section', key: parentKey, rank: rank[_blockMenu.TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key] }, component: (0, _BulletedListBlockMenuItem.createBulletedListBlockMenuItem)({ api: api }), isHidden: function isHidden() { var _api$blockMenu; return Boolean(api === null || api === 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: _blockMenu.TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key, parent: { type: 'block-menu-section', key: parentKey, rank: rank[_blockMenu.TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key] }, component: (0, _NumberedListBlockMenuItem.createNumberedListBlockMenuItem)({ api: api }), isHidden: function isHidden() { var _api$blockMenu2; return Boolean(api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(ORDERED_LIST_NODE_NAME)); } }]; };