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

add esc

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