feat: add mention menu to publish & replies

This commit is contained in:
Ricardo Arturo Cabral Mejia 2022-01-30 02:12:52 +00:00
parent 550d356bd3
commit 12041956b0
No known key found for this signature in database
GPG Key ID: 8949679922214342
2 changed files with 38 additions and 1 deletions

View File

@ -3,6 +3,7 @@
<q-card-section> <q-card-section>
<q-form @submit="sendPost"> <q-form @submit="sendPost">
<q-input <q-input
ref="input"
v-model="text" v-model="text"
autogrow autogrow
autofocus autofocus
@ -44,9 +45,27 @@ export default {
data() { data() {
return { return {
text: '' text: '',
} }
}, },
computed: {
textarea() {
return this.$refs.input.$el.querySelector('textarea')
},
mentions() {
return this.createMentionsProvider()
}
},
mounted() {
this.mentions.attach(this.textarea)
},
beforeUnmount() {
this.mentions.detach(this.textarea)
},
methods: { methods: {
async sendPost() { async sendPost() {
if (!this.text.length) { if (!this.text.length) {

View File

@ -1,6 +1,7 @@
<template> <template>
<q-form class="px-24" @submit="sendReply"> <q-form class="px-24" @submit="sendReply">
<q-input <q-input
ref="input"
v-model="text" v-model="text"
autogrow autogrow
autofocus autofocus
@ -32,6 +33,23 @@ export default {
} }
}, },
computed: {
textarea() {
return this.$refs.input.$el.querySelector('textarea')
},
mentions() {
return this.createMentionsProvider()
}
},
mounted() {
this.mentions.attach(this.textarea)
},
beforeUnmount() {
this.mentions.detach(this.textarea)
},
methods: { methods: {
async sendReply() { async sendReply() {
if (!this.text.length) { if (!this.text.length) {