Commit 8bccbe70 authored by Duilio Protti's avatar Duilio Protti

backbone-marionette-require: cancel editing on escape keypress

parent 56cd282f
......@@ -24,7 +24,7 @@ define([
'click .toggle': 'toggle',
'click .destroy': 'destroy',
'dblclick label': 'onEditDblclick',
'keypress .edit': 'onEditKeypress',
'keydown .edit': 'onEditKeyDown',
'blur .edit': 'onEditBlur'
},
......@@ -58,13 +58,14 @@ define([
this.ui.edit.focus().val(this.value);
},
onEditKeypress: function (event) {
onEditKeyDown: function (event) {
if (event.which === ENTER_KEY) {
this.ui.edit.trigger('blur');
}
if (event.which === ESCAPE_KEY) {
this.toggleEditingMode();
this.ui.edit.val(this.model.get('title'));
this.ui.edit.trigger('blur');
}
},
......
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