UNPKG

@atlaskit/editor-plugin-text-formatting

Version:

Text-formatting plugin for @atlaskit/editor-core

56 lines 2.13 kB
import React from 'react'; import { UNDERLINE_BUTTON_GROUP, UNDERLINE_BUTTON, TEXT_SECTION_PRIMARY_TOOLBAR, TEXT_SECTION_PRIMARY_TOOLBAR_RANK, useEditorToolbar } from '@atlaskit/editor-common/toolbar'; import { Show, ToolbarButtonGroup } from '@atlaskit/editor-toolbar'; import { FormatOptions } from '../types'; import { FormatButton } from './Component'; import { formatOptions } from './utils'; var UnderlineButtonGroup = function UnderlineButtonGroup(_ref) { var children = _ref.children; var _useEditorToolbar = useEditorToolbar(), editorAppearance = _useEditorToolbar.editorAppearance; if (editorAppearance === 'full-page') { return /*#__PURE__*/React.createElement(Show, { above: "xl" }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children)); } }; export var underlineButtonGroup = function underlineButtonGroup(api) { return [{ type: UNDERLINE_BUTTON_GROUP.type, key: UNDERLINE_BUTTON_GROUP.key, parents: [{ type: TEXT_SECTION_PRIMARY_TOOLBAR.type, key: TEXT_SECTION_PRIMARY_TOOLBAR.key, rank: TEXT_SECTION_PRIMARY_TOOLBAR_RANK[UNDERLINE_BUTTON_GROUP.key] }], component: function component(_ref2) { var children = _ref2.children; return /*#__PURE__*/React.createElement(UnderlineButtonGroup, null, children); } }, { type: UNDERLINE_BUTTON.type, key: UNDERLINE_BUTTON.key, parents: [{ type: UNDERLINE_BUTTON_GROUP.type, key: UNDERLINE_BUTTON_GROUP.key, rank: 100 }], component: function component(_ref3) { var parents = _ref3.parents; var _formatOptions$underl = formatOptions().underline, icon = _formatOptions$underl.icon, command = _formatOptions$underl.command, shortcut = _formatOptions$underl.shortcut, title = _formatOptions$underl.title; return /*#__PURE__*/React.createElement(FormatButton, { api: api, parents: parents, icon: icon, title: title, shortcut: shortcut, optionType: FormatOptions.underline, toggleMarkWithAnalyticsCallback: command }); } }]; };