mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
refactor: Refactor the compose placeholder text function.
This is a prep commit. Refactoring this makes it easier to reuse these functions in other places without having to create the `opts` object again.
This commit is contained in:
@@ -1222,13 +1222,7 @@ exports.initialize = function () {
|
||||
});
|
||||
|
||||
$("#compose-textarea").on("focus", () => {
|
||||
const opts = {
|
||||
message_type: compose_state.get_message_type(),
|
||||
stream: $("#stream_message_recipient_stream").val(),
|
||||
topic: $("#stream_message_recipient_topic").val(),
|
||||
private_message_recipient: compose_pm_pill.get_emails(),
|
||||
};
|
||||
compose_actions.update_placeholder_text(opts);
|
||||
compose_actions.update_placeholder_text();
|
||||
});
|
||||
|
||||
if (page_params.narrow !== undefined) {
|
||||
|
||||
@@ -118,7 +118,7 @@ exports.complete_starting_tasks = function (msg_type, opts) {
|
||||
compose_fade.start_compose(msg_type);
|
||||
ui_util.decorate_stream_bar(opts.stream, $("#stream-message .message_header_stream"), true);
|
||||
$(document).trigger($.Event("compose_started.zulip", opts));
|
||||
exports.update_placeholder_text(opts);
|
||||
exports.update_placeholder_text();
|
||||
};
|
||||
|
||||
exports.maybe_scroll_up_selected_message = function () {
|
||||
@@ -171,9 +171,15 @@ function same_recipient_as_before(msg_type, opts) {
|
||||
);
|
||||
}
|
||||
|
||||
exports.update_placeholder_text = function (opts) {
|
||||
const placeholder_text = compose_ui.compute_placeholder_text(opts);
|
||||
$("#compose-textarea").attr("placeholder", placeholder_text);
|
||||
exports.update_placeholder_text = function () {
|
||||
const opts = {
|
||||
message_type: compose_state.get_message_type(),
|
||||
stream: $("#stream_message_recipient_stream").val(),
|
||||
topic: $("#stream_message_recipient_topic").val(),
|
||||
private_message_recipient: compose_pm_pill.get_emails(),
|
||||
};
|
||||
|
||||
$("#compose-textarea").attr("placeholder", compose_ui.compute_placeholder_text(opts));
|
||||
};
|
||||
|
||||
exports.start = function (msg_type, opts) {
|
||||
|
||||
Reference in New Issue
Block a user