diff --git a/src/components/AppLayout.vue b/src/components/AppLayout.vue index 24080b7..fe888aa 100644 --- a/src/components/AppLayout.vue +++ b/src/components/AppLayout.vue @@ -26,7 +26,9 @@ const editorInstance = ref(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() diff --git a/src/composables/useSearchDialog.ts b/src/composables/useSearchDialog.ts index 576158b..072ecf1 100644 --- a/src/composables/useSearchDialog.ts +++ b/src/composables/useSearchDialog.ts @@ -3,13 +3,16 @@ import { store, commandMenuModifier } from '../store' const isOpenSearchDialog = ref(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') {