UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

53 lines 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var ReactDOM = require("react-dom"); var task_decision_1 = require("@atlaskit/task-decision"); var Decision = (function () { function Decision(node, view, getPos) { var _this = this; this.showPlaceholder = false; this.handleRef = function (node) { _this.contentDOMRef = node; }; this.showPlaceholder = node.content.childCount === 0; this.renderReactComponent(); } Decision.prototype.renderReactComponent = function () { this.domRef = document.createElement('li'); this.domRef.style['list-style-type'] = 'none'; // tslint:disable-next-line:variable-name ReactDOM.render(React.createElement(task_decision_1.DecisionItem, { contentRef: this.handleRef, showPlaceholder: this.showPlaceholder }), this.domRef); }; Object.defineProperty(Decision.prototype, "dom", { get: function () { return this.domRef; }, enumerable: true, configurable: true }); Object.defineProperty(Decision.prototype, "contentDOM", { get: function () { return this.contentDOMRef; }, enumerable: true, configurable: true }); Decision.prototype.update = function () { /** * Returning false here fixes an error where the editor fails to set selection * inside the contentDOM after a transaction. See ED-2374. */ return false; }; Decision.prototype.destroy = function () { ReactDOM.unmountComponentAtNode(this.domRef); this.domRef = undefined; this.contentDOMRef = undefined; }; return Decision; }()); exports.decisionItemNodeView = function (node, view, getPos) { return new Decision(node, view, getPos); }; //# sourceMappingURL=decisionItem.js.map