react-ckeditor-component
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -9,11 +9,11 @@ Object.defineProperty(exports, "__esModule", { | ||
var _react = require("react"); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require("prop-types"); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _reactDom = require("react-dom"); | ||
var _reactDom = require('react-dom'); | ||
@@ -32,3 +32,3 @@ var _reactDom2 = _interopRequireDefault(_reactDom); | ||
var defaultScriptUrl = "https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js"; | ||
var defaultScriptUrl = 'https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js'; | ||
@@ -53,4 +53,3 @@ /** | ||
_this.state = { | ||
isScriptLoaded: _this.props.isScriptLoaded, | ||
config: _this.props.config | ||
isScriptLoaded: props.isScriptLoaded | ||
}; | ||
@@ -64,5 +63,5 @@ return _this; | ||
_createClass(CKEditor, [{ | ||
key: "componentDidMount", | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (!this.props.isScriptLoaded) { | ||
if (!this.state.isScriptLoaded) { | ||
loadScript(this.props.scriptUrl, this.onLoad); | ||
@@ -74,3 +73,11 @@ } else { | ||
}, { | ||
key: "componentWillUnmount", | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(props) { | ||
var editor = this.editorInstance; | ||
if (editor && editor.getData() !== props.content) { | ||
editor.setData(props.content); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
@@ -80,3 +87,3 @@ this.unmounting = true; | ||
}, { | ||
key: "onLoad", | ||
key: 'onLoad', | ||
value: function onLoad() { | ||
@@ -90,7 +97,7 @@ if (this.unmounting) return; | ||
if (!window.CKEDITOR) { | ||
console.error("CKEditor not found"); | ||
console.error('CKEditor not found'); | ||
return; | ||
} | ||
this.editorInstance = window.CKEDITOR.appendTo(_reactDom2.default.findDOMNode(this), this.state.config, this.props.content); | ||
this.editorInstance = window.CKEDITOR.appendTo(_reactDom2.default.findDOMNode(this), this.props.config, this.props.content); | ||
@@ -105,5 +112,5 @@ //Register listener for custom events if any | ||
}, { | ||
key: "render", | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement("div", { className: this.props.activeClass }); | ||
return _react2.default.createElement('div', { className: this.props.activeClass }); | ||
} | ||
@@ -116,7 +123,7 @@ }]); | ||
CKEditor.defaultProps = { | ||
content: "", | ||
content: '', | ||
config: {}, | ||
isScriptLoaded: false, | ||
scriptUrl: defaultScriptUrl, | ||
activeClass: "", | ||
activeClass: '', | ||
events: {} | ||
@@ -123,0 +130,0 @@ }; |
{ | ||
"name": "react-ckeditor-component", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "CKEditor component for React", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10788
102