fix: set focus on input when cc or bcc is clicked
This commit is contained in:
parent
913f2e2881
commit
49b916ba3b
@ -21,12 +21,12 @@
|
|||||||
<div v-if="showCommunicationBox" class="flex gap-1.5">
|
<div v-if="showCommunicationBox" class="flex gap-1.5">
|
||||||
<Button
|
<Button
|
||||||
label="CC"
|
label="CC"
|
||||||
@click="newEmailEditor.cc = !newEmailEditor.cc"
|
@click="toggleCC()"
|
||||||
:class="[newEmailEditor.cc ? 'bg-gray-300 hover:bg-gray-200' : '']"
|
:class="[newEmailEditor.cc ? 'bg-gray-300 hover:bg-gray-200' : '']"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="BCC"
|
label="BCC"
|
||||||
@click="newEmailEditor.bcc = !newEmailEditor.bcc"
|
@click="toggleBCC()"
|
||||||
:class="[newEmailEditor.bcc ? 'bg-gray-300 hover:bg-gray-200' : '']"
|
:class="[newEmailEditor.bcc ? 'bg-gray-300 hover:bg-gray-200' : '']"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +66,7 @@ import EmailEditor from '@/components/EmailEditor.vue'
|
|||||||
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { call } from 'frappe-ui'
|
import { call } from 'frappe-ui'
|
||||||
import { ref, watch, computed, defineModel } from 'vue'
|
import { ref, watch, computed, defineModel, nextTick } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
doctype: {
|
doctype: {
|
||||||
@ -144,5 +144,19 @@ async function submitComment() {
|
|||||||
emit('scroll')
|
emit('scroll')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleCC() {
|
||||||
|
newEmailEditor.value.cc = !newEmailEditor.value.cc
|
||||||
|
newEmailEditor.value.cc && nextTick(() => {
|
||||||
|
newEmailEditor.value.ccInput.setFocus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleBCC() {
|
||||||
|
newEmailEditor.value.bcc = !newEmailEditor.value.bcc
|
||||||
|
newEmailEditor.value.bcc && nextTick(() => {
|
||||||
|
newEmailEditor.value.bccInput.setFocus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ show: showCommunicationBox, editor: newEmailEditor })
|
defineExpose({ show: showCommunicationBox, editor: newEmailEditor })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -202,11 +202,17 @@ const removeLastValue = () => {
|
|||||||
emailRef = emails.value[emails.value.length - 1].$el
|
emailRef = emails.value[emails.value.length - 1].$el
|
||||||
emailRef.focus()
|
emailRef.focus()
|
||||||
} else {
|
} else {
|
||||||
search.value.$el.focus()
|
setFocus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
emailRef.focus()
|
emailRef.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFocus() {
|
||||||
|
search.value.$el.focus()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ setFocus })
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
>
|
>
|
||||||
<span class="text-xs text-gray-500">CC:</span>
|
<span class="text-xs text-gray-500">CC:</span>
|
||||||
<MultiselectInput
|
<MultiselectInput
|
||||||
|
ref="ccInput"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
v-model="ccEmails"
|
v-model="ccEmails"
|
||||||
:validate="validateEmail"
|
:validate="validateEmail"
|
||||||
@ -44,6 +45,7 @@
|
|||||||
<div v-if="bcc" class="mx-10 flex items-center gap-2 border-b py-2.5">
|
<div v-if="bcc" class="mx-10 flex items-center gap-2 border-b py-2.5">
|
||||||
<span class="text-xs text-gray-500">BCC:</span>
|
<span class="text-xs text-gray-500">BCC:</span>
|
||||||
<MultiselectInput
|
<MultiselectInput
|
||||||
|
ref="bccInput"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
v-model="bccEmails"
|
v-model="bccEmails"
|
||||||
:validate="validateEmail"
|
:validate="validateEmail"
|
||||||
@ -173,6 +175,8 @@ const subject = ref(props.subject)
|
|||||||
const toEmails = ref(modelValue.value.email ? [modelValue.value.email] : [])
|
const toEmails = ref(modelValue.value.email ? [modelValue.value.email] : [])
|
||||||
const ccEmails = ref([])
|
const ccEmails = ref([])
|
||||||
const bccEmails = ref([])
|
const bccEmails = ref([])
|
||||||
|
const ccInput = ref(null)
|
||||||
|
const bccInput = ref(null)
|
||||||
|
|
||||||
const editor = computed(() => {
|
const editor = computed(() => {
|
||||||
return textEditor.value.editor
|
return textEditor.value.editor
|
||||||
@ -182,7 +186,17 @@ function removeAttachment(attachment) {
|
|||||||
attachments.value = attachments.value.filter((a) => a !== attachment)
|
attachments.value = attachments.value.filter((a) => a !== attachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ editor, subject, cc, bcc, toEmails, ccEmails, bccEmails })
|
defineExpose({
|
||||||
|
editor,
|
||||||
|
subject,
|
||||||
|
cc,
|
||||||
|
bcc,
|
||||||
|
toEmails,
|
||||||
|
ccEmails,
|
||||||
|
bccEmails,
|
||||||
|
ccInput,
|
||||||
|
bccInput,
|
||||||
|
})
|
||||||
|
|
||||||
const textEditorMenuButtons = [
|
const textEditorMenuButtons = [
|
||||||
'Paragraph',
|
'Paragraph',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user