@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
33 lines • 1.44 kB
JavaScript
import * as tslib_1 from "tslib";
import TaskIcon from '@atlaskit/icon/glyph/editor/task';
import * as React from 'react';
import { PureComponent } from 'react';
import { analyticsDecorator as analytics } from '../../analytics';
import ToolbarButton from '../ToolbarButton';
import { changeToTaskDecision } from '../../plugins/tasks-and-decisions/commands';
var ToolbarTask = (function (_super) {
tslib_1.__extends(ToolbarTask, _super);
function ToolbarTask() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = { disabled: false };
_this.handleInsertTask = function () {
var editorView = _this.props.editorView;
if (!editorView) {
return false;
}
changeToTaskDecision(editorView, 'taskList');
return true;
};
return _this;
}
ToolbarTask.prototype.render = function () {
var disabled = this.state.disabled;
return (React.createElement(ToolbarButton, { onClick: this.handleInsertTask, disabled: disabled, title: "Create action ([])", iconBefore: React.createElement(TaskIcon, { label: "Create action" }) }));
};
return ToolbarTask;
}(PureComponent));
export default ToolbarTask;
tslib_1.__decorate([
analytics('atlassian.fabric.action.triggered.button')
], ToolbarTask.prototype, "handleInsertTask", void 0);
//# sourceMappingURL=index.js.map