Skip to content

Commit

Permalink
Focus on text area after quoting
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Jan 29, 2025
1 parent d65ba99 commit abfdf81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/web/src/CommentInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ const CommentInput = (props) => {

const start = textarea.selectionStart;
const end = textarea.selectionEnd;
const quote = `> ${selected}`;
const quote = `> ${selected}\n\n`;

setText(text.slice(0, start) + quote + text.slice(end));

setTimeout(() => {
textarea.focus();
textarea.selectionStart = textarea.selectionEnd = start + quote.length;
}, 0);
};
Expand Down

0 comments on commit abfdf81

Please sign in to comment.