react-tinymce = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly
. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%
s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
undefined;
this.state = initialState;
}n/a
TinyMCE = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly
. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%
s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
undefined;
this.state = initialState;
}n/a
function getDefaultProps() {
return {
config: {},
content: ''
};
}n/a
propTypes.config = function () { [native code] }n/a
propTypes.content = function () { [native code] }n/a
propTypes.onFocusin = function () { [native code] }n/a
TinyMCE = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly
. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%
s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
undefined;
this.state = initialState;
}n/a
function getDefaultProps() {
return {
config: {},
content: ''
};
}n/a
function _init(config, content) {
var _this = this;
if (this._isInit) {
this._remove();
}
// hide the textarea that is me so that no one sees it
(0, _reactDom.findDOMNode)(this).style.hidden = 'hidden';
var setupCallback = config.setup;
var hasSetupCallback = typeof setupCallback === 'function';
config.selector = '#' + this.id;
config.setup = function (editor) {
EVENTS.forEach(function (event, index) {
var handler = _this.props[HANDLER_NAMES[index]];
if (typeof handler !== 'function') return;
editor.on(event, function (e) {
// native DOM events don't have access to the editor so we pass it here
handler(e, editor);
});
});
// need to set content here because the textarea will still have the
// old `this.props.content`
if (content) {
editor.on('init', function () {
editor.setContent(content);
});
}
if (hasSetupCallback) {
setupCallback(editor);
}
};
tinymce.init(config);
(0, _reactDom.findDOMNode)(this).style.hidden = '';
this._isInit = true;
}n/a
function _remove() {
tinymce.EditorManager.execCommand('mceRemoveEditor', true, this.id);
this._isInit = false;
}n/a
function componentDidMount() {
var config = (0, _lodashLangClone2['default'])(this.props.config);
this._init(config);
}n/a
function componentWillMount() {
this.id = this.id || this.props.id || (0, _helpersUuid2['default'])();
}n/a
function componentWillReceiveProps(nextProps) {
if (!(0, _lodashLangIsEqual2['default'])(this.props.config, nextProps.config)) {
this._init(nextProps.config, nextProps.content);
}
if (!(0, _lodashLangIsEqual2['default'])(this.props.id, nextProps.id)) {
this.id = nextProps.id;
}
}n/a
function componentWillUnmount() {
this._remove();
}n/a
constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly
. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%
s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
undefined;
this.state = initialState;
}n/a
getDOMNode = function () {
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + '
ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;
return findDOMNode(this);
}n/a
function render() {
return this.props.config.inline ? _react2['default'].createElement('div', {
id: this.id,
className: this.props.className,
dangerouslySetInnerHTML: { __html: this.props.content }
}) : _react2['default'].createElement('textarea', {
id: this.id,
className: this.props.className,
defaultValue: this.props.content
});
}...
}}
onChange={this.handleEditorChange}
/>
);
}
});
ReactDOM.render(<App/>, document.getElementById('container'));
```
## Dependency
This component depends on `tinymce` being globally accessible.
```html
...function shouldComponentUpdate(nextProps) {
return !(0, _lodashLangIsEqual2['default'])(this.props.content, nextProps.content) || !(0, _lodashLangIsEqual2['default'])(this
.props.config, nextProps.config);
}n/a
function _init(config, content) {
var _this = this;
if (this._isInit) {
this._remove();
}
// hide the textarea that is me so that no one sees it
(0, _reactDom.findDOMNode)(this).style.hidden = 'hidden';
var setupCallback = config.setup;
var hasSetupCallback = typeof setupCallback === 'function';
config.selector = '#' + this.id;
config.setup = function (editor) {
EVENTS.forEach(function (event, index) {
var handler = _this.props[HANDLER_NAMES[index]];
if (typeof handler !== 'function') return;
editor.on(event, function (e) {
// native DOM events don't have access to the editor so we pass it here
handler(e, editor);
});
});
// need to set content here because the textarea will still have the
// old `this.props.content`
if (content) {
editor.on('init', function () {
editor.setContent(content);
});
}
if (hasSetupCallback) {
setupCallback(editor);
}
};
tinymce.init(config);
(0, _reactDom.findDOMNode)(this).style.hidden = '';
this._isInit = true;
}n/a
function _remove() {
tinymce.EditorManager.execCommand('mceRemoveEditor', true, this.id);
this._isInit = false;
}n/a
getDOMNode = function () {
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + '
ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;
return findDOMNode(this);
}n/a
className = function () { [native code] }n/a
config = function () { [native code] }n/a
content = function () { [native code] }n/a
id = function () { [native code] }n/a
onActivate = function () { [native code] }n/a
onAddUndo = function () { [native code] }n/a
onBeforeAddUndo = function () { [native code] }n/a
onBeforeExecCommand = function () { [native code] }n/a
onBeforeGetContent = function () { [native code] }n/a
onBeforeRenderUI = function () { [native code] }n/a
onBeforeSetContent = function () { [native code] }n/a
onBeforepaste = function () { [native code] }n/a
onBlur = function () { [native code] }n/a
onChange = function () { [native code] }n/a
onClearUndos = function () { [native code] }n/a
onClick = function () { [native code] }n/a
onContextmenu = function () { [native code] }n/a
onCopy = function () { [native code] }n/a
onCut = function () { [native code] }n/a
onDblclick = function () { [native code] }n/a
onDeactivate = function () { [native code] }n/a
onDirty = function () { [native code] }n/a
onDrag = function () { [native code] }n/a
onDragdrop = function () { [native code] }n/a
onDragend = function () { [native code] }n/a
onDraggesture = function () { [native code] }n/a
onDragover = function () { [native code] }n/a
onDrop = function () { [native code] }n/a
onExecCommand = function () { [native code] }n/a
onFocus = function () { [native code] }n/a
onFocusin = function () { [native code] }n/a
onFocusout = function () { [native code] }n/a
onGetContent = function () { [native code] }n/a
onHide = function () { [native code] }n/a
onInit = function () { [native code] }n/a
onKeydown = function () { [native code] }n/a
onKeypress = function () { [native code] }n/a
onKeyup = function () { [native code] }n/a
onLoadContent = function () { [native code] }n/a
onMousedown = function () { [native code] }n/a
onMouseenter = function () { [native code] }n/a
onMouseleave = function () { [native code] }n/a
onMousemove = function () { [native code] }n/a
onMouseout = function () { [native code] }n/a
onMouseover = function () { [native code] }n/a
onMouseup = function () { [native code] }n/a
onNodeChange = function () { [native code] }n/a
onObjectResizeStart = function () { [native code] }n/a
onObjectResized = function () { [native code] }n/a
onObjectSelected = function () { [native code] }n/a
onPaste = function () { [native code] }n/a
onPostProcess = function () { [native code] }n/a
onPostRender = function () { [native code] }n/a
onPreInit = function () { [native code] }n/a
onPreProcess = function () { [native code] }n/a
onProgressState = function () { [native code] }n/a
onRedo = function () { [native code] }n/a
onRemove = function () { [native code] }n/a
onReset = function () { [native code] }n/a
onSaveContent = function () { [native code] }n/a
onSelectionchange = function () { [native code] }n/a
onSetAttrib = function () { [native code] }n/a
onSetContent = function () { [native code] }n/a
onShow = function () { [native code] }n/a
onSubmit = function () { [native code] }n/a
onUndo = function () { [native code] }n/a
onVisualAid = function () { [native code] }n/a
config = function () { [native code] }n/a
isRequired = function () { [native code] }n/a
content = function () { [native code] }n/a
isRequired = function () { [native code] }n/a
onFocusin = function () { [native code] }n/a
isRequired = function () { [native code] }n/a