From ee5dd22f5f7b2b9b9ea968a80ca36a892a6d668d Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Tue, 17 Dec 2019 22:30:24 -0500 Subject: [PATCH] Add escape button handler for form (reset) --- static/library.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/library.js b/static/library.js index 6f0fb37..34d1ee8 100644 --- a/static/library.js +++ b/static/library.js @@ -11,6 +11,7 @@ return { editing: false, saving: false, + trackForReset: {}, } }, computed: { @@ -20,9 +21,17 @@ }, methods: { edit: function() { + if (this.editing) { + return; + } + this.trackForReset = Object.assign({}, this.track); this.saving = false; this.editing = true; }, + cancel: function() { + this.track = Object.assign({}, this.trackForReset); + this.editing = false; + }, save: function() { this.saving = true; @@ -55,7 +64,7 @@ template: `