@atlaskit/editor-plugin-tasks-and-decisions
Version:
Tasks and decisions plugin for @atlaskit/editor-core
75 lines (74 loc) • 3.35 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getTasksAndDecisionsQuickInsertComponents = void 0;
var _react = _interopRequireDefault(require("react"));
var _insertBlock = require("@atlaskit/editor-common/messages/insert-block");
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
var _TasksAndDecisionsQuickInsertMenuItem = require("./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'
};
var getTasksAndDecisionsQuickInsertComponents = exports.getTasksAndDecisionsQuickInsertComponents = function getTasksAndDecisionsQuickInsertComponents(_ref) {
var api = _ref.api,
quickInsertActionDescription = _ref.quickInsertActionDescription;
return [{
key: _keys.ACTION_MENU_ITEM.key,
type: _keys.ACTION_MENU_ITEM.type,
parents: [{
key: _keys.STRUCTURE_SECTION.key,
type: _keys.STRUCTURE_SECTION.type,
rank: _rank.STRUCTURE_SECTION_RANK[_keys.ACTION_MENU_ITEM.key]
}],
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function (_ref2) {
var formatMessage = _ref2.formatMessage;
return {
description: quickInsertActionDescription !== null && quickInsertActionDescription !== void 0 ? quickInsertActionDescription : formatMessage(_insertBlock.toolbarInsertBlockMessages.actionDescription),
keywords: ['checkbox', 'task', 'todo'],
shortcut: '[]',
title: formatMessage(_insertBlock.toolbarInsertBlockMessages.action)
};
}),
component: function component() {
return /*#__PURE__*/_react.default.createElement(_TasksAndDecisionsQuickInsertMenuItem.TasksAndDecisionsQuickInsertMenuItem, {
api: api,
description: quickInsertActionDescription,
item: "taskList",
previewImageUrls: taskPreviewImageUrls
});
}
}, {
key: _keys.DECISION_MENU_ITEM.key,
type: _keys.DECISION_MENU_ITEM.type,
parents: [{
key: _keys.STRUCTURE_SECTION.key,
type: _keys.STRUCTURE_SECTION.type,
rank: _rank.STRUCTURE_SECTION_RANK[_keys.DECISION_MENU_ITEM.key]
}],
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function (_ref3) {
var formatMessage = _ref3.formatMessage;
return {
description: formatMessage(_insertBlock.toolbarInsertBlockMessages.decisionDescription),
keywords: [],
shortcut: '<>',
title: formatMessage(_insertBlock.toolbarInsertBlockMessages.decision)
};
}),
component: function component() {
return /*#__PURE__*/_react.default.createElement(_TasksAndDecisionsQuickInsertMenuItem.TasksAndDecisionsQuickInsertMenuItem, {
api: api,
item: "decisionList",
previewImageUrls: decisionPreviewImageUrls
});
}
}];
};