-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement add panel to root for DockArea #438
Comments
I've updated my fn into this pub fn add_panel_to_tabs(&self, panel: Arc<dyn PanelView>, cx: &mut ViewContext<Self>) {
match self.items.clone() {
DockItem::Tabs {
mut items,
mut active_ix,
view,
} => view.update(cx, |view, cx| {
view.add_panel(panel.clone(), cx);
items.push(panel);
active_ix += 1;
cx.notify();
}),
DockItem::Split { view, items, .. } => view.update(cx, |_, cx| {
for item in items.into_iter() {
if let DockItem::Tabs {
mut items,
mut active_ix,
view,
} = item
{
view.update(cx, |view, cx| {
view.add_panel(panel.clone(), cx);
items.push(panel.clone());
active_ix += 1;
cx.notify();
})
}
}
}),
}
} and it worked now |
Do you still need my help? It looks like it's ready. I'm also going to open a branch to check the problem. |
Ah, it seems work fine now. I will create a PR if you like, I think this fn is useful for #318 , user can create a sidebar then add new tab when user click to sidebar's component |
Other things I wonder is do I need to push new panel to view.add_panel(panel, cx);
items.push(panel); <- or just |
I've tried to implemented fn
add_panel_to_root
forDockArea
, but the view is not reload after add panel. Do you know what I'm missing?The text was updated successfully, but these errors were encountered: