mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Dismiss popups with escape (#1426)
Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
482678daf5
commit
1786c0554a
1 changed files with 14 additions and 2 deletions
|
@ -14,11 +14,23 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
defineProps<{
|
||||
import { onKeyStroke } from '@vueuse/core';
|
||||
import { toRef } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
}>();
|
||||
|
||||
defineEmits<{
|
||||
const emit = defineEmits<{
|
||||
(event: 'close'): void;
|
||||
}>();
|
||||
|
||||
const open = toRef(props, 'open');
|
||||
|
||||
onKeyStroke('Escape', (e) => {
|
||||
e.preventDefault();
|
||||
if (open.value) {
|
||||
emit('close');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue