Mailspring/internal_packages/composer-emoji/lib/emoji-message-extension.jsx
Jackie Luo dcb8478f97 feat(composer-emoji): Add emoji button to composer
Summary: The emoji picker allows users to insert emoji to their messages on click. A few emoji that don't render properly in Chromium are replaced with PNGs, both in the composer view and the message list view, but only the Unicode characters are sent in the message bodies.

Test Plan: TODO

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2787
2016-03-24 10:45:48 -07:00

12 lines
498 B
JavaScript

import {MessageViewExtension} from 'nylas-exports';
class EmojiMessageExtension extends MessageViewExtension {
static formatMessageBody({message}) {
message.body = message.body.replace(/<span class="broken-emoji ([a-zA-Z0-9-_]*)">.*<\/span>/g, (match, emojiName) =>
`<span class="missing-emoji ${emojiName}"><img src="images/composer-emoji/missing-emoji/${emojiName}.png" width="14" height="14" style="margin-top: -5px;" /></span>`
);
}
}
export default EmojiMessageExtension;