Skip to content

Commit

Permalink
Merge pull request benawad#2852 from TheOtterlord/staging
Browse files Browse the repository at this point in the history
Fix emotes
  • Loading branch information
willdoescode authored May 20, 2021
2 parents beacbac + 526b437 commit ff16132
Show file tree
Hide file tree
Showing 2 changed files with 325 additions and 6,532 deletions.
17 changes: 13 additions & 4 deletions kibbeh/src/modules/room/chat/RoomChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,21 @@ export const RoomChatInput: React.FC<ChatInputProps> = ({ users }) => {
? inputRef!.current!.selectionStart
: position + 2) || 0;

let msg = '';

if ((message.match(/:/g)?.length ?? 0) % 2) {
msg = message.split('').reverse().join('');
msg = msg.replace(msg.split(':')[0] + ':', '');
msg = msg.split('').reverse().join('');
} else {
msg = message;
}

const newMsg = [
message.slice(0, position),
(message.endsWith(" ") ? "" : " ") +
(`:${emoji.short_names[0]}:` || "") +
msg.slice(0, position),
(`:${emoji.short_names[0]}:` || "") +
" ",
message.slice(position),
msg.slice(position),
].join("");
setMessage(newMsg);
}}
Expand Down
Loading

0 comments on commit ff16132

Please sign in to comment.