UNPKG

@up-group/react-controls

Version:

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get

87 lines 3.28 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var ReactDOM = require("react-dom"); var CKEditor = (function (_super) { __extends(CKEditor, _super); function CKEditor(props) { var _this = _super.call(this, props) || this; _this.onLoad = _this.onLoad.bind(_this); _this.state = { isScriptLoaded: _this.props.isScriptLoaded, config: _this.props.config }; return _this; } CKEditor.prototype.componentDidMount = function () { if (!this.props.isScriptLoaded) { } else { this.onLoad(); } }; CKEditor.prototype.onLoad = function () { var _this = this; this.setState({ isScriptLoaded: true }); if (typeof (window['CKEDITOR']) != null) { console.error("CKEditor not found"); return; } this.editorInstance = window['CKEDITOR'].appendTo(ReactDOM.findDOMNode(this), this.state.config, this.props.content); this.editorInstance.on("change", function () { var content = _this.editorInstance.getData(); if (_this.props.onChange) { _this.props.onChange(content); } }); }; CKEditor.prototype.render = function () { return React.createElement("div", { className: this.props.activeClass }); }; CKEditor.defaultProps = { content: "", config: { language: 'fr', enterMode: 2, shiftEnterMode: 1, height: 60, skin: 'office2013', resize_enabled: false, toolbarCanCollapse: true, toolbarStartupExpanded: false, autoGrow_onStartup: true, autoGrow_minHeight: 60, autoGrow_maxHeight: 600, autoGrow_bottomSpace: 10, startupFocus: false, removePlugins: 'elementspath', toolbar: [ ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'], ['TextColor', 'BGColor'], ['HorizontalRule', 'SpecialChar'], ['Bold', '-', 'Italic', '-', 'Underline', '-', 'Strike', '-', 'Subscript', '-', 'Superscript', '-', 'RemoveFormat'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['NumberedList', 'BulletedList', '-', 'Table'] ] }, isScriptLoaded: true, scriptUrl: "", activeClass: "", onChange: function (data) { } }; return CKEditor; }(React.Component)); exports.default = CKEditor; //# sourceMappingURL=CKEditor.js.map