mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 18:36:36 +00:00
compose: Rename placeholder update function for clarity.
This commit is contained in:
@@ -193,7 +193,7 @@ export let complete_starting_tasks = (opts: ComposeActionsOpts): void => {
|
|||||||
maybe_scroll_up_selected_message(opts);
|
maybe_scroll_up_selected_message(opts);
|
||||||
compose_fade.start_compose(opts.message_type);
|
compose_fade.start_compose(opts.message_type);
|
||||||
$(document).trigger(new $.Event("compose_started.zulip", opts));
|
$(document).trigger(new $.Event("compose_started.zulip", opts));
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
compose_recipient.update_narrow_to_recipient_visibility();
|
compose_recipient.update_narrow_to_recipient_visibility();
|
||||||
// We explicitly call this function here apart from compose_setup.js
|
// We explicitly call this function here apart from compose_setup.js
|
||||||
// as this helps to show banner when responding in an interleaved view.
|
// as this helps to show banner when responding in an interleaved view.
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ function switch_message_type(message_type: MessageType): void {
|
|||||||
private_message_recipient: compose_state.private_message_recipient(),
|
private_message_recipient: compose_state.private_message_recipient(),
|
||||||
};
|
};
|
||||||
update_compose_for_message_type(opts);
|
update_compose_for_message_type(opts);
|
||||||
update_placeholder_text();
|
update_compose_area_placeholder_text();
|
||||||
compose_ui.set_focus(opts);
|
compose_ui.set_focus(opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ export function initialize(): void {
|
|||||||
$("#private_message_recipient").on("input", restore_placeholder_in_firefox_for_no_input);
|
$("#private_message_recipient").on("input", restore_placeholder_in_firefox_for_no_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
export let update_placeholder_text = (): void => {
|
export let update_compose_area_placeholder_text = (): void => {
|
||||||
const $textarea: JQuery<HTMLTextAreaElement> = $("textarea#compose-textarea");
|
const $textarea: JQuery<HTMLTextAreaElement> = $("textarea#compose-textarea");
|
||||||
// Change compose placeholder text only if compose box is open.
|
// Change compose placeholder text only if compose box is open.
|
||||||
if (!$textarea.is(":visible")) {
|
if (!$textarea.is(":visible")) {
|
||||||
@@ -375,8 +375,10 @@ export let update_placeholder_text = (): void => {
|
|||||||
compose_ui.autosize_textarea($textarea);
|
compose_ui.autosize_textarea($textarea);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function rewire_update_placeholder_text(value: typeof update_placeholder_text): void {
|
export function rewire_update_compose_area_placeholder_text(
|
||||||
update_placeholder_text = value;
|
value: typeof update_compose_area_placeholder_text,
|
||||||
|
): void {
|
||||||
|
update_compose_area_placeholder_text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function addresses the issue of the placeholder not reappearing in Firefox
|
// This function addresses the issue of the placeholder not reappearing in Firefox
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ export function initialize() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("textarea#compose-textarea").on("focus", () => {
|
$("textarea#compose-textarea").on("focus", () => {
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
if (narrow_state.narrowed_by_reply()) {
|
if (narrow_state.narrowed_by_reply()) {
|
||||||
compose_notifications.maybe_show_one_time_non_interleaved_view_messages_fading_banner();
|
compose_notifications.maybe_show_one_time_non_interleaved_view_messages_fading_banner();
|
||||||
} else {
|
} else {
|
||||||
@@ -604,11 +604,11 @@ export function initialize() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("input#stream_message_recipient_topic").on("focus", () => {
|
$("input#stream_message_recipient_topic").on("focus", () => {
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input#stream_message_recipient_topic").on("input", () => {
|
$("input#stream_message_recipient_topic").on("input", () => {
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", ".formatting_button", function (e) {
|
$("body").on("click", ".formatting_button", function (e) {
|
||||||
|
|||||||
@@ -1056,7 +1056,7 @@ export function dispatch_normal_event(event) {
|
|||||||
|
|
||||||
// Update the status text in compose box placeholder when opened to self.
|
// Update the status text in compose box placeholder when opened to self.
|
||||||
if (compose_pm_pill.get_user_ids().includes(event.user_id)) {
|
if (compose_pm_pill.get_user_ids().includes(event.user_id)) {
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ export function initialize_everything(state_data) {
|
|||||||
compose_recipient.initialize();
|
compose_recipient.initialize();
|
||||||
compose_pm_pill.initialize({
|
compose_pm_pill.initialize({
|
||||||
on_pill_create_or_remove() {
|
on_pill_create_or_remove() {
|
||||||
compose_recipient.update_placeholder_text();
|
compose_recipient.update_compose_area_placeholder_text();
|
||||||
compose_recipient.check_posting_policy_for_compose_box();
|
compose_recipient.check_posting_policy_for_compose_box();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ test_ui("on_events", ({override, override_rewire}) => {
|
|||||||
(function test_undo_markdown_preview_clicked() {
|
(function test_undo_markdown_preview_clicked() {
|
||||||
fake_compose_box.show_message_preview();
|
fake_compose_box.show_message_preview();
|
||||||
|
|
||||||
override_rewire(compose_recipient, "update_placeholder_text", noop);
|
override_rewire(compose_recipient, "update_compose_area_placeholder_text", noop);
|
||||||
override(narrow_state, "narrowed_by_reply", () => true);
|
override(narrow_state, "narrowed_by_reply", () => true);
|
||||||
override(
|
override(
|
||||||
compose_notifications,
|
compose_notifications,
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ function initialize_pm_pill(mock_template) {
|
|||||||
$("#private_message_recipient").before = noop;
|
$("#private_message_recipient").before = noop;
|
||||||
|
|
||||||
compose_pm_pill.initialize({
|
compose_pm_pill.initialize({
|
||||||
on_pill_create_or_remove: compose_recipient.update_placeholder_text,
|
on_pill_create_or_remove: compose_recipient.update_compose_area_placeholder_text,
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#zephyr-mirror-error").is = noop;
|
$("#zephyr-mirror-error").is = noop;
|
||||||
|
|||||||
@@ -1087,7 +1087,7 @@ test("initialize", ({override, override_rewire, mock_template}) => {
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
compose_pm_pill.initialize({
|
compose_pm_pill.initialize({
|
||||||
on_pill_create_or_remove: compose_recipient.update_placeholder_text,
|
on_pill_create_or_remove: compose_recipient.update_compose_area_placeholder_text,
|
||||||
});
|
});
|
||||||
|
|
||||||
let expected_value;
|
let expected_value;
|
||||||
|
|||||||
Reference in New Issue
Block a user