@atlaskit/editor-plugin-mentions
Version:
Mentions plugin for @atlaskit/editor-core
30 lines • 1.1 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 { MEDIA_SECTION, MENTION_MENU_ITEM } from '@atlaskit/editor-common/quick-insert/keys';
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
import { MentionQuickInsertMenuItem } from './MentionQuickInsertMenuItem';
export const getMentionQuickInsertComponents = ({
api,
typeAhead
}) => [{
key: MENTION_MENU_ITEM.key,
type: MENTION_MENU_ITEM.type,
parents: [{
key: MEDIA_SECTION.key,
type: MEDIA_SECTION.type,
rank: MEDIA_SECTION_RANK[MENTION_MENU_ITEM.key]
}],
match: createQuickInsertMatcher(({
formatMessage
}) => ({
description: formatMessage(messages.mentionDescription),
keywords: ['team', 'user'],
shortcut: '@',
title: formatMessage(messages.mention)
})),
component: () => /*#__PURE__*/React.createElement(MentionQuickInsertMenuItem, {
api: api,
typeAhead: typeAhead
})
}];