Mailspring/internal_packages/composer-emoji/lib/emoji-message-extension.jsx
Jackie Luo 1039ad2c34 fix(composer-emoji): Switch to characters to PNGs (#1898)
* Add PNGs and JSON file

* Add Apple and Twitter emoji

* Fix linter issues and tests

* Get correct path from EmojiStore

* Add emoji regex and update extensions

* Remove the scary regex
2016-04-12 10:27:24 -07:00

15 lines
520 B
JavaScript

import {MessageViewExtension, RegExpUtils} from 'nylas-exports';
import EmojiStore from './emoji-store';
import emoji from 'node-emoji';
class EmojiMessageExtension extends MessageViewExtension {
static formatMessageBody({message}) {
message.body = message.body.replace(RegExpUtils.emojiRegex(), (match) =>
`<img class="emoji ${emoji.which(match)}" src="${EmojiStore.getImagePath(emoji.which(match))}" width="14" height="14" style="margin-top: -5px;">`
);
}
}
export default EmojiMessageExtension;