UNPKG

@atlaskit/editor-plugin-code-block

Version:

Code block plugin for @atlaskit/editor-core

32 lines 1.31 kB
import React from 'react'; import { blockTypeMessages } from '@atlaskit/editor-common/messages'; import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher'; import { CODE_BLOCK_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys'; import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank'; import { CodeBlockQuickInsertMenuItem } from './CodeBlockQuickInsertMenuItem'; export var getCodeBlockQuickInsertComponents = function getCodeBlockQuickInsertComponents(_ref) { var api = _ref.api; return [{ key: CODE_BLOCK_MENU_ITEM.key, type: CODE_BLOCK_MENU_ITEM.type, parents: [{ key: STRUCTURE_SECTION.key, type: STRUCTURE_SECTION.type, rank: STRUCTURE_SECTION_RANK[CODE_BLOCK_MENU_ITEM.key] }], match: createQuickInsertMatcher(function (_ref2) { var formatMessage = _ref2.formatMessage; return { description: formatMessage(blockTypeMessages.codeblockDescription), keywords: ['code block'], shortcut: '```', title: formatMessage(blockTypeMessages.codeblock) }; }), component: function component() { return /*#__PURE__*/React.createElement(CodeBlockQuickInsertMenuItem, { api: api }); } }]; };