mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
Insert new task when ENTER is pressed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var app = app || {};
|
||||
var ENTER_KEY = 13;
|
||||
|
||||
$(function(){
|
||||
|
||||
|
||||
@@ -31,8 +31,13 @@ var app = app || {};
|
||||
this.$el.removeClass('editing');
|
||||
},
|
||||
|
||||
add: function() {
|
||||
this.$input.blur();
|
||||
add: function(e) {
|
||||
if (e.which === ENTER_KEY) {
|
||||
this.$input.blur();
|
||||
var render = new app.TaskView({model: new app.Task()}).render();
|
||||
render.$el.insertAfter(this.$el);
|
||||
render.$input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user