@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
33 lines • 1.5 kB
JavaScript
import * as tslib_1 from "tslib";
import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
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 ToolbarDecision = (function (_super) {
tslib_1.__extends(ToolbarDecision, _super);
function ToolbarDecision() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = { disabled: false };
_this.handleInsertDecision = function () {
var editorView = _this.props.editorView;
if (!editorView) {
return false;
}
changeToTaskDecision(editorView, 'decisionList');
return true;
};
return _this;
}
ToolbarDecision.prototype.render = function () {
var disabled = this.state.disabled;
return (React.createElement(ToolbarButton, { onClick: this.handleInsertDecision, disabled: disabled, title: "Create decision (<>)", iconBefore: React.createElement(DecisionIcon, { label: "Create decision" }) }));
};
return ToolbarDecision;
}(PureComponent));
export default ToolbarDecision;
tslib_1.__decorate([
analytics('atlassian.fabric.decision.triggered.button')
], ToolbarDecision.prototype, "handleInsertDecision", void 0);
//# sourceMappingURL=index.js.map