]> Untitled Git - lemmy-ui.git/commitdiff
Merge branch 'main' into undefined_quote
authorJay Sitter <jsit@users.noreply.github.com>
Sun, 2 Jul 2023 19:11:48 +0000 (15:11 -0400)
committerGitHub <noreply@github.com>
Sun, 2 Jul 2023 19:11:48 +0000 (15:11 -0400)
src/shared/components/common/markdown-textarea.tsx

index 29075b975a36b35afd624a5d3cffda29c7a928a8..a4ac29268559589b813dcbbef132cc1f19352e2b 100644 (file)
@@ -702,18 +702,20 @@ export class MarkdownTextArea extends Component<
   quoteInsert() {
     const textarea: any = document.getElementById(this.id);
     const selectedText = window.getSelection()?.toString();
-    const { content } = this.state;
+    let { content } = this.state;
     if (selectedText) {
       const quotedText =
         selectedText
           .split("\n")
           .map(t => `> ${t}`)
           .join("\n") + "\n\n";
+
       if (!content) {
-        this.setState({ content: "" });
+        content = "";
       } else {
-        this.setState({ content: `${content}\n` });
+        content = `${content}\n\n`;
       }
+
       this.setState({
         content: `${content}${quotedText}`,
       });