mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
esc only closes tags popup if open (#10547)
This commit is contained in:
committed by
Matteo Pagliazzi
parent
508d832d73
commit
6b8784cf04
@@ -1,6 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
form(v-if="task", @submit.stop.prevent="submit()")
|
form(v-if="task", @submit.stop.prevent="submit()")
|
||||||
b-modal#task-modal(size="sm", @hidden="onClose()", @show="handleOpen()", @shown="focusInput()")
|
b-modal#task-modal(v-bind:no-close-on-esc="showTagsSelect", size="sm", @hidden="onClose()", @show="handleOpen()", @shown="focusInput()")
|
||||||
.task-modal-header(slot="modal-header", :class="cssClass('bg')")
|
.task-modal-header(slot="modal-header", :class="cssClass('bg')")
|
||||||
.clearfix
|
.clearfix
|
||||||
h1.float-left {{ title }}
|
h1.float-left {{ title }}
|
||||||
@@ -806,6 +806,12 @@ export default {
|
|||||||
return this.selectedTags.slice(this.maxTags);
|
return this.selectedTags.slice(this.maxTags);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
document.addEventListener('keyup', this.handleEsc);
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
document.removeEventListener('keyup', this.handleEsc);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({saveTask: 'tasks:save', destroyTask: 'tasks:destroy', createTask: 'tasks:create'}),
|
...mapActions({saveTask: 'tasks:save', destroyTask: 'tasks:destroy', createTask: 'tasks:create'}),
|
||||||
async syncTask () {
|
async syncTask () {
|
||||||
@@ -991,6 +997,11 @@ export default {
|
|||||||
focusInput () {
|
focusInput () {
|
||||||
this.$refs.inputToFocus.focus();
|
this.$refs.inputToFocus.focus();
|
||||||
},
|
},
|
||||||
|
handleEsc (e) {
|
||||||
|
if (e.keyCode === 27 && this.showTagsSelect) {
|
||||||
|
this.closeTagsPopup();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user