Commit 594c7679 authored by Duilio Protti's avatar Duilio Protti

ariatemplates - cancel editing on escape keypress

parent 1d9089af
......@@ -107,7 +107,7 @@
<input class="edit" value="${iter.item.title|escapeForHTML}"
{id "editbox"/}
{on blur {fn: "stopEdit", scope: this, args: iter}/}
{on keydown {fn: "confirmEdit", scope: this, args: iter}/}>
{on keydown {fn: "confirmOrRevertEdit", scope: this, args: iter}/}>
{else/}
<div class="view">
{@html:CheckBox {
......
......@@ -83,8 +83,9 @@ Aria.tplScriptDefinition({
this.$focus('editbox');
},
confirmEdit: function (evt, e) {
confirmOrRevertEdit: function (evt, e) {
if (evt.keyCode === evt.KC_ENTER) { this.stopEdit(evt, e); }
if (evt.keyCode === evt.KC_ESCAPE) { this.revertEdit(evt, e); }
},
stopEdit: function (evt, e) {
......@@ -106,6 +107,15 @@ Aria.tplScriptDefinition({
}
},
revertEdit: function (evt, e) {
var el;
this.data.editedTask = null;
el = this.$getElementById(e.sectionId);
if (el) { el.classList.remove('editing'); }
this.$refresh({outputSection: e.sectionId});
this.$json.setValue(e.item, 'title', e.item.title);
},
todolistUpdateHandler: function () {
var size;
if (this.pauselistener) { return; }
......
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