mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 05:41:05 +08:00
2a431fcec7
* 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
15 lines
520 B
JavaScript
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;
|