feat: focus editor on reply click (#434)

This commit is contained in:
Joaquín Sánchez 2022-12-14 17:45:46 +01:00 committed by GitHub
parent e4b7b8061a
commit 39ed6bffec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -151,6 +151,12 @@ async function onDrop(files: File[] | null) {
}
const { isOverDropZone } = useDropZone(dropZoneRef, onDrop)
defineExpose({
focusEditor: () => {
editor.value?.commands?.focus?.()
},
})
</script>
<template>

View file

@ -7,6 +7,8 @@ const props = defineProps<{
command?: boolean
}>()
const focusEditor = inject<() => void>('focus-editor')
const { details, command } = $(props)
const {
@ -21,7 +23,7 @@ const reply = () => {
if (!checkLogin())
return
if (details) {
// TODO focus to editor
focusEditor?.()
}
else {
const { key, draft } = getReplyDraft(status)