(edit) exit edit mode on escape press

This commit is contained in:
Julien Calixte
2023-08-26 19:06:59 +02:00
parent 15d25abd7a
commit 6840c86add

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useMagicKeys } from '@vueuse/core'
import { import {
computed, computed,
defineAsyncComponent, defineAsyncComponent,
@@ -100,6 +101,14 @@ watch(mode, async (newMode) => {
initialRawContent.value = rawContent.value initialRawContent.value = rawContent.value
} }
}) })
const { escape } = useMagicKeys()
watch(escape, () => {
if (mode.value === 'edit') {
toggleMode()
}
})
</script> </script>
<template> <template>