2014-11-16 16:20:04 +01:00
|
|
|
var React = require('react');
|
|
|
|
var _ = require('lodash');
|
2014-11-17 12:27:57 +01:00
|
|
|
var CodeEditor = require('react-code-mirror');
|
2014-11-16 16:20:04 +01:00
|
|
|
'use strict';
|
2014-11-17 12:27:57 +01:00
|
|
|
function onChange1(evt) {
|
|
|
|
this.setState({ 'templateHTML': evt.target.value });
|
|
|
|
}
|
|
|
|
function onChange2(evt) {
|
|
|
|
this.setState({ 'templateProps': evt.target.value });
|
|
|
|
}
|
2014-11-16 16:20:04 +01:00
|
|
|
module.exports = function () {
|
2014-11-17 12:27:57 +01:00
|
|
|
return React.DOM.div({}, React.DOM.div({ 'className': 'code-area' }, React.DOM.form({}, CodeEditor({
|
|
|
|
'className': 'large-text-area',
|
|
|
|
'style': { border: this.validHTML ? '1px solid black' : '2px solid red' },
|
|
|
|
'value': this.state.templateHTML,
|
|
|
|
'mode': 'htmlmixed',
|
|
|
|
'smartIndent': true,
|
|
|
|
'lineNumbers': true,
|
|
|
|
'onChange': onChange1.bind(this)
|
|
|
|
}), React.DOM.br({}), CodeEditor({
|
|
|
|
'className': 'large-text-area',
|
|
|
|
'style': { border: this.validProps ? '1px solid black' : '2px solid red' },
|
|
|
|
'value': this.state.templateProps,
|
|
|
|
'mode': 'javascript',
|
|
|
|
'theme': 'solarized',
|
|
|
|
'smartIndent': true,
|
|
|
|
'lineNumbers': true,
|
|
|
|
'onChange': onChange2.bind(this)
|
|
|
|
}))), React.DOM.div({ 'className': 'result-area' }, this.sample({})));
|
2014-11-16 16:20:04 +01:00
|
|
|
};
|