@arche-mc2/arche-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
55 lines • 2.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var BaseControl_1 = require("../_Common/BaseControl/BaseControl");
var theming_1 = require("../../../Common/theming");
var CKEditor = require("@ckeditor/ckeditor5-react");
var ClassicEditor = require("@ckeditor/ckeditor5-build-classic");
var eventListener_1 = require("../../../Common/utils/eventListener");
var UpRichText = (function (_super) {
tslib_1.__extends(UpRichText, _super);
function UpRichText(p, c) {
var _this = _super.call(this, p, c) || this;
_this.getValue = _this.getValue.bind(_this);
_this.state = {
value: p.value
};
return _this;
}
UpRichText.prototype.showError = function () {
return this.props.showError !== undefined
? this.props.showError === true
: this.hasError;
};
UpRichText.prototype.showSuccess = function () {
return this.props.showSuccess;
};
UpRichText.prototype.renderControl = function () {
var _this = this;
var configRTE = this.props.configRTE;
return (React.createElement(CKEditor, { editor: ClassicEditor, data: this.state.value || '', name: this.props.name, config: this.props.configRTE, disabled: this.props.disabled, onInit: function (editor) {
console.log('Editor is ready to use!', editor);
}, tabIndex: this.props.tabIndex, onChange: function (event, editor) {
var data = editor.getData();
_this.handleChangeEvent(eventListener_1.eventFactory(_this.props.name, data), data);
} }));
};
UpRichText.prototype.getValue = function (event) {
return (event != null && event.target != null) ? event.target.value : event;
};
UpRichText.defaultProps = {
width: 'xlarge',
showError: true,
configRTE: {
language: 'fr',
enterMode: 2,
shiftEnterMode: 1,
toolbar: ['heading', 'bold', 'italic', 'fontFamily', 'fontSize', '|', 'link', 'blockQuote', 'numberedList', 'bulletedList', 'undo', 'redo']
},
theme: theming_1.default
};
return UpRichText;
}(BaseControl_1.BaseControlComponent));
exports.default = UpRichText;
//# sourceMappingURL=UpRichText.js.map