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