Clicking autocomplete will return focus to text area, make the autocomplete box disappear after clicking on a name.

This commit is contained in:
Shpuld Shpuldson 2017-06-16 10:26:54 +03:00
parent b24b891c1c
commit 5dc22e9273
2 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,9 @@ const PostStatusForm = {
methods: {
replace (replacement) {
this.newStatus.status = Completion.replaceWord(this.newStatus.status, this.wordAtCaret, replacement)
const el = this.$el.querySelector('textarea')
el.focus()
this.caret = 0
},
setCaret ({target: {selectionStart}}) {
this.caret = selectionStart

View File

@ -6,7 +6,7 @@
</div>
<div style="position:relative;" v-if="candidates">
<div class="autocomplete-panel base05-background">
<div v-for="candidate in candidates" @click="replace('@' + candidate.screen_name)" class="autocomplete base01">
<div v-for="candidate in candidates" @click="replace('@' + candidate.screen_name + ' ')" class="autocomplete base01">
<img :src="candidate.img"></img>
<span>
@{{candidate.screen_name}}