diff options
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 12 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 27 |
2 files changed, 29 insertions, 10 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index c63c308c..3348445f 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -28,6 +28,9 @@ const PostStatusForm = { components: { MediaUpload }, + mounted () { + this.resize(this.$refs.textarea) + }, data () { let statusText = '' @@ -235,10 +238,11 @@ const PostStatusForm = { e.dataTransfer.dropEffect = 'copy' }, resize (e) { - e.target.style.height = 'auto' - e.target.style.height = `${e.target.scrollHeight - 10}px` - if (e.target.value === '') { - e.target.style.height = '16px' + const target = e.target || e + target.style.height = 'auto' + target.style.height = `${target.scrollHeight - 10}px` + if (target.value === '') { + target.style.height = '16px' } }, clearError () { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 69234d66..88627e3a 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -1,10 +1,25 @@ <template> - <div class="post-status-form"> - <form @submit.prevent="postStatus(newStatus)"> - <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> - </div> - <div style="position:relative;" v-if="candidates"> +<div class="post-status-form"> + <form @submit.prevent="postStatus(newStatus)"> + <div class="form-group" > + <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 style="position:relative;" v-if="candidates"> <div class="autocomplete-panel"> <div v-for="candidate in candidates" @click="replace(candidate.utf || (candidate.screen_name + ' '))"> <div v-if="candidate.highlighted" class="autocomplete"> |
