@atlaskit/editor-plugin-tasks-and-decisions
Version:
Tasks and decisions plugin for @atlaskit/editor-core
68 lines • 2.79 kB
JavaScript
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';
var taskPreviewImageUrls = {
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLK.png',
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVHI.png'
};
var decisionPreviewImageUrls = {
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLY.png',
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVHM.png'
};
export var getTasksAndDecisionsQuickInsertComponents = function getTasksAndDecisionsQuickInsertComponents(_ref) {
var api = _ref.api,
quickInsertActionDescription = _ref.quickInsertActionDescription;
return [{
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(function (_ref2) {
var formatMessage = _ref2.formatMessage;
return {
description: quickInsertActionDescription !== null && quickInsertActionDescription !== void 0 ? quickInsertActionDescription : formatMessage(messages.actionDescription),
keywords: ['checkbox', 'task', 'todo'],
shortcut: '[]',
title: formatMessage(messages.action)
};
}),
component: function component() {
return /*#__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(function (_ref3) {
var formatMessage = _ref3.formatMessage;
return {
description: formatMessage(messages.decisionDescription),
keywords: [],
shortcut: '<>',
title: formatMessage(messages.decision)
};
}),
component: function component() {
return /*#__PURE__*/React.createElement(TasksAndDecisionsQuickInsertMenuItem, {
api: api,
item: "decisionList",
previewImageUrls: decisionPreviewImageUrls
});
}
}];
};