Merge branch 'fix/additionalInputboxHeightUpdates' into 'develop'

Fix/additional inputbox height updates

See merge request pleroma/pleroma-fe!235
This commit is contained in:
Shpuld Shpludson 2018-04-15 17:33:58 +00:00
commit 8a7ed79fd3
2 changed files with 29 additions and 10 deletions

View file

@ -28,6 +28,9 @@ const PostStatusForm = {
components: { components: {
MediaUpload MediaUpload
}, },
mounted () {
this.resize(this.$refs.textarea)
},
data () { data () {
let statusText = '' let statusText = ''
@ -235,10 +238,11 @@ const PostStatusForm = {
e.dataTransfer.dropEffect = 'copy' e.dataTransfer.dropEffect = 'copy'
}, },
resize (e) { resize (e) {
e.target.style.height = 'auto' const target = e.target || e
e.target.style.height = `${e.target.scrollHeight - 10}px` target.style.height = 'auto'
if (e.target.value === '') { target.style.height = `${target.scrollHeight - 10}px`
e.target.style.height = '16px' if (target.value === '') {
target.style.height = '16px'
} }
}, },
clearError () { clearError () {

View file

@ -2,7 +2,22 @@
<div class="post-status-form"> <div class="post-status-form">
<form @submit.prevent="postStatus(newStatus)"> <form @submit.prevent="postStatus(newStatus)">
<div class="form-group" > <div class="form-group" >
<textarea @click="setCaret" @keyup="setCaret" v-model="newStatus.status" :placeholder="$t('post_status.default')" rows="1" class="form-control" @keydown.down="cycleForward" @keydown.up="cycleBackward" @keydown.shift.tab="cycleBackward" @keydown.tab="cycleForward" @keydown.enter="replaceCandidate" @keydown.meta.enter="postStatus(newStatus)" @keyup.ctrl.enter="postStatus(newStatus)" @drop="fileDrop" @dragover.prevent="fileDrag" @input="resize" @paste="paste"></textarea> <textarea
ref="textarea"
@click="setCaret"
@keyup="setCaret" v-model="newStatus.status" :placeholder="$t('post_status.default')" rows="1" class="form-control"
@keydown.down="cycleForward"
@keydown.up="cycleBackward"
@keydown.shift.tab="cycleBackward"
@keydown.tab="cycleForward"
@keydown.enter="replaceCandidate"
@keydown.meta.enter="postStatus(newStatus)"
@keyup.ctrl.enter="postStatus(newStatus)"
@drop="fileDrop"
@dragover.prevent="fileDrag"
@input="resize"
@paste="paste">
</textarea>
</div> </div>
<div style="position:relative;" v-if="candidates"> <div style="position:relative;" v-if="candidates">
<div class="autocomplete-panel"> <div class="autocomplete-panel">