Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const editorInstance = ref<Editor | undefined>(undefined)
provide('editorInstance', editorInstance)

const { isOpenBuiltInAiPanel, toggleBuiltInAiPanel } = useBuiltInAi()
const searchDialog = useSearchDialog()
const searchDialog = useSearchDialog(() => {
editorInstance.value?.commands.focus('end')
})

const handleAdd = async () => {
const now = new Date().toISOString()
Expand Down
5 changes: 4 additions & 1 deletion src/composables/useSearchDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { store, commandMenuModifier } from '../store'

const isOpenSearchDialog = ref<boolean>(false)

export const useSearchDialog = () => {
export const useSearchDialog = (onCloseCallback?: () => void) => {
const attachEventListeners = () => {
document.addEventListener('keydown', handleKeyDown)
document.addEventListener('keyup', handleKeyUp)
}
const closeSearchDialog = () => {
isOpenSearchDialog.value = false
if (onCloseCallback) {
onCloseCallback()
}
}
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
Expand Down