mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
fix error not clearing in playground
This commit is contained in:
parent
faf90d186b
commit
cee215c081
@ -3,7 +3,7 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-array-constructor": 2,
|
"no-array-constructor": 2,
|
||||||
"no-catch-shadow": 2,
|
"no-catch-shadow": 2,
|
||||||
"no-comma-dangle": 2,
|
"comma-dangle": 2,
|
||||||
"no-cond-assign": 2,
|
"no-cond-assign": 2,
|
||||||
"no-constant-condition": 2,
|
"no-constant-condition": 2,
|
||||||
"no-control-regex": 2,
|
"no-control-regex": 2,
|
||||||
@ -14,6 +14,7 @@
|
|||||||
"no-eq-null": 2,
|
"no-eq-null": 2,
|
||||||
"no-extend-native": 2,
|
"no-extend-native": 2,
|
||||||
"no-extra-boolean-cast": 2,
|
"no-extra-boolean-cast": 2,
|
||||||
|
"no-unneeded-ternary": 2,
|
||||||
"no-extra-strict": 2,
|
"no-extra-strict": 2,
|
||||||
"global-strict": [2, "always"],
|
"global-strict": [2, "always"],
|
||||||
"no-inner-declarations": [2, "functions"],
|
"no-inner-declarations": [2, "functions"],
|
||||||
@ -35,7 +36,7 @@
|
|||||||
"no-restricted-modules": 1,
|
"no-restricted-modules": 1,
|
||||||
"no-script-url": 2,
|
"no-script-url": 2,
|
||||||
"no-sequences": 2,
|
"no-sequences": 2,
|
||||||
"no-shadow": 1,
|
"no-shadow": 2,
|
||||||
"no-shadow-restricted-names": 2,
|
"no-shadow-restricted-names": 2,
|
||||||
"no-spaced-func": 2,
|
"no-spaced-func": 2,
|
||||||
"no-space-before-semi": 2,
|
"no-space-before-semi": 2,
|
||||||
@ -51,7 +52,7 @@
|
|||||||
"block-scoped-var": 2,
|
"block-scoped-var": 2,
|
||||||
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
||||||
"consistent-return": 2,
|
"consistent-return": 2,
|
||||||
"consistent-this": [0, "self", "TODO: add this options, remove this value in array"],
|
"consistent-this": [0, "self"],
|
||||||
"curly": [2, "all"],
|
"curly": [2, "all"],
|
||||||
"default-case": 0,
|
"default-case": 0,
|
||||||
"func-names": 0,
|
"func-names": 0,
|
||||||
@ -132,6 +133,8 @@
|
|||||||
"space-unary-ops": [2, { "words": true, "nonwords": false }],
|
"space-unary-ops": [2, { "words": true, "nonwords": false }],
|
||||||
"indent": [2, 4],
|
"indent": [2, 4],
|
||||||
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
|
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
|
||||||
|
"semi-spacing": [2, {"before": false, "after": true}],
|
||||||
|
"array-bracket-spacing": [2, "never"],
|
||||||
|
|
||||||
"react/display-name": 2,
|
"react/display-name": 2,
|
||||||
"react/jsx-boolean-value": 1,
|
"react/jsx-boolean-value": 1,
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
</div>
|
</div>
|
||||||
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
<!--<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>-->
|
||||||
|
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||||
<!--<script src="playground/libs/ace-builds-1.1.8/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>-->
|
<!--<script src="playground/libs/ace-builds-1.1.8/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>-->
|
||||||
<!--<script src="https://cdn.firebase.com/js/client/2.0.5/firebase.js"></script>-->
|
<!--<script src="https://cdn.firebase.com/js/client/2.0.5/firebase.js"></script>-->
|
||||||
<!--<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>-->
|
<!--<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>-->
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||||
<script src="playground/dist/rt-main.browser.min.js"></script>
|
<script src="playground/dist/rt-main.browser.min.js"></script>
|
||||||
<!--<script data-main="playground/home-main.js" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js"></script>-->
|
<!--<script data-main="playground/home-main.js" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js"></script>-->
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js"></script>
|
||||||
|
10
package.json
10
package.json
@ -21,11 +21,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/wix/react-templates",
|
"homepage": "https://github.com/wix/react-templates",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^1.0.0",
|
"chalk": "^1.1.0",
|
||||||
"cheerio": "^0.19.0",
|
"cheerio": "^0.19.0",
|
||||||
"escodegen": "^1.6.1",
|
"escodegen": "^1.6.1",
|
||||||
"esprima-harmony": "^7001.1.0-dev-harmony-fb",
|
"esprima-harmony": "^7001.1.0-dev-harmony-fb",
|
||||||
"lodash": "^3.8.0",
|
"lodash": "^3.10.0",
|
||||||
"optionator": "^0.6.0",
|
"optionator": "^0.6.0",
|
||||||
"text-table": "^0.2.0"
|
"text-table": "^0.2.0"
|
||||||
},
|
},
|
||||||
@ -33,15 +33,15 @@
|
|||||||
"brace": "^0.5.1",
|
"brace": "^0.5.1",
|
||||||
"brfs": "^1.4.0",
|
"brfs": "^1.4.0",
|
||||||
"coveralls": "^2.11.2",
|
"coveralls": "^2.11.2",
|
||||||
"eslint-plugin-react": "^2.3.0",
|
"eslint-plugin-react": "^2.6.4",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-browserify": "^3.8.0",
|
"grunt-browserify": "^3.8.0",
|
||||||
"grunt-contrib-requirejs": "^0.4.4",
|
"grunt-contrib-requirejs": "^0.4.4",
|
||||||
"grunt-contrib-uglify": "^0.9.1",
|
"grunt-contrib-uglify": "^0.9.1",
|
||||||
"grunt-contrib-watch": "^0.6.1",
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"grunt-eslint": "^13.0.0",
|
"grunt-eslint": "^16.0.0",
|
||||||
"grunt-node-tap": "^0.1.61",
|
"grunt-node-tap": "^0.1.61",
|
||||||
"istanbul": "^0.3.14",
|
"istanbul": "^0.3.17",
|
||||||
"react": "^0.12.2",
|
"react": "^0.12.2",
|
||||||
"tape": "^4.0.0"
|
"tape": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
include: ['fiddle-main.js'],
|
include: ['fiddle-main.js'],
|
||||||
paths: {
|
paths: {
|
||||||
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash',
|
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash',
|
||||||
jquery: '//code.jquery.com/jquery-1.11.0.min',
|
jquery: '//code.jquery.com/jquery-2.1.4.min',
|
||||||
firebase: '//cdn.firebase.com/js/client/2.0.5/firebase',
|
firebase: '//cdn.firebase.com/js/client/2.0.5/firebase',
|
||||||
react: '//fb.me/react-with-addons-0.12.1',
|
react: '//fb.me/react-with-addons-0.12.1',
|
||||||
//ace: '../ace-builds-1.1.8/src-min/ace',
|
//ace: '../ace-builds-1.1.8/src-min/ace',
|
||||||
|
@ -51,8 +51,7 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
|||||||
function completeIfAfterLt(cm) {
|
function completeIfAfterLt(cm) {
|
||||||
return completeAfter(cm, function () {
|
return completeAfter(cm, function () {
|
||||||
var cur = cm.getCursor();
|
var cur = cm.getCursor();
|
||||||
/*eslint new-cap:0*/
|
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) === '<'; //eslint-disable-line new-cap
|
||||||
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) === '<';
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var editor = React.createClass({
|
return React.createClass({
|
||||||
displayName: 'CodeMirrorEditor',
|
displayName: 'CodeMirrorEditor',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
id: React.PropTypes.string,
|
id: React.PropTypes.string,
|
||||||
@ -172,6 +171,4 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
|||||||
this.editor.toTextArea();
|
this.editor.toTextArea();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return editor;
|
|
||||||
});
|
});
|
@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
/*global ace:true*/
|
/*global ace:true*/
|
||||||
define(['react', 'lodash'/*, 'ace'*/], function (React, _/*, ace*/) {
|
define(['react', 'lodash']/*, 'ace'*/, function (React, _/*, ace*/) {
|
||||||
|
|
||||||
var editor = React.createClass({
|
return React.createClass({
|
||||||
displayName: 'BraceEditor',
|
displayName: 'BraceEditor',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
id: React.PropTypes.string,
|
id: React.PropTypes.string,
|
||||||
@ -64,6 +64,4 @@ define(['react', 'lodash'/*, 'ace'*/], function (React, _/*, ace*/) {
|
|||||||
this.editor.destroy();
|
this.editor.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return editor;
|
|
||||||
});
|
});
|
2
playground/dist/fiddle.min.js
vendored
2
playground/dist/fiddle.min.js
vendored
File diff suppressed because one or more lines are too long
2
playground/dist/home.min.js
vendored
2
playground/dist/home.min.js
vendored
File diff suppressed because one or more lines are too long
3955
playground/dist/rt-main.browser.js
vendored
3955
playground/dist/rt-main.browser.js
vendored
File diff suppressed because it is too large
Load Diff
23
playground/dist/rt-main.browser.min.js
vendored
23
playground/dist/rt-main.browser.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@ requirejs.config({
|
|||||||
// baseUrl: '/',
|
// baseUrl: '/',
|
||||||
paths: {
|
paths: {
|
||||||
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min',
|
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min',
|
||||||
jquery: '//code.jquery.com/jquery-1.11.0.min',
|
jquery: '//code.jquery.com/jquery-2.1.4.min',
|
||||||
firebase: 'https://cdn.firebase.com/js/client/2.0.5/firebase',
|
firebase: 'https://cdn.firebase.com/js/client/2.0.5/firebase',
|
||||||
react: '//fb.me/react-with-addons-0.12.2',
|
react: '//fb.me/react-with-addons-0.12.2',
|
||||||
//ace: '../ace-builds-1.1.8/src-min/ace',
|
//ace: '../ace-builds-1.1.8/src-min/ace',
|
||||||
|
@ -38,7 +38,7 @@ define(['react', 'firebase', 'lodash', './fiddle.rt', 'jquery'], function (React
|
|||||||
firebase.child('fiddles').child(newHash).set(playgroundState, function () {
|
firebase.child('fiddles').child(newHash).set(playgroundState, function () {
|
||||||
Firebase.goOffline();
|
Firebase.goOffline();
|
||||||
alert('saved the fiddle, you can share your url');
|
alert('saved the fiddle, you can share your url');
|
||||||
}/*.bind(this)*/);
|
});
|
||||||
},
|
},
|
||||||
clear: function () {
|
clear: function () {
|
||||||
this.refs.playground.clear();
|
this.refs.playground.clear();
|
||||||
|
@ -2,7 +2,7 @@ requirejs.config({
|
|||||||
// baseUrl: '/',
|
// baseUrl: '/',
|
||||||
paths: {
|
paths: {
|
||||||
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min',
|
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min',
|
||||||
jquery: '//code.jquery.com/jquery-1.11.0.min',
|
jquery: '//code.jquery.com/jquery-2.1.4.min',
|
||||||
firebase: 'https://cdn.firebase.com/js/client/2.0.5/firebase',
|
firebase: 'https://cdn.firebase.com/js/client/2.0.5/firebase',
|
||||||
react: '//fb.me/react-with-addons-0.12.2',
|
react: '//fb.me/react-with-addons-0.12.2',
|
||||||
text: 'libs/requirejs-plugins/text',
|
text: 'libs/requirejs-plugins/text',
|
||||||
|
@ -30,7 +30,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearMessage(editor) {
|
function clearMessage(editor) {
|
||||||
if (editor && editor.clearMessage) {
|
if (editor && editor.clearAnnotations) {
|
||||||
editor.clearAnnotations();
|
editor.clearAnnotations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,9 +70,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
|||||||
|
|
||||||
var templateHTML = '<div></div>';
|
var templateHTML = '<div></div>';
|
||||||
var templateProps = 'var template = React.createClass({\n' +
|
var templateProps = 'var template = React.createClass({\n' +
|
||||||
' render: function () {\n' +
|
' render: templateRT\n' +
|
||||||
' return templateRT.apply(this);\n' +
|
|
||||||
' }\n' +
|
|
||||||
'});';
|
'});';
|
||||||
|
|
||||||
//var selfCleaningTimeout = {
|
//var selfCleaningTimeout = {
|
||||||
@ -161,8 +159,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
|||||||
try {
|
try {
|
||||||
this.validProps = true;
|
this.validProps = true;
|
||||||
//console.log(state.templateProps);
|
//console.log(state.templateProps);
|
||||||
/*eslint no-eval:0*/
|
this.sample = eval('(function () {' + this.templateSource + '\n' + state.templateProps + '\n return React.createElement(' + state.name + ');})()'); //eslint-disable-line no-eval
|
||||||
this.sample = eval('(function () {' + this.templateSource + '\n' + state.templateProps + '\n return React.createElement(' + state.name + ');})()');
|
|
||||||
clearMessage(this.refs.editorCode);
|
clearMessage(this.refs.editorCode);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validProps = false;
|
this.validProps = false;
|
||||||
|
@ -196,6 +196,7 @@ test('html tests', function (t) {
|
|||||||
return content.apply(this, requirements);
|
return content.apply(this, requirements);
|
||||||
};
|
};
|
||||||
var comp = React.createFactory(React.createClass({
|
var comp = React.createFactory(React.createClass({
|
||||||
|
displayName: 'testClass',
|
||||||
render: eval(code) //eslint-disable-line no-eval
|
render: eval(code) //eslint-disable-line no-eval
|
||||||
}));
|
}));
|
||||||
var actual = React.renderToStaticMarkup(comp());
|
var actual = React.renderToStaticMarkup(comp());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user