mirror of https://github.com/zulip/zulip.git
js: Convert .split(…).join(…) pattern to .replace().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
513207523c
commit
ef706e51c3
|
@ -304,7 +304,7 @@ function handleUnicodeEmoji(unicode_emoji) {
|
|||
|
||||
if (emoji_name) {
|
||||
const alt_text = ":" + emoji_name + ":";
|
||||
const title = emoji_name.split("_").join(" ");
|
||||
const title = emoji_name.replace(/_/g, " ");
|
||||
return make_emoji_span(codepoint, title, alt_text);
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ function handleUnicodeEmoji(unicode_emoji) {
|
|||
|
||||
function handleEmoji(emoji_name) {
|
||||
const alt_text = ":" + emoji_name + ":";
|
||||
const title = emoji_name.split("_").join(" ");
|
||||
const title = emoji_name.replace(/_/g, " ");
|
||||
|
||||
// Zulip supports both standard/Unicode emoji, served by a
|
||||
// spritesheet and custom realm-specific emoji (served by URL).
|
||||
|
|
|
@ -210,7 +210,7 @@ export function extract_property_name(elem, for_realm_default_settings) {
|
|||
// ID approach.
|
||||
return elem.attr("name");
|
||||
}
|
||||
return /^id_(.*)$/.exec(elem.attr("id").split("-").join("_"))[1];
|
||||
return /^id_(.*)$/.exec(elem.attr("id").replace(/-/g, "_"))[1];
|
||||
}
|
||||
|
||||
function get_subsection_property_elements(element) {
|
||||
|
@ -1011,7 +1011,7 @@ export function register_save_discard_widget_handlers(
|
|||
// fields that must be submitted together, which is
|
||||
// managed by the get_complete_data_for_subsection function.
|
||||
const [, subsection_id] = /^org-submit-(.*)$/.exec(save_button.attr("id"));
|
||||
const subsection = subsection_id.split("-").join("_");
|
||||
const subsection = subsection_id.replace(/-/g, "_");
|
||||
extra_data = get_complete_data_for_subsection(subsection);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ export function render_stream(stream) {
|
|||
export function render_emoji(item) {
|
||||
const args = {
|
||||
is_emoji: true,
|
||||
primary: item.emoji_name.split("_").join(" "),
|
||||
primary: item.emoji_name.replace(/_/g, " "),
|
||||
};
|
||||
|
||||
if (item.emoji_url) {
|
||||
|
|
|
@ -100,7 +100,7 @@ export function clean_query_lowercase(query) {
|
|||
|
||||
export function get_emoji_matcher(query) {
|
||||
// replaces spaces with underscores for emoji matching
|
||||
query = query.split(" ").join("_");
|
||||
query = query.replace(/ /g, "_");
|
||||
query = clean_query_lowercase(query);
|
||||
|
||||
return function (emoji) {
|
||||
|
|
Loading…
Reference in New Issue