提交 ea0a78a2 编写于 作者: View Design's avatar View Design

add esc

上级 79a7ede8
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
size="xl" size="xl"
@click.stop="handleAsk" @click.stop="handleAsk"
/> />
<UTooltip v-else text="停止生成"> <UTooltip v-else text="停止生成" :shortcuts="['ESC']">
<UButton <UButton
:ui="{ rounded: 'rounded-full' }" :ui="{ rounded: 'rounded-full' }"
color="red" color="red"
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<script setup> <script setup>
const { metaSymbol } = useShortcuts() const { metaSymbol } = useShortcuts()
const { isDesktop } = useDevice() const { isDesktop } = useDevice()
const Search = inject('Search')
const placeholder = computed(() => `提出后续问题${isDesktop ? '' + metaSymbol.value + 'L)' : ''}`) const placeholder = computed(() => `提出后续问题${isDesktop ? '' + metaSymbol.value + 'L)' : ''}`)
const props = defineProps({ const props = defineProps({
asking: { asking: {
...@@ -90,6 +91,14 @@ defineShortcuts({ ...@@ -90,6 +91,14 @@ defineShortcuts({
} }
} }
}) })
defineShortcuts({
escape: {
whenever: [Search.asking],
handler: () => {
if (!isFocus.value) handleStop()
}
}
})
function handleFocus () { function handleFocus () {
queryInput.value.textarea.focus() queryInput.value.textarea.focus()
} }
......
...@@ -371,7 +371,8 @@ async function handleUpdateOpenState(url) { ...@@ -371,7 +371,8 @@ async function handleUpdateOpenState(url) {
} }
} }
provide('Search', { provide('Search', {
handleUpdateOpenState handleUpdateOpenState,
asking
}) })
function handleShare (url) { function handleShare (url) {
if (isShareSupported) { if (isShareSupported) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册