Skip to content

Commit

Permalink
feat: enable comments button with focus and blur field
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab committed Nov 16, 2023
1 parent fac83a8 commit 9567204
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/ai-utils/cursorPositionInsert.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// This function is used to insert text at the cursor position in the text area
export const insertTextAtCursor = (textArea: HTMLTextAreaElement, text: string) => {
let length = 0;
textArea.focus();

Check failure on line 4 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Expected blank line before this statement

Check failure on line 4 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Expected blank line before this statement
const typewriter = setInterval(() => {
textArea.setRangeText(text[length++], textArea.selectionStart, textArea.selectionEnd, "end");
if (length >= text.length) {
clearInterval(typewriter);
textArea.setRangeText("\n\n_Generated using [OpenSauced](https://opensauced.ai/)._", textArea.selectionStart, textArea.selectionEnd, "end");
textArea.ownerDocument.execCommand('insertText', false, "\n\n_Generated using [OpenSauced](https://opensauced.ai/)_");

Check failure on line 9 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Strings must use doublequote

Check failure on line 9 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Strings must use doublequote

Check failure on line 9 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Strings must use doublequote

Check failure on line 9 in src/utils/ai-utils/cursorPositionInsert.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Strings must use doublequote
textArea.blur();
}
}, 10);
};

0 comments on commit 9567204

Please sign in to comment.