make name field auto-complete

This commit is contained in:
Xiaofeng An 2019-02-08 11:01:12 -05:00
parent 2d91c9d949
commit 128dcc637e
2 changed files with 21 additions and 2 deletions

View File

@ -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 + ' '))">

View File

@ -9,9 +9,9 @@
<div class="setting-item" >
<h2>{{$t('settings.name_bio')}}</h2>
<p>{{$t('settings.name')}}</p>
<input class='name-changer' id='username' v-model="newName"></input>
<auto-complete-input :classObj="{ 'name-changer': true }" :id="'username'" v-model="newName"/>
<p>{{$t('settings.bio')}}</p>
<auto-complete-input :classObj="{ bio: true }" v-model="newBio"/>
<auto-complete-input :classObj="{ bio: true }" v-model="newBio" :multiline="true"/>
<p>
<input type="checkbox" v-model="newLocked" id="account-locked">
<label for="account-locked">{{$t('settings.lock_account_description')}}</label>