UNPKG

@atlaskit/editor-plugin-rule

Version:

Rule plugin for @atlaskit/editor-core

37 lines • 1.52 kB
import React from 'react'; import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages/insert-block'; import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher'; import { RULE_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys'; import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank'; import { RuleQuickInsertMenuItem } from './RuleQuickInsertMenuItem'; var previewImageUrls = { light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVL8.png', dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVK1.png' }; export var getRuleQuickInsertComponents = function getRuleQuickInsertComponents(_ref) { var api = _ref.api; return [{ key: RULE_MENU_ITEM.key, type: RULE_MENU_ITEM.type, parents: [{ key: STRUCTURE_SECTION.key, type: STRUCTURE_SECTION.type, rank: STRUCTURE_SECTION_RANK[RULE_MENU_ITEM.key] }], match: createQuickInsertMatcher(function (_ref2) { var formatMessage = _ref2.formatMessage; return { description: formatMessage(messages.horizontalRuleDescription), keywords: ['horizontal', 'rule', 'line', 'hr'], shortcut: '---', title: formatMessage(messages.horizontalRule) }; }), component: function component() { return /*#__PURE__*/React.createElement(RuleQuickInsertMenuItem, { api: api, previewImageUrls: previewImageUrls }); } }]; };