Skip to content

Commit

Permalink
Final bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro56565 committed Apr 5, 2024
1 parent 586d0c6 commit 17f8059
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function addButton() {
const tweetTextElement = section.querySelector('div[data-testid="tweetText"]');
if (tweetTextElement) {
const tweetText = tweetTextElement.textContent.trim();
if (tweetText) {
alert(tweetText);
}
pasteMessage(tweetText);
if (tweetText) {
alert(tweetText);
pasteMessage(tweetText);
}
}
});
});
Expand All @@ -43,12 +43,11 @@ function pasteMessage(text) {

if (replyTextarea) {
replyTextarea.focus();
document.execCommand('insertText', false, text);
console.log('Text inserted:', text);
document.execCommand('insertHTML', false, text);
console.log('Text inserted:', `<span>${text}</span>`);
} else {
console.error("Reply textarea not found");
}
}


addButton();

0 comments on commit 17f8059

Please sign in to comment.