forked from vikunja/vikunja
refactor: move editor cancelling into function
This commit is contained in:
parent
360a72d639
commit
fc967884d5
@ -30,7 +30,7 @@
|
||||
:spellcheck="false"
|
||||
@blur="save(($event.target as HTMLInputElement).textContent as string)"
|
||||
@keydown.enter.prevent.stop="($event.target as HTMLInputElement).blur()"
|
||||
@keydown.esc.prevent.stop="($event.target as HTMLInputElement).textContent = task.title; ($event.target as HTMLInputElement).blur()"
|
||||
@keydown.esc.prevent.stop="cancel($event.target as HTMLInputElement)"
|
||||
>
|
||||
{{ task.title.trim() }}
|
||||
</h1>
|
||||
@ -134,6 +134,11 @@ async function save(title: string) {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function cancel(element: HTMLInputElement) {
|
||||
element.textContent = props.task.title
|
||||
element.blur()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user