aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShpuld Shpuldson <shpuld@gmail.com>2017-06-16 10:26:54 +0300
committerShpuld Shpuldson <shpuld@gmail.com>2017-06-16 10:26:54 +0300
commit5dc22e9273286e3b47b1fa2d8f038f7def4e658b (patch)
tree1db01fd78938b4629d11e16949929845cbafc9e3
parentb24b891c1c8e18beece00cbe6fe92375df8b0337 (diff)
Clicking autocomplete will return focus to text area, make the autocomplete box disappear after clicking on a name.
-rw-r--r--src/components/post_status_form/post_status_form.js3
-rw-r--r--src/components/post_status_form/post_status_form.vue2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index b1e5f84d..a8b4d39c 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -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
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index c578528b..a95f92ab 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -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}}