react-templates/playground/playground-fiddle.rt.js

61 lines
2.2 KiB
JavaScript
Raw Normal View History

define([
'react/addons',
'lodash',
2014-12-09 14:31:25 +01:00
'./CodeMirrorEditor'
], function (React, _, CodeEditor) {
'use strict';
2014-12-30 10:35:24 +01:00
function onChange1(e) {
this.setState({ templateHTML: e.target.value });
}
2014-12-30 10:35:24 +01:00
function onChange2(e) {
this.setState({ templateProps: e.target.value });
}
function onSubmit3(e) {
e.preventDefault();
}
return function () {
2014-12-30 09:42:31 +01:00
return React.createElement('div', { 'className': 'playground' }, React.createElement('div', { 'className': 'fiddle-row' }, React.createElement('div', {
'className': 'code-area',
'id': 'area-rt'
2014-12-30 10:35:24 +01:00
}, React.createElement(CodeEditor, {
2014-12-10 13:14:22 +01:00
'ref': 'editorRT',
2014-12-08 11:45:32 +01:00
'id': 'editor-rt',
'className': 'large-text-area',
'value': this.state.templateHTML,
'mode': 'html',
'onChange': onChange1.bind(this)
2014-12-30 09:42:31 +01:00
})), React.createElement('div', {
'className': 'code-area',
'id': 'area-code'
2014-12-30 10:35:24 +01:00
}, React.createElement(CodeEditor, {
2014-12-10 13:14:22 +01:00
'ref': 'editorCode',
2014-12-08 11:45:32 +01:00
'id': 'editor-code',
'className': 'large-text-area',
'value': this.state.templateProps,
'mode': 'javascript',
'onChange': onChange2.bind(this)
2014-12-30 09:42:31 +01:00
}))), React.createElement('div', { 'className': 'fiddle-row' }, React.createElement('div', {
'className': 'code-area',
'id': 'area-generated'
2014-12-30 10:35:24 +01:00
}, React.createElement(CodeEditor, {
2014-12-08 11:45:32 +01:00
'id': 'editor-generated',
'className': 'large-text-area',
2014-12-30 09:42:31 +01:00
'ref': 'editorGenerated',
'value': this.templateSource,
'mode': 'javascript',
'readOnly': true
2014-12-09 14:31:25 +01:00
})), React.createElement('div', {
2014-12-30 09:42:31 +01:00
'className': 'code-area',
'id': 'area-result'
} /* <div id="result-container" class="result-area"> */, React.createElement('div', {
2014-12-08 11:45:32 +01:00
'id': 'result-area',
'key': 'result-area',
2014-12-30 09:42:31 +01:00
'className': 'sample-view'
2014-12-30 10:35:24 +01:00
}, React.createElement('form', {
2014-12-30 09:42:31 +01:00
'className': 'result-area-form',
'ref': 'mount',
'onSubmit': onSubmit3.bind(this)
2014-12-30 09:42:31 +01:00
} /* <this.sample key="sample"> */
/* </this.sample> */)))));
};
});