From: Dessalines <tyhou13@gmx.com>
Date: Tue, 2 Feb 2021 16:45:38 +0000 (-0500)
Subject: Fix url link selection placement. Fixes #155
X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/search?a=commitdiff_plain;h=7d8f1a1cedd457e45e8da16a72f64604157c7c53;p=lemmy-ui.git

Fix url link selection placement. Fixes #155
---

diff --git a/src/shared/components/markdown-textarea.tsx b/src/shared/components/markdown-textarea.tsx
index 21af02c..ded6dd1 100644
--- a/src/shared/components/markdown-textarea.tsx
+++ b/src/shared/components/markdown-textarea.tsx
@@ -422,11 +422,11 @@ export class MarkdownTextArea extends Component<
         start
       )}[${selectedText}]()${i.state.content.substring(end)}`;
       textarea.focus();
-      setTimeout(() => (textarea.selectionEnd = end + 5), 10);
+      setTimeout(() => (textarea.selectionEnd = end + 3), 10);
     } else {
       i.state.content += '[]()';
       textarea.focus();
-      setTimeout(() => (textarea.selectionEnd -= 0), 10);
+      setTimeout(() => (textarea.selectionEnd -= 1), 10);
     }
     i.setState(i.state);
   }