Commit 09a5b84e authored by Pascal Hartig's avatar Pascal Hartig

Merge pull request #1055 from tastejs/react-upgrade-012

React 0.12 upgrade
parents 6b6a0fe7 0af300fe
......@@ -4,6 +4,6 @@
"dependencies": {
"todomvc-common": "~0.3.0",
"director": "~1.2.0",
"react": "~0.11.0"
"react": "~0.12.0"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */
/*jshint white:false */
/*jshint trailing:false */
......@@ -42,14 +39,14 @@ var app = app || {};
return;
}
event.preventDefault();
var val = this.refs.newField.getDOMNode().value.trim();
if (val) {
this.props.model.addTodo(val);
this.refs.newField.getDOMNode().value = '';
}
return false;
},
toggleAll: function (event) {
......@@ -171,7 +168,7 @@ var app = app || {};
var model = new app.TodoModel('react-todos');
function render() {
React.renderComponent(
React.render(
<TodoApp model={model}/>,
document.getElementById('todoapp')
);
......
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */
/*jshint white:false */
/*jshint trailing:false */
......
/**
* @jsx React.DOM
*/
/*jshint quotmark: false */
/*jshint white: false */
/*jshint trailing: false */
......@@ -15,7 +12,7 @@ var app = app || {};
var ENTER_KEY = 13;
app.TodoItem = React.createClass({
handleSubmit: function () {
handleSubmit: function (event) {
var val = this.state.editText.trim();
if (val) {
this.props.onSave(val);
......@@ -23,7 +20,6 @@ var app = app || {};
} else {
this.props.onDestroy();
}
return false;
},
handleEdit: function () {
......@@ -42,9 +38,9 @@ var app = app || {};
handleKeyDown: function (event) {
if (event.which === ESCAPE_KEY) {
this.setState({editText: this.props.todo.title});
this.props.onCancel();
this.props.onCancel(event);
} else if (event.which === ENTER_KEY) {
this.handleSubmit();
this.handleSubmit(event);
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment