diff options
author | Dessalines <tyhou13@gmx.com> | 2019-03-30 17:38:54 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-03-30 17:38:54 -0700 |
commit | 923110c7d4c94f9c5aab329bc8c80d59a7e32007 (patch) | |
tree | 6ee2d39f00abb8d3368fc3c8a37d3927990e02f2 | |
parent | 6138c6193b9a07fd47d1c1982db613a11fcf5a29 (diff) |
Adding textarea autosize to content fields on post
-rw-r--r-- | ui/package.json | 1 | ||||
-rw-r--r-- | ui/src/components/post.tsx | 9 | ||||
-rw-r--r-- | ui/yarn.lock | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/ui/package.json b/ui/package.json index 11730017..c8df32a7 100644 --- a/ui/package.json +++ b/ui/package.json @@ -16,6 +16,7 @@ "engineStrict": true, "dependencies": { "@types/js-cookie": "^2.2.1", + "autosize": "^4.0.2", "classcat": "^1.1.3", "dotenv": "^6.1.0", "inferno": "^7.0.1", diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index adb90840..adcc8616 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -5,6 +5,7 @@ import { UserOperation, Community, Post as PostI, PostResponse, Comment, Comment import { WebSocketService, UserService } from '../services'; import { msgOp, hotRank,mdToHtml } from '../utils'; import { MomentTime } from './moment-time'; +import * as autosize from 'autosize'; interface CommentNodeI { comment: Comment; @@ -54,6 +55,10 @@ export class Post extends Component<any, State> { this.subscription.unsubscribe(); } + componentDidMount() { + autosize(document.querySelectorAll('textarea')); + } + render() { return ( <div class="container"> @@ -424,6 +429,10 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { } } + componentDidMount() { + autosize(document.querySelectorAll('textarea')); + } + render() { return ( <div> diff --git a/ui/yarn.lock b/ui/yarn.lock index 7accf57b..49469788 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -191,6 +191,11 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +autosize@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/autosize/-/autosize-4.0.2.tgz#073cfd07c8bf45da4b9fd153437f5bafbba1e4c9" + integrity sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA== + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" |