summaryrefslogtreecommitdiffstats
path: root/ui/src/components/comment-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-24 21:53:37 -0500
committerDessalines <tyhou13@gmx.com>2020-01-24 21:53:37 -0500
commit7e6842e63a84d8fa97135ec1d94342e5b10e5dc5 (patch)
tree3eeeb04ec73a993ac8094b7520b87c597d23fefa /ui/src/components/comment-form.tsx
parentd26f4c50d300e108882c23c954155bd03abe3d88 (diff)
Comment image uploads resize textarea. Fixes #460
Diffstat (limited to 'ui/src/components/comment-form.tsx')
-rw-r--r--ui/src/components/comment-form.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx
index f4eb1181..e4543d66 100644
--- a/ui/src/components/comment-form.tsx
+++ b/ui/src/components/comment-form.tsx
@@ -225,13 +225,15 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
.then(res => res.json())
.then(res => {
let url = `${window.location.origin}/pictshare/${res.url}`;
- let markdown =
+ let imageMarkdown =
res.filetype == 'mp4' ? `[vid](${url}/raw)` : `![](${url})`;
let content = i.state.commentForm.content;
- content = content ? `${content} ${markdown}` : markdown;
+ content = content ? `${content}\n${imageMarkdown}` : imageMarkdown;
i.state.commentForm.content = content;
i.state.imageLoading = false;
i.setState(i.state);
+ var textarea: any = document.getElementById(i.id);
+ autosize.update(textarea);
})
.catch(error => {
i.state.imageLoading = false;