UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

51 lines 1.83 kB
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { DecisionItem } from '@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(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; }()); export var decisionItemNodeView = function (node, view, getPos) { return new Decision(node, view, getPos); }; //# sourceMappingURL=decisionItem.js.map