mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
mobile sharing: Make emoji.js a shared ES6 module.
This is a pretty straightforward conversion. The bulk of the diff is just changing emoji.js to ES6 syntax. There is one little todo that can be deferred to the next commit--we are now set up to have markdown.js require emoji.js directly, since it is no longer on `window`.
This commit is contained in:
@@ -143,7 +143,6 @@
|
|||||||
"drafts": false,
|
"drafts": false,
|
||||||
"dropdown_list_widget": false,
|
"dropdown_list_widget": false,
|
||||||
"echo": false,
|
"echo": false,
|
||||||
"emoji": false,
|
|
||||||
"emoji_picker": false,
|
"emoji_picker": false,
|
||||||
"favicon": false,
|
"favicon": false,
|
||||||
"feature_flags": false,
|
"feature_flags": false,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
const typeahead = zrequire("typeahead", "shared/js/typeahead");
|
const typeahead = zrequire("typeahead", "shared/js/typeahead");
|
||||||
zrequire("compose_state");
|
zrequire("compose_state");
|
||||||
zrequire("pm_conversations");
|
zrequire("pm_conversations");
|
||||||
zrequire("emoji");
|
|
||||||
set_global("Handlebars", global.make_handlebars());
|
set_global("Handlebars", global.make_handlebars());
|
||||||
zrequire("templates");
|
zrequire("templates");
|
||||||
zrequire("typeahead_helper");
|
zrequire("typeahead_helper");
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ const page_params = global.page_params;
|
|||||||
|
|
||||||
// For data-oriented modules, just use them, don't stub them.
|
// For data-oriented modules, just use them, don't stub them.
|
||||||
zrequire("alert_words");
|
zrequire("alert_words");
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("unread");
|
zrequire("unread");
|
||||||
zrequire("stream_topic_history");
|
zrequire("stream_topic_history");
|
||||||
zrequire("stream_list");
|
zrequire("stream_list");
|
||||||
@@ -77,6 +76,8 @@ zrequire("starred_messages");
|
|||||||
zrequire("user_status");
|
zrequire("user_status");
|
||||||
zrequire("subs");
|
zrequire("subs");
|
||||||
|
|
||||||
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
|
|
||||||
zrequire("server_events_dispatch");
|
zrequire("server_events_dispatch");
|
||||||
zrequire("panels");
|
zrequire("panels");
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
|||||||
|
|
||||||
const events = require("./lib/events.js");
|
const events = require("./lib/events.js");
|
||||||
|
|
||||||
zrequire("emoji");
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
|
|
||||||
const realm_emoji = events.fixtures.realm_emoji.realm_emoji;
|
const realm_emoji = events.fixtures.realm_emoji.realm_emoji;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
zrequire("emoji");
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
zrequire("emoji_picker");
|
zrequire("emoji_picker");
|
||||||
|
|
||||||
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ set_global("overlays", {});
|
|||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
set_global("$", global.make_zjquery());
|
set_global("$", global.make_zjquery());
|
||||||
|
|
||||||
zrequire("emoji");
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
|
|
||||||
emoji.initialize({
|
emoji.initialize({
|
||||||
realm_emoji: {},
|
realm_emoji: {},
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
zrequire("hash_util");
|
zrequire("hash_util");
|
||||||
set_global("marked", zrequire("marked", "third/marked/lib/marked"));
|
set_global("marked", zrequire("marked", "third/marked/lib/marked"));
|
||||||
|
|
||||||
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
||||||
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
|
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
|
||||||
const markdown_config = zrequire("markdown_config");
|
const markdown_config = zrequire("markdown_config");
|
||||||
|
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("markdown");
|
zrequire("markdown");
|
||||||
zrequire("message_store");
|
zrequire("message_store");
|
||||||
zrequire("people");
|
zrequire("people");
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const markdown_config = zrequire("markdown_config");
|
|||||||
set_global("marked", zrequire("marked", "third/marked/lib/marked"));
|
set_global("marked", zrequire("marked", "third/marked/lib/marked"));
|
||||||
set_global("page_params", {});
|
set_global("page_params", {});
|
||||||
|
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("hash_util");
|
zrequire("hash_util");
|
||||||
zrequire("message_store");
|
zrequire("message_store");
|
||||||
zrequire("people");
|
zrequire("people");
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ set_global("document", "document-stub");
|
|||||||
set_global("$", global.make_zjquery());
|
set_global("$", global.make_zjquery());
|
||||||
|
|
||||||
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
||||||
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
|
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("people");
|
zrequire("people");
|
||||||
zrequire("reactions");
|
zrequire("reactions");
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ set_global("Handlebars", global.make_handlebars());
|
|||||||
zrequire("recent_senders");
|
zrequire("recent_senders");
|
||||||
zrequire("pm_conversations");
|
zrequire("pm_conversations");
|
||||||
zrequire("people");
|
zrequire("people");
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("stream_data");
|
zrequire("stream_data");
|
||||||
zrequire("narrow");
|
zrequire("narrow");
|
||||||
zrequire("hash_util");
|
zrequire("hash_util");
|
||||||
zrequire("marked", "third/marked/lib/marked");
|
zrequire("marked", "third/marked/lib/marked");
|
||||||
|
|
||||||
|
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||||
const pygments_data = zrequire("pygments_data", "generated/pygments_data.json");
|
const pygments_data = zrequire("pygments_data", "generated/pygments_data.json");
|
||||||
const actual_pygments_data = Object.assign({}, pygments_data);
|
const actual_pygments_data = Object.assign({}, pygments_data);
|
||||||
const ct = zrequire("composebox_typeahead");
|
const ct = zrequire("composebox_typeahead");
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const rewiremock = require("rewiremock/node");
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
const util = zrequire("util");
|
const util = zrequire("util");
|
||||||
|
|
||||||
set_global("document", {
|
set_global("document", {
|
||||||
location: {
|
location: {
|
||||||
protocol: "http",
|
protocol: "http",
|
||||||
@@ -74,7 +75,6 @@ ui.get_scroll_element = (element) => element;
|
|||||||
zrequire("alert_words");
|
zrequire("alert_words");
|
||||||
zrequire("hash_util");
|
zrequire("hash_util");
|
||||||
zrequire("echo");
|
zrequire("echo");
|
||||||
zrequire("emoji");
|
|
||||||
zrequire("colorspace");
|
zrequire("colorspace");
|
||||||
zrequire("stream_color");
|
zrequire("stream_color");
|
||||||
zrequire("stream_edit");
|
zrequire("stream_edit");
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ import "../settings_profile_fields.js";
|
|||||||
import "../settings.js";
|
import "../settings.js";
|
||||||
import "../admin.js";
|
import "../admin.js";
|
||||||
import "../tab_bar.js";
|
import "../tab_bar.js";
|
||||||
import "../emoji.js";
|
|
||||||
import "../bot_data.js";
|
import "../bot_data.js";
|
||||||
import "../reactions.js";
|
import "../reactions.js";
|
||||||
import "../typing.js";
|
import "../typing.js";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const autosize = require("autosize");
|
|||||||
const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js");
|
const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js");
|
||||||
|
|
||||||
const pygments_data = require("../generated/pygments_data.json");
|
const pygments_data = require("../generated/pygments_data.json");
|
||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
const typeahead = require("../shared/js/typeahead");
|
const typeahead = require("../shared/js/typeahead");
|
||||||
|
|
||||||
const settings_data = require("./settings_data");
|
const settings_data = require("./settings_data");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const emoji_codes = require("../generated/emoji/emoji_codes.json");
|
const emoji_codes = require("../generated/emoji/emoji_codes.json");
|
||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
const typeahead = require("../shared/js/typeahead");
|
const typeahead = require("../shared/js/typeahead");
|
||||||
const render_emoji_popover = require("../templates/emoji_popover.hbs");
|
const render_emoji_popover = require("../templates/emoji_popover.hbs");
|
||||||
const render_emoji_popover_content = require("../templates/emoji_popover_content.hbs");
|
const render_emoji_popover_content = require("../templates/emoji_popover_content.hbs");
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
|
|
||||||
function do_narrow_action(action) {
|
function do_narrow_action(action) {
|
||||||
action(current_msg_list.selected_id(), {trigger: "hotkey"});
|
action(current_msg_list.selected_id(), {trigger: "hotkey"});
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// TODO: move to markdown.
|
||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This config is in a separate file for partly
|
This config is in a separate file for partly
|
||||||
tactical reasons. We want the webapp to
|
tactical reasons. We want the webapp to
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
const render_message_reaction = require("../templates/message_reaction.hbs");
|
const render_message_reaction = require("../templates/message_reaction.hbs");
|
||||||
|
|
||||||
exports.view = {}; // function namespace
|
exports.view = {}; // function namespace
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
|
|
||||||
const settings_config = require("./settings_config");
|
const settings_config = require("./settings_config");
|
||||||
|
|
||||||
exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
const render_admin_emoji_list = require("../templates/admin_emoji_list.hbs");
|
const render_admin_emoji_list = require("../templates/admin_emoji_list.hbs");
|
||||||
const render_settings_emoji_settings_tip = require("../templates/settings/emoji_settings_tip.hbs");
|
const render_settings_emoji_settings_tip = require("../templates/settings/emoji_settings_tip.hbs");
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const pygments_data = require("../generated/pygments_data.json");
|
const pygments_data = require("../generated/pygments_data.json");
|
||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
const typeahead = require("../shared/js/typeahead");
|
const typeahead = require("../shared/js/typeahead");
|
||||||
const render_typeahead_list_item = require("../templates/typeahead_list_item.hbs");
|
const render_typeahead_list_item = require("../templates/typeahead_list_item.hbs");
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const generated_emoji_codes = require("../generated/emoji/emoji_codes.json");
|
const generated_emoji_codes = require("../generated/emoji/emoji_codes.json");
|
||||||
|
const emoji = require("../shared/js/emoji");
|
||||||
|
|
||||||
const emojisets = require("./emojisets");
|
const emojisets = require("./emojisets");
|
||||||
const markdown_config = require("./markdown_config");
|
const markdown_config = require("./markdown_config");
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ let emoji_codes = {};
|
|||||||
// `emojis_by_name` is the central data source that is supposed to be
|
// `emojis_by_name` is the central data source that is supposed to be
|
||||||
// used by every widget in the webapp for gathering data for displaying
|
// used by every widget in the webapp for gathering data for displaying
|
||||||
// emojis. Emoji picker uses this data to derive data for its own use.
|
// emojis. Emoji picker uses this data to derive data for its own use.
|
||||||
exports.emojis_by_name = new Map();
|
export const emojis_by_name = new Map();
|
||||||
|
|
||||||
exports.all_realm_emojis = new Map();
|
export const all_realm_emojis = new Map();
|
||||||
exports.active_realm_emojis = new Map();
|
export const active_realm_emojis = new Map();
|
||||||
|
|
||||||
const default_emoji_aliases = new Map();
|
const default_emoji_aliases = new Map();
|
||||||
|
|
||||||
@@ -19,7 +19,9 @@ const default_emoji_aliases = new Map();
|
|||||||
let server_realm_emoji_data = {};
|
let server_realm_emoji_data = {};
|
||||||
|
|
||||||
// We really want to deprecate this, too.
|
// We really want to deprecate this, too.
|
||||||
exports.get_server_realm_emoji_data = () => server_realm_emoji_data;
|
export function get_server_realm_emoji_data() {
|
||||||
|
return server_realm_emoji_data;
|
||||||
|
}
|
||||||
|
|
||||||
function escape_regexp(string) {
|
function escape_regexp(string) {
|
||||||
// HIGHLY DEPRECATED!!!!
|
// HIGHLY DEPRECATED!!!!
|
||||||
@@ -74,26 +76,26 @@ const zulip_emoji = {
|
|||||||
deactivated: false,
|
deactivated: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.get_emoji_name = (codepoint) => {
|
export function get_emoji_name(codepoint) {
|
||||||
// get_emoji_name('1f384') === 'holiday_tree'
|
// get_emoji_name('1f384') === 'holiday_tree'
|
||||||
if (Object.prototype.hasOwnProperty.call(emoji_codes.codepoint_to_name, codepoint)) {
|
if (Object.prototype.hasOwnProperty.call(emoji_codes.codepoint_to_name, codepoint)) {
|
||||||
return emoji_codes.codepoint_to_name[codepoint];
|
return emoji_codes.codepoint_to_name[codepoint];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_emoji_codepoint = (emoji_name) => {
|
export function get_emoji_codepoint(emoji_name) {
|
||||||
// get_emoji_codepoint('avocado') === '1f951'
|
// get_emoji_codepoint('avocado') === '1f951'
|
||||||
if (Object.prototype.hasOwnProperty.call(emoji_codes.name_to_codepoint, emoji_name)) {
|
if (Object.prototype.hasOwnProperty.call(emoji_codes.name_to_codepoint, emoji_name)) {
|
||||||
return emoji_codes.name_to_codepoint[emoji_name];
|
return emoji_codes.name_to_codepoint[emoji_name];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_realm_emoji_url = (emoji_name) => {
|
export function get_realm_emoji_url(emoji_name) {
|
||||||
// If the emoji name is a realm emoji, returns the URL for it.
|
// If the emoji name is a realm emoji, returns the URL for it.
|
||||||
// Returns undefined for unicode emoji.
|
// Returns undefined for unicode emoji.
|
||||||
// get_realm_emoji_url('shrug') === '/user_avatars/2/emoji/images/31.png'
|
// get_realm_emoji_url('shrug') === '/user_avatars/2/emoji/images/31.png'
|
||||||
|
|
||||||
const data = exports.active_realm_emojis.get(emoji_name);
|
const data = active_realm_emojis.get(emoji_name);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
// Not all emojis have urls, plus the user
|
// Not all emojis have urls, plus the user
|
||||||
@@ -106,10 +108,10 @@ exports.get_realm_emoji_url = (emoji_name) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return data.emoji_url;
|
return data.emoji_url;
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.build_emoji_data = function (realm_emojis) {
|
export function build_emoji_data(realm_emojis) {
|
||||||
exports.emojis_by_name.clear();
|
emojis_by_name.clear();
|
||||||
for (const [realm_emoji_name, realm_emoji] of realm_emojis) {
|
for (const [realm_emoji_name, realm_emoji] of realm_emojis) {
|
||||||
const emoji_dict = {
|
const emoji_dict = {
|
||||||
name: realm_emoji_name,
|
name: realm_emoji_name,
|
||||||
@@ -119,13 +121,13 @@ exports.build_emoji_data = function (realm_emojis) {
|
|||||||
url: realm_emoji.emoji_url,
|
url: realm_emoji.emoji_url,
|
||||||
has_reacted: false,
|
has_reacted: false,
|
||||||
};
|
};
|
||||||
exports.emojis_by_name.set(realm_emoji_name, emoji_dict);
|
emojis_by_name.set(realm_emoji_name, emoji_dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const codepoints of Object.values(emoji_codes.emoji_catalog)) {
|
for (const codepoints of Object.values(emoji_codes.emoji_catalog)) {
|
||||||
for (const codepoint of codepoints) {
|
for (const codepoint of codepoints) {
|
||||||
const emoji_name = exports.get_emoji_name(codepoint);
|
const emoji_name = get_emoji_name(codepoint);
|
||||||
if (emoji_name !== undefined && !exports.emojis_by_name.has(emoji_name)) {
|
if (emoji_name !== undefined && !emojis_by_name.has(emoji_name)) {
|
||||||
const emoji_dict = {
|
const emoji_dict = {
|
||||||
name: emoji_name,
|
name: emoji_name,
|
||||||
display_name: emoji_name,
|
display_name: emoji_name,
|
||||||
@@ -134,32 +136,32 @@ exports.build_emoji_data = function (realm_emojis) {
|
|||||||
emoji_code: codepoint,
|
emoji_code: codepoint,
|
||||||
has_reacted: false,
|
has_reacted: false,
|
||||||
};
|
};
|
||||||
exports.emojis_by_name.set(emoji_name, emoji_dict);
|
emojis_by_name.set(emoji_name, emoji_dict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
exports.update_emojis = function (realm_emojis) {
|
export function update_emojis(realm_emojis) {
|
||||||
// The settings code still works with the
|
// The settings code still works with the
|
||||||
// server format of the data.
|
// server format of the data.
|
||||||
server_realm_emoji_data = realm_emojis;
|
server_realm_emoji_data = realm_emojis;
|
||||||
|
|
||||||
// exports.all_realm_emojis is emptied before adding the realm-specific emoji
|
// all_realm_emojis is emptied before adding the realm-specific emoji
|
||||||
// to it. This makes sure that in case of deletion, the deleted realm_emojis
|
// to it. This makes sure that in case of deletion, the deleted realm_emojis
|
||||||
// don't persist in exports.active_realm_emojis.
|
// don't persist in active_realm_emojis.
|
||||||
exports.all_realm_emojis.clear();
|
all_realm_emojis.clear();
|
||||||
exports.active_realm_emojis.clear();
|
active_realm_emojis.clear();
|
||||||
|
|
||||||
for (const data of Object.values(realm_emojis)) {
|
for (const data of Object.values(realm_emojis)) {
|
||||||
exports.all_realm_emojis.set(data.id, {
|
all_realm_emojis.set(data.id, {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
emoji_name: data.name,
|
emoji_name: data.name,
|
||||||
emoji_url: data.source_url,
|
emoji_url: data.source_url,
|
||||||
deactivated: data.deactivated,
|
deactivated: data.deactivated,
|
||||||
});
|
});
|
||||||
if (data.deactivated !== true) {
|
if (data.deactivated !== true) {
|
||||||
exports.active_realm_emojis.set(data.name, {
|
active_realm_emojis.set(data.name, {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
emoji_name: data.name,
|
emoji_name: data.name,
|
||||||
emoji_url: data.source_url,
|
emoji_url: data.source_url,
|
||||||
@@ -167,19 +169,19 @@ exports.update_emojis = function (realm_emojis) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add the Zulip emoji to the realm emojis list
|
// Add the Zulip emoji to the realm emojis list
|
||||||
exports.all_realm_emojis.set("zulip", zulip_emoji);
|
all_realm_emojis.set("zulip", zulip_emoji);
|
||||||
exports.active_realm_emojis.set("zulip", zulip_emoji);
|
active_realm_emojis.set("zulip", zulip_emoji);
|
||||||
|
|
||||||
exports.build_emoji_data(exports.active_realm_emojis);
|
build_emoji_data(active_realm_emojis);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.initialize = function initialize(params) {
|
export function initialize(params) {
|
||||||
emoji_codes = params.emoji_codes;
|
emoji_codes = params.emoji_codes;
|
||||||
|
|
||||||
build_emoticon_translations();
|
build_emoticon_translations();
|
||||||
|
|
||||||
for (const value of emoji_codes.names) {
|
for (const value of emoji_codes.names) {
|
||||||
const base_name = exports.get_emoji_codepoint(value);
|
const base_name = get_emoji_codepoint(value);
|
||||||
|
|
||||||
if (default_emoji_aliases.has(base_name)) {
|
if (default_emoji_aliases.has(base_name)) {
|
||||||
default_emoji_aliases.get(base_name).push(value);
|
default_emoji_aliases.get(base_name).push(value);
|
||||||
@@ -188,22 +190,22 @@ exports.initialize = function initialize(params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.update_emojis(params.realm_emoji);
|
update_emojis(params.realm_emoji);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_canonical_name = function (emoji_name) {
|
export function get_canonical_name(emoji_name) {
|
||||||
if (exports.active_realm_emojis.has(emoji_name)) {
|
if (active_realm_emojis.has(emoji_name)) {
|
||||||
return emoji_name;
|
return emoji_name;
|
||||||
}
|
}
|
||||||
const codepoint = exports.get_emoji_codepoint(emoji_name);
|
const codepoint = get_emoji_codepoint(emoji_name);
|
||||||
if (codepoint === undefined) {
|
if (codepoint === undefined) {
|
||||||
// Our caller needs to handle this possibility.
|
// Our caller needs to handle this possibility.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return exports.get_emoji_name(codepoint);
|
return get_emoji_name(codepoint);
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_emoticon_translations = () => emoticon_translations;
|
export function get_emoticon_translations() {
|
||||||
|
return emoticon_translations;
|
||||||
window.emoji = exports;
|
}
|
||||||
Reference in New Issue
Block a user