Add saving the description with ctrl+enter
This commit is contained in:
parent
269b80e64e
commit
22cf54f1f9
1 changed files with 26 additions and 1 deletions
|
@ -163,7 +163,15 @@
|
|||
</h3>
|
||||
<!-- We're using a normal textarea until the problem with the icons is resolved in easymde -->
|
||||
<!-- <easymde v-model="task.description" @change="saveTask"/>-->
|
||||
<textarea class="textarea" v-model="task.description" @change="saveTask" rows="6" placeholder="Click here to enter a description..."></textarea>
|
||||
<textarea
|
||||
class="textarea"
|
||||
v-model="task.description"
|
||||
rows="6"
|
||||
placeholder="Click here to enter a description..."
|
||||
@keyup.ctrl.enter="saveTaskIfDescriptionChanged"
|
||||
@keydown="setDescriptionChanged"
|
||||
@change="saveTaskIfDescriptionChanged"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Attachments -->
|
||||
|
@ -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()
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue