UNPKG

@atlaskit/editor-plugin-text-formatting

Version:

Text-formatting plugin for @atlaskit/editor-core

46 lines 1.81 kB
import React from 'react'; import { TEXT_FORMATTING_GROUP_INLINE, TEXT_FORMATTING_HERO_BUTTON, TEXT_SECTION, TEXT_SECTION_RANK, TEXT_FORMATTING_GROUP, TEXT_FORMAT_GROUP_RANK } from '@atlaskit/editor-common/toolbar'; import { ToolbarButtonGroup } from '@atlaskit/editor-toolbar'; import { FormatOptions } from '../types'; import { FormatButton } from './Component'; import { formatOptions } from './utils'; export var textFormattingGroupForInlineToolbar = function textFormattingGroupForInlineToolbar(api) { return [{ type: TEXT_FORMATTING_GROUP_INLINE.type, key: TEXT_FORMATTING_GROUP_INLINE.key, parents: [{ type: TEXT_SECTION.type, key: TEXT_SECTION.key, rank: TEXT_SECTION_RANK[TEXT_FORMATTING_GROUP.key] }], component: function component(_ref) { var children = _ref.children; return /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children); } }, { type: TEXT_FORMATTING_HERO_BUTTON.type, key: TEXT_FORMATTING_HERO_BUTTON.key, parents: [{ type: TEXT_FORMATTING_GROUP_INLINE.type, key: TEXT_FORMATTING_GROUP_INLINE.key, rank: TEXT_FORMAT_GROUP_RANK[TEXT_FORMATTING_HERO_BUTTON.key] }], component: function component(_ref2) { var parents = _ref2.parents; var _formatOptions$strong = formatOptions().strong, icon = _formatOptions$strong.icon, command = _formatOptions$strong.command, shortcut = _formatOptions$strong.shortcut, title = _formatOptions$strong.title; return /*#__PURE__*/React.createElement(FormatButton, { api: api, parents: parents, icon: icon, title: title, shortcut: shortcut, optionType: FormatOptions.strong, toggleMarkWithAnalyticsCallback: command }); } }]; };