2016-04-13 01:27:24 +08:00
|
|
|
import {MessageViewExtension, RegExpUtils} from 'nylas-exports';
|
|
|
|
|
|
|
|
import EmojiStore from './emoji-store';
|
|
|
|
import emoji from 'node-emoji';
|
2016-03-25 01:42:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
class EmojiMessageExtension extends MessageViewExtension {
|
|
|
|
static formatMessageBody({message}) {
|
2016-04-13 01:27:24 +08:00
|
|
|
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;">`
|
2016-03-25 01:42:44 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default EmojiMessageExtension;
|