@atlaskit/editor-plugin-hyperlink
Version:
Hyperlink plugin for @atlaskit/editor-core
29 lines • 1.17 kB
JavaScript
import React from 'react';
import { addLink, tooltip } from '@atlaskit/editor-common/keymaps';
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages/insert-block';
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
import { HYPERLINK_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
import { HyperlinkQuickInsertMenuItem } from './HyperlinkQuickInsertMenuItem';
export const getHyperlinkQuickInsertComponents = ({
api
}) => [{
key: HYPERLINK_MENU_ITEM.key,
type: HYPERLINK_MENU_ITEM.type,
parents: [{
key: MEDIA_SECTION.key,
type: MEDIA_SECTION.type,
rank: MEDIA_SECTION_RANK[HYPERLINK_MENU_ITEM.key]
}],
match: createQuickInsertMatcher(({
formatMessage
}) => ({
description: formatMessage(messages.linkDescription),
keywords: ['hyperlink', 'url'],
shortcut: tooltip(addLink),
title: formatMessage(messages.link)
})),
component: () => /*#__PURE__*/React.createElement(HyperlinkQuickInsertMenuItem, {
api: api
})
}];