From 7447f7c64d06d014f1378b05465247e2392fed50 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 31 May 2017 17:36:22 +0300 Subject: [PATCH 1/2] Set minimum height of 3 lines for textarea on focus, make it reset on post. --- src/components/post_status_form/post_status_form.js | 6 ++++++ src/components/post_status_form/post_status_form.vue | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 86792ce1..f7d5babd 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -63,6 +63,9 @@ 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 +96,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 @@
- +
@@ -93,6 +93,10 @@ overflow: hidden; } + form textarea:focus { + min-height: 48px; + } + .btn { cursor: pointer; } From b6b0a221c6bada47aad3310c4f20081104039c29 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 31 May 2017 17:43:43 +0300 Subject: [PATCH 2/2] please the linter --- src/components/post_status_form/post_status_form.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index f7d5babd..df4c7baf 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -63,7 +63,6 @@ const PostStatusForm = { files: [] } this.$emit('posted') - let el = this.$el.querySelector('textarea') el.style.height = '16px' }, @@ -96,7 +95,7 @@ const PostStatusForm = { resize (e) { e.target.style.height = 'auto' e.target.style.height = `${e.target.scrollHeight - 10}px` - if (e.target.value === "") { + if (e.target.value === '') { e.target.style.height = '16px' } }