From 22cf54f1f9baf343bdf682c441e347faad57071e Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 1 Mar 2020 16:50:05 +0100 Subject: [PATCH] Add saving the description with ctrl+enter --- src/components/tasks/TaskDetailView.vue | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/components/tasks/TaskDetailView.vue b/src/components/tasks/TaskDetailView.vue index e21f944cd..eb1bdd840 100644 --- a/src/components/tasks/TaskDetailView.vue +++ b/src/components/tasks/TaskDetailView.vue @@ -163,7 +163,15 @@ - + @@ -319,6 +327,7 @@ namespace: NamespaceModel, showDeleteModal: false, taskTitle: '', + descriptionChanged: false, priorities: priorites, flatPickerConfig: { @@ -450,6 +459,22 @@ this.task.done = !this.task.done this.saveTask() }, + setDescriptionChanged(e) { + if (e.key === 'Enter' || e.key === 'Control') { + return + } + this.descriptionChanged = true + }, + saveTaskIfDescriptionChanged() { + // We want to only save the description if it was changed. + // Since we can either trigger this with ctrl+enter or @change, it would be possible to save a task first + // with ctrl+enter and then with @change although nothing changed since the last save when @change gets fired. + // To only save one time we added this method. + if(this.descriptionChanged) { + this.descriptionChanged = false + this.saveTask() + } + }, }, }