Skip to content

Commit

Permalink
Workaround for twitter emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieoz committed May 12, 2024
1 parent 8db57a1 commit 5d2dcdc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ async function encryptAndReplaceSelectedTextPGP(sendResponse) {
const extensionUserHandle = findUsernameFromInitialState();
const selectedText = window.getSelection().toString();

// Check for emojis in the selected text. Temporary workaround for twitter treatment of selected text.
const emojiPattern = /[\u231A-\uDFFF\u200D\u263A-\uFFFF]/;
if (emojiPattern.test(selectedText)) {
alert("Please do not send messages with emojis.");
sendResponse({ status: "error", message: "Emojis are not allowed." });
return;
}

if (selectedText.length > 0) {
try {
const recipientPublicKey = await retrieveUserPublicKey(twitterHandle);
Expand Down

0 comments on commit 5d2dcdc

Please sign in to comment.