UNPKG

@atlaskit/editor-plugin-code-block

Version:

Code block plugin for @atlaskit/editor-core

28 lines 1.1 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 const getCodeBlockQuickInsertComponents = ({ api }) => [{ 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(({ formatMessage }) => ({ description: formatMessage(blockTypeMessages.codeblockDescription), keywords: ['code block'], shortcut: '```', title: formatMessage(blockTypeMessages.codeblock) })), component: () => /*#__PURE__*/React.createElement(CodeBlockQuickInsertMenuItem, { api: api }) }];