diff options
| author | Henry Jameson <me@hjkos.com> | 2018-04-15 15:55:47 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-05-12 15:19:53 +0300 |
| commit | 57e91bc783b8f507e537b30b2207cbc91ff4fd34 (patch) | |
| tree | 810e1ac2c0290174ceabb23aa58b37ce8d741a09 | |
| parent | 15a7151ade2cfb0a69216cac13e34ed255099aff (diff) | |
fix jumping inputbox's height
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 6bcf1c66..7d1886a6 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -239,14 +239,12 @@ const PostStatusForm = { e.dataTransfer.dropEffect = 'copy' }, resize (e) { - const target = e.target || e - target.style.height = 'auto' - const heightPx = target.scrollHeight - 10 - if (heightPx > 54) { - target.style.height = `${target.scrollHeight - 10}px` - } - if (target.value === '') { - target.style.height = '16px' + const vertPadding = window.getComputedStyle(e.target)['padding-top'] + + window.getComputedStyle(e.target)['padding-bottom'] + e.target.style.height = 'auto' + e.target.style.height = `${e.target.scrollHeight - vertPadding}px` + if (e.target.value === '') { + e.target.style.height = '16px' } }, clearError () { |
