1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00

add function wrap

This commit is contained in:
ido 2014-11-10 18:47:06 +02:00
parent f9c7afd8ec
commit c43f6c59aa
3 changed files with 29 additions and 25 deletions

View File

@ -15,7 +15,7 @@ var ifTemplate = _.template("((<%= condition %>)?(<%= body %>):null)");
var classSetTemplate = _.template("React.addons.classSet(<%= classSet %>)"); var classSetTemplate = _.template("React.addons.classSet(<%= classSet %>)");
var tagTemplate = _.template("<%= name %>.apply(this,_.flatten([<%= props %>].concat([<%= children %>])))"); var tagTemplate = _.template("<%= name %>.apply(this,_.flatten([<%= props %>].concat([<%= children %>])))");
var commentTemplate = _.template(" /* <%= data %> */ "); var commentTemplate = _.template(" /* <%= data %> */ ");
var templateTemplate = _.template("define([<%= requirePaths %>], function (<%= requireNames %>) {\n <%= injectedFunctions %>\nreturn <%= body %>\n});"); var templateTemplate = _.template("define([<%= requirePaths %>], function (<%= requireNames %>) {\n <%= injectedFunctions %>\nreturn function(){ return <%= body %>};\n});");
var templateProp = "rt-repeat"; var templateProp = "rt-repeat";
var ifProp = "rt-if"; var ifProp = "rt-if";

View File

@ -2,5 +2,7 @@ define([
'react', 'react',
'lodash' 'lodash'
], function (React, _) { ], function (React, _) {
return React.DOM.div.apply(this, _.flatten([{}].concat([]))); return function () {
return React.DOM.div.apply(this, _.flatten([{}].concat([])));
};
}); });

View File

@ -2,32 +2,34 @@ define([
'react', 'react',
'lodash' 'lodash'
], function (React, _) { ], function (React, _) {
return React.DOM.div.apply(this, _.flatten([{}].concat([ return function () {
React.DOM.div.apply(this, _.flatten([{ return React.DOM.div.apply(this, _.flatten([{}].concat([
'style': { React.DOM.div.apply(this, _.flatten([{
position: 'relative',
textAlign: 'center',
top: this.props.config.previewTop,
height: this.props.config.previewHeight
}
}].concat([React.DOM.div.apply(this, _.flatten([{
'style': { 'style': {
margin: 'auto', position: 'relative',
height: '100%', textAlign: 'center',
width: this.props.config.previewWidth || '100%' top: this.props.config.previewTop,
height: this.props.config.previewHeight
} }
}].concat([React.DOM.iframe.apply(this, _.flatten([{ }].concat([React.DOM.div.apply(this, _.flatten([{
'id': 'preview',
'src': 'http://localhost/sites/412?ds=true',
'style': { 'style': {
width: '100%', margin: 'auto',
height: '100%', height: '100%',
border: '0' width: this.props.config.previewWidth || '100%'
} }
}].concat([])))])))]))), }].concat([React.DOM.iframe.apply(this, _.flatten([{
React.DOM.div.apply(this, _.flatten([{}].concat([ 'id': 'preview',
'editor', 'src': 'http://localhost/sites/412?ds=true',
!this.props.editorState.previewMode ? React.DOM.div.apply(this, _.flatten([{}].concat(['left bar']))) : null 'style': {
]))) width: '100%',
]))); height: '100%',
border: '0'
}
}].concat([])))])))]))),
React.DOM.div.apply(this, _.flatten([{}].concat([
'editor',
!this.props.editorState.previewMode ? React.DOM.div.apply(this, _.flatten([{}].concat(['left bar']))) : null
])))
])));
};
}); });