@atlaskit/editor-plugin-synced-block
Version:
SyncedBlock plugin for @atlaskit/editor-core
30 lines • 1.28 kB
JavaScript
import React from 'react';
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
import { STRUCTURE_SECTION, SYNCED_BLOCK_MENU_ITEM } from '@atlaskit/editor-common/quick-insert/keys';
import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
import { SyncedBlockQuickInsertMenuItem } from './SyncedBlockQuickInsertMenuItem';
export const getSyncedBlockQuickInsertComponents = ({
api,
syncBlockStore
}) => [{
key: SYNCED_BLOCK_MENU_ITEM.key,
type: SYNCED_BLOCK_MENU_ITEM.type,
parents: [{
key: STRUCTURE_SECTION.key,
type: STRUCTURE_SECTION.type,
rank: STRUCTURE_SECTION_RANK[SYNCED_BLOCK_MENU_ITEM.key]
}],
match: createQuickInsertMatcher(({
formatMessage
}) => ({
description: formatMessage(blockTypeMessages.syncedBlockDescription),
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect', 'create'],
shortcut: '',
title: formatMessage(blockTypeMessages.syncedBlockQuickInsertTitle)
})),
component: () => /*#__PURE__*/React.createElement(SyncedBlockQuickInsertMenuItem, {
api: api,
syncBlockStore: syncBlockStore
})
}];