Skip to content

Commit

Permalink
fix: whatsapp box not getting focused
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 30, 2024
1 parent 85419c3 commit 366508f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/components/Activities/WhatsAppBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@update:modelValue="
() => {
content += emoji
$refs.textarea.$el.focus()
$refs.textareaRef.el.focus()
capture('whatsapp_emoji_added')
}
"
Expand All @@ -50,15 +50,15 @@
</IconPicker>
</div>
<Textarea
ref="textarea"
ref="textareaRef"
type="textarea"
class="min-h-8 w-full"
:rows="rows"
v-model="content"
:placeholder="placeholder"
@focus="rows = 6"
@blur="rows = 1"
@keydown.enter="(e) => sendTextMessage(e)"
@keydown.enter.stop="(e) => sendTextMessage(e)"
/>
</div>
</template>
Expand All @@ -78,15 +78,15 @@ 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('')
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) {
Expand All @@ -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')
}
Expand Down

0 comments on commit 366508f

Please sign in to comment.