]> Untitled Git - lemmy.git/commitdiff
Comment image uploads resize textarea. Fixes #460
authorDessalines <tyhou13@gmx.com>
Sat, 25 Jan 2020 02:53:37 +0000 (21:53 -0500)
committerDessalines <tyhou13@gmx.com>
Sat, 25 Jan 2020 02:53:37 +0000 (21:53 -0500)
ui/src/components/comment-form.tsx

index f4eb118153f7565d0992ad869495ec8b531f4453..e4543d6653dee05ca742ad6375cde71e8b6d7862 100644 (file)
@@ -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;