@atlaskit/editor-plugin-hyperlink
Version:
Hyperlink plugin for @atlaskit/editor-core
33 lines • 1.38 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 var getHyperlinkQuickInsertComponents = function getHyperlinkQuickInsertComponents(_ref) {
var api = _ref.api;
return [{
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(function (_ref2) {
var formatMessage = _ref2.formatMessage;
return {
description: formatMessage(messages.linkDescription),
keywords: ['hyperlink', 'url'],
shortcut: tooltip(addLink),
title: formatMessage(messages.link)
};
}),
component: function component() {
return /*#__PURE__*/React.createElement(HyperlinkQuickInsertMenuItem, {
api: api
});
}
}];
};