fix(composer-emoji): Render emoji characters on Windows/Linux

This commit is contained in:
Jackie Luo 2016-03-28 16:18:41 -07:00
parent 6a151b4f14
commit 62b06121f6

View file

@ -269,10 +269,7 @@ class EmojiButtonPopover extends React.Component {
ctx.fillStyle = 'black';
if (this.state.categorizedEmoji[category].length === 0) return;
this.state.categorizedEmoji[category].forEach((emojiName, j) => {
if (process.platform === "darwin" && missingEmojiList.indexOf(emojiName) === -1) {
const emojiChar = emoji.get(emojiName);
ctx.fillText(emojiChar, position.x, position.y);
} else {
if (process.platform === "darwin" && missingEmojiList.indexOf(emojiName) !== -1) {
const img = new Image();
img.src = `images/composer-emoji/missing-emoji/${emojiName}.png`;
const x = position.x;
@ -280,6 +277,9 @@ class EmojiButtonPopover extends React.Component {
img.onload = () => {
ctx.drawImage(img, x, y - 30, 32, 32);
}
} else {
const emojiChar = emoji.get(emojiName);
ctx.fillText(emojiChar, position.x, position.y);
}
if (position.x > 325 && j < this.state.categorizedEmoji[category].length - 1) {
position.x = 18;