better approach
This commit is contained in:
parent
600b2d5bbd
commit
e1dce2c5af
|
@ -28,6 +28,10 @@ const PostStatusForm = {
|
||||||
components: {
|
components: {
|
||||||
MediaUpload
|
MediaUpload
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
console.log(this.$refs)
|
||||||
|
this.resize(this.$refs.textarea)
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
let statusText = ''
|
let statusText = ''
|
||||||
|
|
||||||
|
@ -235,10 +239,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 () {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<form @submit.prevent="postStatus(newStatus)">
|
<form @submit.prevent="postStatus(newStatus)">
|
||||||
<div class="form-group" >
|
<div class="form-group" >
|
||||||
<textarea
|
<textarea
|
||||||
|
ref="textarea"
|
||||||
@click="setCaret"
|
@click="setCaret"
|
||||||
@keyup="setCaret" v-model="newStatus.status" :placeholder="$t('post_status.default')" rows="1" class="form-control"
|
@keyup="setCaret" v-model="newStatus.status" :placeholder="$t('post_status.default')" rows="1" class="form-control"
|
||||||
@keydown.down="cycleForward"
|
@keydown.down="cycleForward"
|
||||||
|
@ -15,7 +16,6 @@
|
||||||
@drop="fileDrop"
|
@drop="fileDrop"
|
||||||
@dragover.prevent="fileDrag"
|
@dragover.prevent="fileDrag"
|
||||||
@input="resize"
|
@input="resize"
|
||||||
@focus="resize"
|
|
||||||
@paste="paste">
|
@paste="paste">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue