@atlaskit/editor-plugin-rule
Version:
Rule plugin for @atlaskit/editor-core
32 lines • 1.3 kB
JavaScript
import React from 'react';
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
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';
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
});
}
}];
};