@atlaskit/editor-plugin-placeholder-text
Version:
placeholder text plugin for @atlaskit/editor-core
27 lines • 1.18 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 { PLACEHOLDER_TEXT_MENU_ITEM, TEXT_FORMATTING_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
import { TEXT_FORMATTING_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
import { PlaceholderTextQuickInsertMenuItem } from './PlaceholderTextQuickInsertMenuItem';
export const getPlaceholderTextQuickInsertComponents = ({
api
}) => [{
key: PLACEHOLDER_TEXT_MENU_ITEM.key,
type: PLACEHOLDER_TEXT_MENU_ITEM.type,
parents: [{
key: TEXT_FORMATTING_SECTION.key,
type: TEXT_FORMATTING_SECTION.type,
rank: TEXT_FORMATTING_SECTION_RANK[PLACEHOLDER_TEXT_MENU_ITEM.key]
}],
match: createQuickInsertMatcher(({
formatMessage
}) => ({
description: formatMessage(messages.placeholderTextDescription),
keywords: ['placeholder'],
title: formatMessage(messages.placeholderText)
})),
component: () => /*#__PURE__*/React.createElement(PlaceholderTextQuickInsertMenuItem, {
api: api
})
}];