compose_box: Add button to go the narrow message is being composed to.

This'll be shown only when in a different narrow from what
you're composing to.

Takes care of updating display of the button on moving from
one narrow to another and also on changing inputs. This is
what contributes to majority of js code in this commit.

We are not displaying this for private messages since we do not
have a consistent design for both stream and private compose areas.
See https://chat.zulip.org/#narrow/stream/101-design/topic/narrow.20to.20topic.2Fpms.20when.20composing/near/1318548

Thanks to Vlad Korobov for the icon and for proposing various
designs.
This commit is contained in:
Dinesh
2021-08-16 20:40:43 +05:30
committed by Tim Abbott
parent d00fa63aa4
commit 43107e1424
13 changed files with 96 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import {$t, $t_html} from "./i18n";
import * as loading from "./loading";
import * as markdown from "./markdown";
import * as message_edit from "./message_edit";
import * as narrow from "./narrow";
import * as notifications from "./notifications";
import {page_params} from "./page_params";
import * as people from "./people";
@@ -103,6 +104,7 @@ export function update_fade() {
function update_on_recipient_change() {
update_fade();
compose_actions.update_narrow_to_recipient_visibility();
}
export function abort_xhr() {
@@ -704,6 +706,11 @@ export function initialize() {
compose_ui.make_compose_box_full_size();
});
$("#compose").on("click", ".narrow_to_compose_recipients", (e) => {
e.preventDefault();
narrow.to_compose_target();
});
$("#compose").on("click", ".collapse_composebox_button", (e) => {
e.preventDefault();
e.stopPropagation();