UNPKG

@atlaskit/editor-plugin-tasks-and-decisions

Version:

Tasks and decisions plugin for @atlaskit/editor-core

61 lines • 2.38 kB
import React from 'react'; import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages/insert-block'; import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher'; import { ACTION_MENU_ITEM, DECISION_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys'; import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank'; import { TasksAndDecisionsQuickInsertMenuItem } from './TasksAndDecisionsQuickInsertMenuItem'; const taskPreviewImageUrls = { light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLK.png', dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVHI.png' }; const decisionPreviewImageUrls = { light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLY.png', dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVHM.png' }; export const getTasksAndDecisionsQuickInsertComponents = ({ api, quickInsertActionDescription }) => [{ key: ACTION_MENU_ITEM.key, type: ACTION_MENU_ITEM.type, parents: [{ key: STRUCTURE_SECTION.key, type: STRUCTURE_SECTION.type, rank: STRUCTURE_SECTION_RANK[ACTION_MENU_ITEM.key] }], match: createQuickInsertMatcher(({ formatMessage }) => ({ description: quickInsertActionDescription !== null && quickInsertActionDescription !== void 0 ? quickInsertActionDescription : formatMessage(messages.actionDescription), keywords: ['checkbox', 'task', 'todo'], shortcut: '[]', title: formatMessage(messages.action) })), component: () => /*#__PURE__*/React.createElement(TasksAndDecisionsQuickInsertMenuItem, { api: api, description: quickInsertActionDescription, item: "taskList", previewImageUrls: taskPreviewImageUrls }) }, { key: DECISION_MENU_ITEM.key, type: DECISION_MENU_ITEM.type, parents: [{ key: STRUCTURE_SECTION.key, type: STRUCTURE_SECTION.type, rank: STRUCTURE_SECTION_RANK[DECISION_MENU_ITEM.key] }], match: createQuickInsertMatcher(({ formatMessage }) => ({ description: formatMessage(messages.decisionDescription), keywords: [], shortcut: '<>', title: formatMessage(messages.decision) })), component: () => /*#__PURE__*/React.createElement(TasksAndDecisionsQuickInsertMenuItem, { api: api, item: "decisionList", previewImageUrls: decisionPreviewImageUrls }) }];