From 2430ee00d4b1df0098a44a46eea3be743ec67ad2 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 4 Dec 2017 10:19:35 -0800 Subject: [PATCH] Emoji: Eliminate unused images, make sure panel clicks add emoji (#1849) * Emoji: Ensure that all clicks work by using emoji data directly * Eliminate a number of unused emoji images from final build * Re-add the generic sheets directory, which we partially filter --- js/views/conversation_view.js | 2 +- package.json | 3 +++ preload.js | 1 + stylesheets/_emoji.scss | 2 +- stylesheets/manifest.css | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 1147977f1..44563c137 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -974,7 +974,7 @@ this.updateMessageFieldSize({}); }, insertEmoji: function(e) { - var colons = ':' + emoji.data[e.unified.toLowerCase()][3][0] + ':'; + var colons = ':' + emojiData[e.index].short_name + ':'; var textarea = this.$messageField[0]; if (textarea.selectionStart || textarea.selectionStart == '0') { diff --git a/package.json b/package.json index 36e177c0f..96d2a6e53 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,9 @@ "fonts/*", "build/assets", "node_modules/**", + "!node_modules/emoji-datasource/*.png", + "!node_modules/emoji-datasource-apple/img/apple/{sheets-128,sheets-256}/*.png", + "!node_modules/emoji-datasource-apple/img/apple/sheets/{16,20,32}.png", "!node_modules/spellchecker/vendor/hunspell/**/*", "!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples,*.d.ts}", "!**/node_modules/.bin", diff --git a/preload.js b/preload.js index 6844c2b66..7624a6db1 100644 --- a/preload.js +++ b/preload.js @@ -53,6 +53,7 @@ }, 1000); window.EmojiConvertor = require('emoji-js'); + window.emojiData = require('emoji-datasource'); window.nodeFetch = require('node-fetch'); window.httpsAgent = require('https').Agent; window.nodeBuffer = Buffer; diff --git a/stylesheets/_emoji.scss b/stylesheets/_emoji.scss index 756249de1..4d41dcdf6 100644 --- a/stylesheets/_emoji.scss +++ b/stylesheets/_emoji.scss @@ -112,7 +112,7 @@ button.emoji { .emoji-panel-container { height: 0px; .ep-e { - background-image: url('../node_modules/emoji-datasource/sheet_apple_64.png'); + background-image: url('../node_modules/emoji-datasource-apple/img/apple/sheets/64.png'); background-size: 1734px; } .ep-slide { diff --git a/stylesheets/manifest.css b/stylesheets/manifest.css index b147a4b1f..7ef25872c 100644 --- a/stylesheets/manifest.css +++ b/stylesheets/manifest.css @@ -5688,7 +5688,7 @@ button.emoji { .emoji-panel-container { height: 0px; } .emoji-panel-container .ep-e { - background-image: url("../node_modules/emoji-datasource/sheet_apple_64.png"); + background-image: url("../node_modules/emoji-datasource-apple/img/apple/sheets/64.png"); background-size: 1734px; } .emoji-panel-container .ep-slide { background-color: #2090ea; }