@atlaskit/editor-plugin-placeholder-text
Version:
placeholder text plugin for @atlaskit/editor-core
31 lines • 1.39 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 var getPlaceholderTextQuickInsertComponents = function getPlaceholderTextQuickInsertComponents(_ref) {
var api = _ref.api;
return [{
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(function (_ref2) {
var formatMessage = _ref2.formatMessage;
return {
description: formatMessage(messages.placeholderTextDescription),
keywords: ['placeholder'],
title: formatMessage(messages.placeholderText)
};
}),
component: function component() {
return /*#__PURE__*/React.createElement(PlaceholderTextQuickInsertMenuItem, {
api: api
});
}
}];
};