mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 13:24:19 +00:00
Add allow to click on the reply preview to go to the message (#10357)
Release Notes: - Added support for scrolling to the message you are replying to when clicking on the reply preview ([#10028](https://github.com/zed-industries/zed/issues/10028)). Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
This commit is contained in:
parent
43c115a747
commit
36a87d0f5c
1 changed files with 19 additions and 1 deletions
|
@ -913,6 +913,10 @@ impl ChatPanel {
|
|||
|
||||
impl Render for ChatPanel {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let channel_id = self
|
||||
.active_chat
|
||||
.as_ref()
|
||||
.map(|(c, _)| c.read(cx).channel_id);
|
||||
let message_editor = self.message_editor.read(cx);
|
||||
|
||||
let reply_to_message_id = message_editor.reply_to_message_id();
|
||||
|
@ -1022,6 +1026,7 @@ impl Render for ChatPanel {
|
|||
.child(
|
||||
div().flex_shrink().overflow_hidden().child(
|
||||
h_flex()
|
||||
.id(("reply-preview", reply_to_message_id))
|
||||
.child(Label::new("Replying to ").size(LabelSize::Small))
|
||||
.child(
|
||||
div().font_weight(FontWeight::BOLD).child(
|
||||
|
@ -1031,7 +1036,20 @@ impl Render for ChatPanel {
|
|||
))
|
||||
.size(LabelSize::Small),
|
||||
),
|
||||
),
|
||||
)
|
||||
.when_some(channel_id, |this, channel_id| {
|
||||
this.cursor_pointer().on_click(cx.listener(
|
||||
move |chat_panel, _, cx| {
|
||||
chat_panel
|
||||
.select_channel(
|
||||
channel_id,
|
||||
reply_to_message_id.into(),
|
||||
cx,
|
||||
)
|
||||
.detach_and_log_err(cx)
|
||||
},
|
||||
))
|
||||
}),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
|
Loading…
Reference in a new issue