mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
compose: Change stream field in composebox to be a dropdown.
Fixes #11832 This lets the user see more options than the three that appear in the typeahead menu, and prevents them from inputting invalid stream names. This change replaces the input field with the dropdown, and updates everything that referred to the classnames of the old input field, so that they now get the data they need from the new dropdown.
This commit is contained in:
@@ -62,7 +62,7 @@ function get_focus_area(msg_type, opts) {
|
||||
}
|
||||
|
||||
if (msg_type === "stream") {
|
||||
return "#stream_message_recipient_stream";
|
||||
return "#compose_select_stream_widget";
|
||||
}
|
||||
return "#private_message_recipient";
|
||||
}
|
||||
@@ -70,9 +70,16 @@ function get_focus_area(msg_type, opts) {
|
||||
// Export for testing
|
||||
export const _get_focus_area = get_focus_area;
|
||||
|
||||
export function open_compose_stream_dropup() {
|
||||
if ($("#id_compose_select_stream").hasClass("open")) {
|
||||
return;
|
||||
}
|
||||
$("#id_compose_select_stream > .dropdown-toggle").dropdown("toggle");
|
||||
}
|
||||
|
||||
export function set_focus(msg_type, opts) {
|
||||
const focus_area = get_focus_area(msg_type, opts);
|
||||
if (window.getSelection().toString() === "" || opts.trigger !== "message click") {
|
||||
const focus_area = get_focus_area(msg_type, opts);
|
||||
const $elt = $(focus_area);
|
||||
$elt.trigger("focus").trigger("select");
|
||||
}
|
||||
@@ -321,6 +328,12 @@ export function start(msg_type, opts) {
|
||||
clear_box();
|
||||
}
|
||||
|
||||
compose_ui.compose_stream_widget.render(opts.stream);
|
||||
const $stream_header_colorblock = $("#compose_stream_selection_dropdown").find(
|
||||
".stream_header_colorblock",
|
||||
);
|
||||
stream_bar.decorate(opts.stream, $stream_header_colorblock, false);
|
||||
|
||||
// We set the stream/topic/private_message_recipient
|
||||
// unconditionally here, which assumes the caller will have passed
|
||||
// '' or undefined for these values if they are not appropriate
|
||||
|
||||
Reference in New Issue
Block a user