aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlambadalambda <gitgud@rogerbraun.net>2017-06-01 11:25:12 -0400
committerlambadalambda <gitgud@rogerbraun.net>2017-06-01 11:25:12 -0400
commit934bbd16f196d362ac127f7a44059f9d9a0c1a0b (patch)
tree03faa735f59f5a6f6de2d87802a41189b588bc0b
parent9723d7285df1ef74f572c07016b11dd1c692ad33 (diff)
parentb6b0a221c6bada47aad3310c4f20081104039c29 (diff)
Merge branch 'feature/autoresize-post-status-form' into 'develop'
Make text input grow to a minimum height of 3 lines on focus See merge request !82
-rw-r--r--src/components/post_status_form/post_status_form.js5
-rw-r--r--src/components/post_status_form/post_status_form.vue6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 86792ce1..df4c7baf 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -63,6 +63,8 @@ const PostStatusForm = {
files: []
}
this.$emit('posted')
+ let el = this.$el.querySelector('textarea')
+ el.style.height = '16px'
},
addMediaFile (fileInfo) {
this.newStatus.files.push(fileInfo)
@@ -93,6 +95,9 @@ const PostStatusForm = {
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'
+ }
}
}
}
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 2a25f73b..11b63308 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -2,7 +2,7 @@
<div class="post-status-form">
<form @submit.prevent="postStatus(newStatus)">
<div class="form-group base03-border" >
- <textarea v-model="newStatus.status" placeholder="Just landed in L.A." rows="1" class="form-control" @keyup.meta.enter="postStatus(newStatus)" @keyup.ctrl.enter="postStatus(newStatus)" @drop="fileDrop" @dragover.prevent="fileDrag" @input="resize"></textarea>
+ <textarea id="benis" v-model="newStatus.status" placeholder="Just landed in L.A." rows="1" class="form-control" @keyup.meta.enter="postStatus(newStatus)" @keyup.ctrl.enter="postStatus(newStatus)" @drop="fileDrop" @dragover.prevent="fileDrag" @input="resize"></textarea>
</div>
<div class='form-bottom'>
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload>
@@ -93,6 +93,10 @@
overflow: hidden;
}
+ form textarea:focus {
+ min-height: 48px;
+ }
+
.btn {
cursor: pointer;
}