Restructure chat message rendering to allow text to wrap

This commit is contained in:
Max Brunsfeld 2023-12-08 15:40:55 -08:00
parent d03e29d55d
commit 049314e84e

View file

@ -347,16 +347,15 @@ 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
@ -370,18 +369,24 @@ impl ChatPanel {
message.timestamp, message.timestamp,
now, now,
self.local_timezone, self.local_timezone,
))) ))),
);
}
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)), .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() .into_any()
} }
}
fn render_markdown_with_mentions( fn render_markdown_with_mentions(
language_registry: &Arc<LanguageRegistry>, language_registry: &Arc<LanguageRegistry>,