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": {
|
||||
"no-array-constructor": 2,
|
||||
"no-catch-shadow": 2,
|
||||
"no-comma-dangle": 2,
|
||||
"comma-dangle": 2,
|
||||
"no-cond-assign": 2,
|
||||
"no-constant-condition": 2,
|
||||
"no-control-regex": 2,
|
||||
@ -14,6 +14,7 @@
|
||||
"no-eq-null": 2,
|
||||
"no-extend-native": 2,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-unneeded-ternary": 2,
|
||||
"no-extra-strict": 2,
|
||||
"global-strict": [2, "always"],
|
||||
"no-inner-declarations": [2, "functions"],
|
||||
@ -35,7 +36,7 @@
|
||||
"no-restricted-modules": 1,
|
||||
"no-script-url": 2,
|
||||
"no-sequences": 2,
|
||||
"no-shadow": 1,
|
||||
"no-shadow": 2,
|
||||
"no-shadow-restricted-names": 2,
|
||||
"no-spaced-func": 2,
|
||||
"no-space-before-semi": 2,
|
||||
@ -51,7 +52,7 @@
|
||||
"block-scoped-var": 2,
|
||||
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
||||
"consistent-return": 2,
|
||||
"consistent-this": [0, "self", "TODO: add this options, remove this value in array"],
|
||||
"consistent-this": [0, "self"],
|
||||
"curly": [2, "all"],
|
||||
"default-case": 0,
|
||||
"func-names": 0,
|
||||
@ -132,6 +133,8 @@
|
||||
"space-unary-ops": [2, { "words": true, "nonwords": false }],
|
||||
"indent": [2, 4],
|
||||
"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/jsx-boolean-value": 1,
|
||||
|
@ -27,7 +27,8 @@
|
||||
<body>
|
||||
<div id="container">
|
||||
</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="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>-->
|
||||
|
@ -80,7 +80,7 @@
|
||||
</footer>
|
||||
</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 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>
|
||||
|
10
package.json
10
package.json
@ -21,11 +21,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/wix/react-templates",
|
||||
"dependencies": {
|
||||
"chalk": "^1.0.0",
|
||||
"chalk": "^1.1.0",
|
||||
"cheerio": "^0.19.0",
|
||||
"escodegen": "^1.6.1",
|
||||
"esprima-harmony": "^7001.1.0-dev-harmony-fb",
|
||||
"lodash": "^3.8.0",
|
||||
"lodash": "^3.10.0",
|
||||
"optionator": "^0.6.0",
|
||||
"text-table": "^0.2.0"
|
||||
},
|
||||
@ -33,15 +33,15 @@
|
||||
"brace": "^0.5.1",
|
||||
"brfs": "^1.4.0",
|
||||
"coveralls": "^2.11.2",
|
||||
"eslint-plugin-react": "^2.3.0",
|
||||
"eslint-plugin-react": "^2.6.4",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-browserify": "^3.8.0",
|
||||
"grunt-contrib-requirejs": "^0.4.4",
|
||||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-eslint": "^13.0.0",
|
||||
"grunt-eslint": "^16.0.0",
|
||||
"grunt-node-tap": "^0.1.61",
|
||||
"istanbul": "^0.3.14",
|
||||
"istanbul": "^0.3.17",
|
||||
"react": "^0.12.2",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
|
@ -5,7 +5,7 @@
|
||||
include: ['fiddle-main.js'],
|
||||
paths: {
|
||||
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',
|
||||
react: '//fb.me/react-with-addons-0.12.1',
|
||||
//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) {
|
||||
return completeAfter(cm, function () {
|
||||
var cur = cm.getCursor();
|
||||
/*eslint new-cap:0*/
|
||||
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) === '<';
|
||||
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) === '<'; //eslint-disable-line new-cap
|
||||
});
|
||||
}
|
||||
|
||||
@ -67,7 +66,7 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
||||
});
|
||||
}
|
||||
|
||||
var editor = React.createClass({
|
||||
return React.createClass({
|
||||
displayName: 'CodeMirrorEditor',
|
||||
propTypes: {
|
||||
id: React.PropTypes.string,
|
||||
@ -172,6 +171,4 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror',
|
||||
this.editor.toTextArea();
|
||||
}
|
||||
});
|
||||
|
||||
return editor;
|
||||
});
|
@ -3,9 +3,9 @@
|
||||
*/
|
||||
'use strict';
|
||||
/*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',
|
||||
propTypes: {
|
||||
id: React.PropTypes.string,
|
||||
@ -64,6 +64,4 @@ define(['react', 'lodash'/*, 'ace'*/], function (React, _/*, ace*/) {
|
||||
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: '/',
|
||||
paths: {
|
||||
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',
|
||||
react: '//fb.me/react-with-addons-0.12.2',
|
||||
//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.goOffline();
|
||||
alert('saved the fiddle, you can share your url');
|
||||
}/*.bind(this)*/);
|
||||
});
|
||||
},
|
||||
clear: function () {
|
||||
this.refs.playground.clear();
|
||||
|
@ -2,7 +2,7 @@ requirejs.config({
|
||||
// baseUrl: '/',
|
||||
paths: {
|
||||
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',
|
||||
react: '//fb.me/react-with-addons-0.12.2',
|
||||
text: 'libs/requirejs-plugins/text',
|
||||
|
@ -30,7 +30,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
||||
}
|
||||
|
||||
function clearMessage(editor) {
|
||||
if (editor && editor.clearMessage) {
|
||||
if (editor && editor.clearAnnotations) {
|
||||
editor.clearAnnotations();
|
||||
}
|
||||
}
|
||||
@ -70,9 +70,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
||||
|
||||
var templateHTML = '<div></div>';
|
||||
var templateProps = 'var template = React.createClass({\n' +
|
||||
' render: function () {\n' +
|
||||
' return templateRT.apply(this);\n' +
|
||||
' }\n' +
|
||||
' render: templateRT\n' +
|
||||
'});';
|
||||
|
||||
//var selfCleaningTimeout = {
|
||||
@ -161,8 +159,7 @@ define(['react', 'jquery', 'lodash', './playground-fiddle.rt', './playground.rt'
|
||||
try {
|
||||
this.validProps = true;
|
||||
//console.log(state.templateProps);
|
||||
/*eslint no-eval:0*/
|
||||
this.sample = eval('(function () {' + this.templateSource + '\n' + state.templateProps + '\n return React.createElement(' + state.name + ');})()');
|
||||
this.sample = eval('(function () {' + this.templateSource + '\n' + state.templateProps + '\n return React.createElement(' + state.name + ');})()'); //eslint-disable-line no-eval
|
||||
clearMessage(this.refs.editorCode);
|
||||
} catch (e) {
|
||||
this.validProps = false;
|
||||
|
@ -196,6 +196,7 @@ test('html tests', function (t) {
|
||||
return content.apply(this, requirements);
|
||||
};
|
||||
var comp = React.createFactory(React.createClass({
|
||||
displayName: 'testClass',
|
||||
render: eval(code) //eslint-disable-line no-eval
|
||||
}));
|
||||
var actual = React.renderToStaticMarkup(comp());
|
||||
|
Loading…
x
Reference in New Issue
Block a user