@atlaskit/editor-plugin-mentions
Version:
Mentions plugin for @atlaskit/editor-core
34 lines • 1.33 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 var getMentionQuickInsertComponents = function getMentionQuickInsertComponents(_ref) {
var api = _ref.api,
typeAhead = _ref.typeAhead;
return [{
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(function (_ref2) {
var formatMessage = _ref2.formatMessage;
return {
description: formatMessage(messages.mentionDescription),
keywords: ['team', 'user'],
shortcut: '@',
title: formatMessage(messages.mention)
};
}),
component: function component() {
return /*#__PURE__*/React.createElement(MentionQuickInsertMenuItem, {
api: api,
typeAhead: typeAhead
});
}
}];
};