From 15a4fc5dcc8e7a6b51ba5c33e921f0e9b70a0c6e Mon Sep 17 00:00:00 2001 From: geta6 Date: Wed, 19 Apr 2017 22:39:46 +0900 Subject: Automatically change the size of textarea (#2128) --- app/assets/javascripts/components/components/autosuggest_textarea.jsx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/components/components/autosuggest_textarea.jsx b/app/assets/javascripts/components/components/autosuggest_textarea.jsx index 04328aae8..7c068955a 100644 --- a/app/assets/javascripts/components/components/autosuggest_textarea.jsx +++ b/app/assets/javascripts/components/components/autosuggest_textarea.jsx @@ -63,6 +63,10 @@ const AutosuggestTextarea = React.createClass({ this.props.onSuggestionsClearRequested(); } + // auto-resize textarea + e.target.style.height = 'auto'; + e.target.style.height = `${e.target.scrollHeight}px`; + this.props.onChange(e); }, -- cgit