From 128dcc637edb5550168423941171f5b567365b7c Mon Sep 17 00:00:00 2001
From: Xiaofeng An <futureweb2020@yandex.com>
Date: Fri, 8 Feb 2019 11:01:12 -0500
Subject: make name field auto-complete

---
 .../autocomplete_input/autocomplete_input.vue         | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'src/components/autocomplete_input/autocomplete_input.vue')

diff --git a/src/components/autocomplete_input/autocomplete_input.vue b/src/components/autocomplete_input/autocomplete_input.vue
index 1c049891..d3bda597 100644
--- a/src/components/autocomplete_input/autocomplete_input.vue
+++ b/src/components/autocomplete_input/autocomplete_input.vue
@@ -1,6 +1,7 @@
 <template>
   <div>
     <textarea
+      v-if="multiline"
       ref="textarea"
       :value="text"
       @input="text = $event.target.value, $emit('input', $event.target.value), autoResize && resize($event)" 
@@ -17,6 +18,24 @@
       @keydown.meta.enter="keydownMetaEnter && keydownMetaEnter()"
       @keyup.ctrl.enter="keyupCtrlEnter && keyupCtrlEnter()">
     </textarea>
+    <input
+      v-else
+      ref="textarea"
+      :value="text"
+      :id="id"
+      @input="text = $event.target.value, $emit('input', $event.target.value), autoResize && resize($event)" 
+      @click="setCaret"
+      @keyup="setCaret" :placeholder="placeholder" rows="1" :class="classObj"
+      @keydown.down="cycleForward"
+      @keydown.up="cycleBackward"
+      @keydown.shift.tab="cycleBackward"
+      @keydown.tab="cycleForward"
+      @keydown.enter="replaceCandidate"
+      @drop="drop && drop()"
+      @dragover.prevent="dragoverPrevent && dragoverPrevent()"
+      @paste="paste && paste()"
+      @keydown.meta.enter="keydownMetaEnter && keydownMetaEnter()"
+      @keyup.ctrl.enter="keyupCtrlEnter && keyupCtrlEnter()"/>
     <div style="position:relative;" v-if="candidates">
       <div class="autocomplete-panel">
         <div v-for="candidate in candidates" @click="replace(candidate.utf || (candidate.screen_name + ' '))">
-- 
cgit v1.2.3-70-g09d2

