Add placeholder text as a feature of Editor, use it in chat panel

This commit is contained in:
Max Brunsfeld
2021-09-02 17:36:56 -07:00
parent 1c43121ae0
commit 522bef2e3a
6 changed files with 63 additions and 2 deletions
+8 -1
View File
@@ -156,7 +156,14 @@ impl ChatPanel {
fn set_active_channel(&mut self, channel: ModelHandle<Channel>, cx: &mut ViewContext<Self>) {
if self.active_channel.as_ref().map(|e| &e.0) != Some(&channel) {
self.message_list.reset(channel.read(cx).message_count());
{
let channel = channel.read(cx);
self.message_list.reset(channel.message_count());
let placeholder = format!("Message #{}", channel.name());
self.input_editor.update(cx, move |editor, cx| {
editor.set_placeholder_text(placeholder, cx);
});
}
let subscription = cx.subscribe(&channel, Self::channel_did_change);
self.active_channel = Some((channel, subscription));
}