1
0
forked from test/crm

fix: whatsapp box not getting focused

This commit is contained in:
Shariq Ansari 2024-09-30 23:03:46 +05:30
parent 85419c34d6
commit 366508fb23

View File

@ -38,7 +38,7 @@
@update:modelValue=" @update:modelValue="
() => { () => {
content += emoji content += emoji
$refs.textarea.$el.focus() $refs.textareaRef.el.focus()
capture('whatsapp_emoji_added') capture('whatsapp_emoji_added')
} }
" "
@ -50,7 +50,7 @@
</IconPicker> </IconPicker>
</div> </div>
<Textarea <Textarea
ref="textarea" ref="textareaRef"
type="textarea" type="textarea"
class="min-h-8 w-full" class="min-h-8 w-full"
:rows="rows" :rows="rows"
@ -58,7 +58,7 @@
:placeholder="placeholder" :placeholder="placeholder"
@focus="rows = 6" @focus="rows = 6"
@blur="rows = 1" @blur="rows = 1"
@keydown.enter="(e) => sendTextMessage(e)" @keydown.enter.stop="(e) => sendTextMessage(e)"
/> />
</div> </div>
</template> </template>
@ -78,7 +78,7 @@ const doc = defineModel()
const whatsapp = defineModel('whatsapp') const whatsapp = defineModel('whatsapp')
const reply = defineModel('reply') const reply = defineModel('reply')
const rows = ref(1) const rows = ref(1)
const textarea = ref(null) const textareaRef = ref(null)
const emoji = ref('') const emoji = ref('')
const content = ref('') const content = ref('')
@ -86,7 +86,7 @@ const placeholder = ref(__('Type your message here...'))
const fileType = ref('') const fileType = ref('')
function show() { function show() {
nextTick(() => textarea.value.$el.focus()) nextTick(() => textareaRef.value.el.focus())
} }
function uploadFile(file) { function uploadFile(file) {
@ -99,7 +99,7 @@ function uploadFile(file) {
function sendTextMessage(event) { function sendTextMessage(event) {
if (event.shiftKey) return if (event.shiftKey) return
sendWhatsAppMessage() sendWhatsAppMessage()
textarea.value.$el.blur() textareaRef.value.el?.blur()
content.value = '' content.value = ''
capture('whatsapp_send_message') capture('whatsapp_send_message')
} }