mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-28 18:01:22 +00:00
Dismiss popups with escape (#1426)
Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
@@ -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>
|
||||
|
Reference in New Issue
Block a user