Restructure chat message rendering to allow text to wrap
This commit is contained in:
parent
d03e29d55d
commit
049314e84e
1 changed files with 38 additions and 33 deletions
|
@ -347,40 +347,45 @@ impl ChatPanel {
|
||||||
ChannelMessageId::Pending(id) => ("pending-message", id).into(),
|
ChannelMessageId::Pending(id) => ("pending-message", id).into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// todo!("render the text with markdown formatting")
|
let mut result = v_stack()
|
||||||
if is_continuation {
|
.w_full()
|
||||||
h_stack()
|
.id(element_id)
|
||||||
.child(text.element(element_id, cx))
|
.relative()
|
||||||
.child(render_remove(message_id_to_remove, cx))
|
.group("")
|
||||||
.mb_1()
|
.mb_1();
|
||||||
.into_any()
|
|
||||||
} else {
|
if !is_continuation {
|
||||||
v_stack()
|
result = result.child(
|
||||||
.child(
|
h_stack()
|
||||||
h_stack()
|
.children(
|
||||||
.children(
|
message
|
||||||
message
|
.sender
|
||||||
.sender
|
.avatar
|
||||||
.avatar
|
.clone()
|
||||||
.clone()
|
.map(|avatar| Avatar::data(avatar)),
|
||||||
.map(|avatar| Avatar::data(avatar)),
|
)
|
||||||
)
|
.child(Label::new(message.sender.github_login.clone()))
|
||||||
.child(Label::new(message.sender.github_login.clone()))
|
.child(Label::new(format_timestamp(
|
||||||
.child(Label::new(format_timestamp(
|
message.timestamp,
|
||||||
message.timestamp,
|
now,
|
||||||
now,
|
self.local_timezone,
|
||||||
self.local_timezone,
|
))),
|
||||||
)))
|
);
|
||||||
.child(render_remove(message_id_to_remove, cx)),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
h_stack()
|
|
||||||
.child(text.element(element_id, cx))
|
|
||||||
.child(render_remove(None, cx)),
|
|
||||||
)
|
|
||||||
.mb_1()
|
|
||||||
.into_any()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
.child(text.element("body".into(), cx))
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.invisible()
|
||||||
|
.absolute()
|
||||||
|
.top_1()
|
||||||
|
.right_2()
|
||||||
|
.w_8()
|
||||||
|
.group_hover("", |this| this.visible())
|
||||||
|
.child(render_remove(message_id_to_remove, cx)),
|
||||||
|
)
|
||||||
|
.into_any()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_markdown_with_mentions(
|
fn render_markdown_with_mentions(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue